133 sig |
133 sig |
134 include BASIC_THM |
134 include BASIC_THM |
135 val dest_ctyp: ctyp -> ctyp list |
135 val dest_ctyp: ctyp -> ctyp list |
136 val dest_comb: cterm -> cterm * cterm |
136 val dest_comb: cterm -> cterm * cterm |
137 val dest_arg: cterm -> cterm |
137 val dest_arg: cterm -> cterm |
|
138 val dest_binop: cterm -> cterm * cterm |
138 val dest_abs: string option -> cterm -> cterm * cterm |
139 val dest_abs: string option -> cterm -> cterm * cterm |
139 val adjust_maxidx_cterm: int -> cterm -> cterm |
140 val adjust_maxidx_cterm: int -> cterm -> cterm |
140 val capply: cterm -> cterm -> cterm |
141 val capply: cterm -> cterm -> cterm |
141 val cabs: cterm -> cterm -> cterm |
142 val cabs: cterm -> cterm -> cterm |
142 val major_prem_of: thm -> term |
143 val major_prem_of: thm -> term |
269 fun dest_arg (Cterm {t = t $ u, T, thy_ref, maxidx, sorts}) = |
270 fun dest_arg (Cterm {t = t $ u, T, thy_ref, maxidx, sorts}) = |
270 let val A = Term.argument_type_of t in |
271 let val A = Term.argument_type_of t in |
271 Cterm {t = u, T = A, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts} |
272 Cterm {t = u, T = A, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts} |
272 end |
273 end |
273 | dest_arg _ = raise CTERM "dest_arg"; |
274 | dest_arg _ = raise CTERM "dest_arg"; |
|
275 |
|
276 fun dest_binop (Cterm {t = tm, T = _, thy_ref, maxidx, sorts}) = |
|
277 let fun cterm t T = Cterm {t = t, T = T, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts} in |
|
278 (case tm of |
|
279 Const (_, Type ("fun", [A, Type ("fun", [B, _])])) $ a $ b => (cterm a A, cterm b B) |
|
280 | Free (_, Type ("fun", [A, Type ("fun", [B, _])])) $ a $ b => (cterm a A, cterm b B) |
|
281 | Var (_, Type ("fun", [A, Type ("fun", [B, _])])) $ a $ b => (cterm a A, cterm b B) |
|
282 | _ => raise CTERM "dest_binop") |
|
283 end; |
274 |
284 |
275 fun dest_abs a (Cterm {t = Abs (x, T, t), T = Type ("fun", [_, U]), thy_ref, maxidx, sorts}) = |
285 fun dest_abs a (Cterm {t = Abs (x, T, t), T = Type ("fun", [_, U]), thy_ref, maxidx, sorts}) = |
276 let val (y', t') = Term.dest_abs (the_default x a, T, t) in |
286 let val (y', t') = Term.dest_abs (the_default x a, T, t) in |
277 (Cterm {t = Free (y', T), T = T, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts}, |
287 (Cterm {t = Free (y', T), T = T, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts}, |
278 Cterm {t = t', T = U, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts}) |
288 Cterm {t = t', T = U, thy_ref = thy_ref, maxidx = maxidx, sorts = sorts}) |