136 cantunify thy (Envir.norm_term env t', Envir.norm_term env u') |
136 cantunify thy (Envir.norm_term env t', Envir.norm_term env u') |
137 end; |
137 end; |
138 |
138 |
139 fun mk_cnstrts_atom env vTs prop opTs prf = |
139 fun mk_cnstrts_atom env vTs prop opTs prf = |
140 let |
140 let |
141 val tvars = term_tvars prop; |
141 val tvars = OldTerm.term_tvars prop; |
142 val tfrees = term_tfrees prop; |
142 val tfrees = OldTerm.term_tfrees prop; |
143 val (env', Ts) = (case opTs of |
143 val (env', Ts) = (case opTs of |
144 NONE => foldl_map mk_tvar (env, map snd tvars @ map snd tfrees) |
144 NONE => foldl_map mk_tvar (env, map snd tvars @ map snd tfrees) |
145 | SOME Ts => (env, Ts)); |
145 | SOME Ts => (env, Ts)); |
146 val prop' = subst_atomic_types (map TVar tvars @ map TFree tfrees ~~ Ts) |
146 val prop' = subst_atomic_types (map TVar tvars @ map TFree tfrees ~~ Ts) |
147 (forall_intr_vfs prop) handle Library.UnequalLengths => |
147 (forall_intr_vfs prop) handle Library.UnequalLengths => |
297 in |
297 in |
298 thawf (norm_proof env' prf) |
298 thawf (norm_proof env' prf) |
299 end; |
299 end; |
300 |
300 |
301 fun prop_of_atom prop Ts = subst_atomic_types |
301 fun prop_of_atom prop Ts = subst_atomic_types |
302 (map TVar (term_tvars prop) @ map TFree (term_tfrees prop) ~~ Ts) |
302 (map TVar (OldTerm.term_tvars prop) @ map TFree (OldTerm.term_tfrees prop) ~~ Ts) |
303 (forall_intr_vfs prop); |
303 (forall_intr_vfs prop); |
304 |
304 |
305 val head_norm = Envir.head_norm (Envir.empty 0); |
305 val head_norm = Envir.head_norm (Envir.empty 0); |
306 |
306 |
307 fun prop_of0 Hs (PBound i) = List.nth (Hs, i) |
307 fun prop_of0 Hs (PBound i) = List.nth (Hs, i) |
364 in (maxidx' + maxidx + 1, inc (maxidx + 1) prf, |
364 in (maxidx' + maxidx + 1, inc (maxidx + 1) prf, |
365 ((a, prop), (maxidx', prf)) :: prfs') |
365 ((a, prop), (maxidx', prf)) :: prfs') |
366 end |
366 end |
367 | SOME (maxidx', prf) => (maxidx' + maxidx + 1, |
367 | SOME (maxidx', prf) => (maxidx' + maxidx + 1, |
368 inc (maxidx + 1) prf, prfs)); |
368 inc (maxidx + 1) prf, prfs)); |
369 val tfrees = term_tfrees prop; |
369 val tfrees = OldTerm.term_tfrees prop; |
370 val tye = map (fn ((s, j), _) => (s, maxidx + 1 + j)) |
370 val tye = map (fn ((s, j), _) => (s, maxidx + 1 + j)) |
371 (term_tvars prop) @ map (rpair ~1 o fst) tfrees ~~ Ts; |
371 (OldTerm.term_tvars prop) @ map (rpair ~1 o fst) tfrees ~~ Ts; |
372 val varify = map_type_tfree (fn p as (a, S) => |
372 val varify = map_type_tfree (fn p as (a, S) => |
373 if member (op =) tfrees p then TVar ((a, ~1), S) else TFree p) |
373 if member (op =) tfrees p then TVar ((a, ~1), S) else TFree p) |
374 in |
374 in |
375 (maxidx', prfs', map_proof_terms (subst_TVars tye o |
375 (maxidx', prfs', map_proof_terms (subst_TVars tye o |
376 map_types varify) (typ_subst_TVars tye o varify) prf) |
376 map_types varify) (typ_subst_TVars tye o varify) prf) |