equal
deleted
inserted
replaced
385 pull_out_constr_comb hol_ctxt Ts false k num_exists t args seen |
385 pull_out_constr_comb hol_ctxt Ts false k num_exists t args seen |
386 else |
386 else |
387 (list_comb (t, args), seen) |
387 (list_comb (t, args), seen) |
388 in aux [] 0 t [] [] |> fst end |
388 in aux [] 0 t [] [] |> fst end |
389 |
389 |
390 fun destroy_pulled_out_constrs (hol_ctxt as {ctxt, stds, ...}) axiom t = |
390 fun destroy_pulled_out_constrs (hol_ctxt as {ctxt, stds, ...}) axiom strong t = |
391 let |
391 let |
392 val num_occs_of_var = |
392 val num_occs_of_var = |
393 fold_aterms (fn Var z => (fn f => fn z' => f z' |> z = z' ? Integer.add 1) |
393 fold_aterms (fn Var z => (fn f => fn z' => f z' |> z = z' ? Integer.add 1) |
394 | _ => I) t (K 0) |
394 | _ => I) t (K 0) |
395 fun aux Ts careful ((t0 as Const (@{const_name "=="}, _)) $ t1 $ t2) = |
395 fun aux Ts careful ((t0 as Const (@{const_name "=="}, _)) $ t1 $ t2) = |
402 t0 $ aux Ts false t1 $ aux Ts careful t2 |
402 t0 $ aux Ts false t1 $ aux Ts careful t2 |
403 | aux Ts careful (Abs (s, T, t')) = Abs (s, T, aux (T :: Ts) careful t') |
403 | aux Ts careful (Abs (s, T, t')) = Abs (s, T, aux (T :: Ts) careful t') |
404 | aux Ts careful (t1 $ t2) = aux Ts careful t1 $ aux Ts careful t2 |
404 | aux Ts careful (t1 $ t2) = aux Ts careful t1 $ aux Ts careful t2 |
405 | aux _ _ t = t |
405 | aux _ _ t = t |
406 and aux_eq Ts careful pass1 t0 t1 t2 = |
406 and aux_eq Ts careful pass1 t0 t1 t2 = |
407 ((if careful then |
407 ((if careful orelse |
|
408 not (strong orelse forall (is_constr_pattern ctxt) [t1, t2]) then |
408 raise SAME () |
409 raise SAME () |
409 else if axiom andalso is_Var t2 andalso |
410 else if axiom andalso is_Var t2 andalso |
410 num_occs_of_var (dest_Var t2) = 1 then |
411 num_occs_of_var (dest_Var t2) = 1 then |
411 @{const True} |
412 @{const True} |
412 else case strip_comb t2 of |
413 else case strip_comb t2 of |
1268 binarize ? binarize_nat_and_int_in_term |
1269 binarize ? binarize_nat_and_int_in_term |
1269 #> box ? uncurry_term table |
1270 #> box ? uncurry_term table |
1270 #> box ? box_fun_and_pair_in_term hol_ctxt def |
1271 #> box ? box_fun_and_pair_in_term hol_ctxt def |
1271 fun do_tail def = |
1272 fun do_tail def = |
1272 destroy_constrs ? (pull_out_universal_constrs hol_ctxt def |
1273 destroy_constrs ? (pull_out_universal_constrs hol_ctxt def |
1273 #> pull_out_existential_constrs hol_ctxt |
1274 #> pull_out_existential_constrs hol_ctxt) |
1274 #> destroy_pulled_out_constrs hol_ctxt def) |
1275 #> destroy_pulled_out_constrs hol_ctxt def destroy_constrs |
1275 #> curry_assms |
1276 #> curry_assms |
1276 #> destroy_universal_equalities |
1277 #> destroy_universal_equalities |
1277 #> destroy_existential_equalities hol_ctxt |
1278 #> destroy_existential_equalities hol_ctxt |
1278 #> simplify_constrs_and_sels ctxt |
1279 #> simplify_constrs_and_sels ctxt |
1279 #> distribute_quantifiers |
1280 #> distribute_quantifiers |