62 val params_of: thm -> term list |
62 val params_of: thm -> term list |
63 val partition_rules: thm -> thm list -> (string * thm list) list |
63 val partition_rules: thm -> thm list -> (string * thm list) list |
64 val partition_rules': thm -> (thm * 'a) list -> (string * (thm * 'a) list) list |
64 val partition_rules': thm -> (thm * 'a) list -> (string * (thm * 'a) list) list |
65 val unpartition_rules: thm list -> (string * 'a list) list -> 'a list |
65 val unpartition_rules: thm list -> (string * 'a list) list -> 'a list |
66 val infer_intro_vars: thm -> int -> thm list -> term list list |
66 val infer_intro_vars: thm -> int -> thm list -> term list list |
67 val setup: theory -> theory |
|
68 end; |
67 end; |
69 |
68 |
70 signature INDUCTIVE = |
69 signature INDUCTIVE = |
71 sig |
70 sig |
72 include BASIC_INDUCTIVE |
71 include BASIC_INDUCTIVE |
273 |
272 |
274 val mono_del = |
273 val mono_del = |
275 Thm.declaration_attribute (fn thm => fn context => |
274 Thm.declaration_attribute (fn thm => fn context => |
276 map_data (fn (infos, monos, equations) => |
275 map_data (fn (infos, monos, equations) => |
277 (infos, Thm.del_thm (mk_mono (Context.proof_of context) thm) monos, equations)) context); |
276 (infos, Thm.del_thm (mk_mono (Context.proof_of context) thm) monos, equations)) context); |
|
277 |
|
278 val _ = |
|
279 Theory.setup |
|
280 (Attrib.setup @{binding mono} (Attrib.add_del mono_add mono_del) |
|
281 "declaration of monotonicity rule"); |
278 |
282 |
279 |
283 |
280 (* equations *) |
284 (* equations *) |
281 |
285 |
282 val get_equations = #equations o rep_data; |
286 val get_equations = #equations o rep_data; |
585 in lthy |> Local_Theory.notes facts end; |
589 in lthy |> Local_Theory.notes facts end; |
586 |
590 |
587 val inductive_cases = gen_inductive_cases Attrib.check_src Syntax.read_prop; |
591 val inductive_cases = gen_inductive_cases Attrib.check_src Syntax.read_prop; |
588 val inductive_cases_i = gen_inductive_cases (K I) Syntax.check_prop; |
592 val inductive_cases_i = gen_inductive_cases (K I) Syntax.check_prop; |
589 |
593 |
590 |
594 val _ = |
591 val ind_cases_setup = |
595 Theory.setup |
592 Method.setup @{binding ind_cases} |
596 (Method.setup @{binding ind_cases} |
593 (Scan.lift (Scan.repeat1 Args.name_inner_syntax -- |
597 (Scan.lift (Scan.repeat1 Args.name_inner_syntax -- |
594 Scan.optional (Args.$$$ "for" |-- Scan.repeat1 Args.binding) []) >> |
598 Scan.optional (Args.$$$ "for" |-- Scan.repeat1 Args.binding) []) >> |
595 (fn (raw_props, fixes) => fn ctxt => |
599 (fn (raw_props, fixes) => fn ctxt => |
596 let |
600 let |
597 val (_, ctxt') = Variable.add_fixes_binding fixes ctxt; |
601 val (_, ctxt') = Variable.add_fixes_binding fixes ctxt; |
598 val props = Syntax.read_props ctxt' raw_props; |
602 val props = Syntax.read_props ctxt' raw_props; |
599 val ctxt'' = fold Variable.declare_term props ctxt'; |
603 val ctxt'' = fold Variable.declare_term props ctxt'; |
600 val rules = Proof_Context.export ctxt'' ctxt (map (mk_cases ctxt'') props) |
604 val rules = Proof_Context.export ctxt'' ctxt (map (mk_cases ctxt'') props) |
601 in Method.erule ctxt 0 rules end)) |
605 in Method.erule ctxt 0 rules end)) |
602 "dynamic case analysis on predicates"; |
606 "dynamic case analysis on predicates"); |
603 |
607 |
604 |
608 |
605 (* derivation of simplified equation *) |
609 (* derivation of simplified equation *) |
606 |
610 |
607 fun mk_simp_eq ctxt prop = |
611 fun mk_simp_eq ctxt prop = |
1140 map (mtch o apsnd prop_of) (cases ~~ intros) |
1144 map (mtch o apsnd prop_of) (cases ~~ intros) |
1141 end; |
1145 end; |
1142 |
1146 |
1143 |
1147 |
1144 |
1148 |
1145 (** package setup **) |
1149 (** outer syntax **) |
1146 |
|
1147 (* setup theory *) |
|
1148 |
|
1149 val setup = |
|
1150 ind_cases_setup #> |
|
1151 Attrib.setup @{binding mono} (Attrib.add_del mono_add mono_del) |
|
1152 "declaration of monotonicity rule"; |
|
1153 |
|
1154 |
|
1155 (* outer syntax *) |
|
1156 |
1150 |
1157 fun gen_ind_decl mk_def coind = |
1151 fun gen_ind_decl mk_def coind = |
1158 Parse.fixes -- Parse.for_fixes -- |
1152 Parse.fixes -- Parse.for_fixes -- |
1159 Scan.optional Parse_Spec.where_alt_specs [] -- |
1153 Scan.optional Parse_Spec.where_alt_specs [] -- |
1160 Scan.optional (@{keyword "monos"} |-- Parse.!!! Parse.xthms1) [] |
1154 Scan.optional (@{keyword "monos"} |-- Parse.!!! Parse.xthms1) [] |