@@ -25,7 +25,19 @@ fun mk_insert x S =
2525fun binder_inductive_cmd ((pred_name, binds_opt), perms_supps) no_defs_lthy =
2626 let
2727 val binds = the_default [] binds_opt;
28- val ({names, ...}, { def, preds, mono, induct, intrs, ... }) = Inductive.the_inductive_global no_defs_lthy (long_name no_defs_lthy pred_name);
28+
29+ val (context, facts) = (Proof_Context.theory_of #>
30+ `Context.Theory ##> Proof_Context.init_global) no_defs_lthy ||> Proof_Context.facts_of;
31+ fun lookup name = the_single (#thms (the (
32+ Facts.lookup context facts (Facts.intern facts name)
33+ )));
34+
35+ val long_name = long_name no_defs_lthy pred_name;
36+ val ({names, ...}, { preds, induct, intrs, ... }) = Inductive.the_inductive_global no_defs_lthy long_name;
37+
38+ (* TODO: remove, this is a hack until the Isabelle patch is merged *)
39+ val def = lookup (long_name ^ " _def" );
40+ val operator = snd (Term.dest_comb (snd (Logic.dest_equals (Thm.prop_of def))));
2941
3042 val param_Ts = Term.binder_types (fastype_of (hd preds));
3143
@@ -231,7 +243,6 @@ fun binder_inductive_cmd ((pred_name, binds_opt), perms_supps) no_defs_lthy =
231243 val thy = Proof_Context.theory_of no_defs_lthy;
232244 fun mk_match mk_T ts = map2 (fn t => fn T =>
233245 let
234- val _ = @{print} (Thm.cterm_of no_defs_lthy t, T, mk_T T)
235246 val t = Logic.varify_types_global t;
236247 val tyenv = Sign.typ_match thy (fastype_of t, mk_T T) Vartab.empty;
237248 in Envir.subst_term (tyenv, Vartab.empty) t end
@@ -383,6 +394,17 @@ fun binder_inductive_cmd ((pred_name, binds_opt), perms_supps) no_defs_lthy =
383394 \<^Const>\<open >top \<^Type>\<open >set predT\<close>\<close> \<^Const>\<open >less_eq predT\<close> \<^Const>\<open >less_eq predT'\<close> t\<close>)
384395 end ;
385396
397+ val mono = Goal.prove_sorry lthy [] [] (mk_mono operator) (fn {context=ctxt, ...} => EVERY1 [
398+ rtac ctxt @{thm monoI},
399+ REPEAT_DETERM o resolve_tac ctxt @{thms le_funI le_boolI'},
400+ REPEAT_DETERM o FIRST' [
401+ assume_tac ctxt,
402+ resolve_tac ctxt (Inductive.get_monos ctxt),
403+ etac ctxt @{thm le_funE},
404+ dtac ctxt @{thm le_boolD}
405+ ]
406+ ]);
407+
386408 val G_mono = Goal.prove_sorry lthy [] [] (mk_mono (fst G))
387409 (fn {context=ctxt,...} => EVERY1 [
388410 K (Local_Defs.unfold0_tac ctxt [snd G]),
0 commit comments