equal
deleted
inserted
replaced
15 val add_def: (binding * mixfix) * term -> Proof.context -> (term * thm) * Proof.context |
15 val add_def: (binding * mixfix) * term -> Proof.context -> (term * thm) * Proof.context |
16 val fixed_abbrev: (binding * mixfix) * term -> Proof.context -> |
16 val fixed_abbrev: (binding * mixfix) * term -> Proof.context -> |
17 (term * term) * Proof.context |
17 (term * term) * Proof.context |
18 val export: Proof.context -> Proof.context -> thm -> (thm list * thm list) * thm |
18 val export: Proof.context -> Proof.context -> thm -> (thm list * thm list) * thm |
19 val export_cterm: Proof.context -> Proof.context -> cterm -> (thm list * thm list) * cterm |
19 val export_cterm: Proof.context -> Proof.context -> cterm -> (thm list * thm list) * cterm |
20 val trans_terms: Proof.context -> thm list -> thm |
20 val contract: thm list -> cterm -> thm -> thm |
21 val trans_props: Proof.context -> thm list -> thm |
|
22 val contract: Proof.context -> thm list -> cterm -> thm -> thm |
|
23 val print_rules: Proof.context -> unit |
21 val print_rules: Proof.context -> unit |
24 val defn_add: attribute |
22 val defn_add: attribute |
25 val defn_del: attribute |
23 val defn_del: attribute |
26 val meta_rewrite_conv: Proof.context -> conv |
24 val meta_rewrite_conv: Proof.context -> conv |
27 val meta_rewrite_rule: Proof.context -> thm -> thm |
25 val meta_rewrite_rule: Proof.context -> thm -> thm |
164 TERM b as b xs == b as |
162 TERM b as b xs == b as |
165 *) |
163 *) |
166 fun export_cterm inner outer ct = |
164 fun export_cterm inner outer ct = |
167 export inner outer (Drule.mk_term ct) ||> Drule.dest_term; |
165 export inner outer (Drule.mk_term ct) ||> Drule.dest_term; |
168 |
166 |
169 |
167 fun contract defs ct th = |
170 (* basic transitivity reasoning -- modulo beta-eta *) |
168 th COMP (Raw_Simplifier.rewrite true defs ct COMP_INCR Drule.equal_elim_rule2); |
171 |
|
172 local |
|
173 |
|
174 val is_trivial = Pattern.aeconv o Logic.dest_equals o Thm.prop_of; |
|
175 |
|
176 fun trans_list _ _ [] = raise List.Empty |
|
177 | trans_list trans ctxt (th :: raw_eqs) = |
|
178 (case filter_out is_trivial raw_eqs of |
|
179 [] => th |
|
180 | eqs => |
|
181 let val ((_, th' :: eqs'), ctxt') = Variable.import true (th :: eqs) ctxt |
|
182 in singleton (Variable.export ctxt' ctxt) (fold trans eqs' th') end); |
|
183 |
|
184 in |
|
185 |
|
186 val trans_terms = trans_list (fn eq2 => fn eq1 => eq2 COMP (eq1 COMP Drule.transitive_thm)); |
|
187 val trans_props = trans_list (fn eq => fn th => th COMP (eq COMP Drule.equal_elim_rule1)); |
|
188 |
|
189 end; |
|
190 |
|
191 fun contract ctxt defs ct th = |
|
192 trans_props ctxt [th, Thm.symmetric (Raw_Simplifier.rewrite true defs ct)]; |
|
193 |
169 |
194 |
170 |
195 |
171 |
196 (** defived definitions **) |
172 (** defived definitions **) |
197 |
173 |