214 val class_prefix = "cl_" |
214 val class_prefix = "cl_" |
215 |
215 |
216 (* Freshness almost guaranteed! *) |
216 (* Freshness almost guaranteed! *) |
217 val atp_prefix = "ATP" ^ Long_Name.separator |
217 val atp_prefix = "ATP" ^ Long_Name.separator |
218 val atp_weak_prefix = "ATP:" |
218 val atp_weak_prefix = "ATP:" |
|
219 val atp_weak_suffix = ":ATP" |
219 |
220 |
220 val lam_lifted_prefix = atp_weak_prefix ^ "Lam" |
221 val lam_lifted_prefix = atp_weak_prefix ^ "Lam" |
221 val lam_lifted_mono_prefix = lam_lifted_prefix ^ "m" |
222 val lam_lifted_mono_prefix = lam_lifted_prefix ^ "m" |
222 val lam_lifted_poly_prefix = lam_lifted_prefix ^ "p" |
223 val lam_lifted_poly_prefix = lam_lifted_prefix ^ "p" |
223 |
224 |
374 fun make_all_bound_var x = all_bound_var_prefix ^ ascii_of x |
375 fun make_all_bound_var x = all_bound_var_prefix ^ ascii_of x |
375 fun make_exist_bound_var x = exist_bound_var_prefix ^ ascii_of x |
376 fun make_exist_bound_var x = exist_bound_var_prefix ^ ascii_of x |
376 fun make_schematic_var v = schematic_var_prefix ^ ascii_of_indexname v |
377 fun make_schematic_var v = schematic_var_prefix ^ ascii_of_indexname v |
377 fun make_fixed_var x = fixed_var_prefix ^ ascii_of x |
378 fun make_fixed_var x = fixed_var_prefix ^ ascii_of x |
378 |
379 |
379 fun make_tvar (s, i) = tvar_prefix ^ ascii_of_indexname (unprefix "'" s, i) |
380 fun make_tvar (s, i) = tvar_prefix ^ ascii_of_indexname (unquote_tvar s, i) |
380 fun make_tfree s = tfree_prefix ^ ascii_of (unprefix "'" s) |
381 fun make_tfree s = tfree_prefix ^ ascii_of (unquote_tvar s) |
381 fun tvar_name ((x as (s, _)), _) = (make_tvar x, s) |
382 fun tvar_name ((x as (s, _)), _) = (make_tvar x, s) |
382 |
383 |
383 (* "HOL.eq" and choice are mapped to the ATP's equivalents *) |
384 (* "HOL.eq" and choice are mapped to the ATP's equivalents *) |
384 local |
385 local |
385 val choice_const = (fst o dest_Const o HOLogic.choice_const) dummyT |
386 val choice_const = (fst o dest_Const o HOLogic.choice_const) dummyT |
1258 |
1259 |
1259 (* Metis's use of "resolve_tac" freezes the schematic variables. We simulate the |
1260 (* Metis's use of "resolve_tac" freezes the schematic variables. We simulate the |
1260 same in Sledgehammer to prevent the discovery of unreplayable proofs. *) |
1261 same in Sledgehammer to prevent the discovery of unreplayable proofs. *) |
1261 fun freeze_term t = |
1262 fun freeze_term t = |
1262 let |
1263 let |
|
1264 (* Freshness is desirable for completeness, but not for soundness. *) |
|
1265 fun indexed_name (s, i) = s ^ "_" ^ string_of_int i ^ atp_weak_suffix |
1263 fun freeze (t $ u) = freeze t $ freeze u |
1266 fun freeze (t $ u) = freeze t $ freeze u |
1264 | freeze (Abs (s, T, t)) = Abs (s, T, freeze t) |
1267 | freeze (Abs (s, T, t)) = Abs (s, T, freeze t) |
1265 | freeze (Var ((s, i), T)) = |
1268 | freeze (Var (x, T)) = Free (indexed_name x, T) |
1266 Free (atp_weak_prefix ^ s ^ "_" ^ string_of_int i, T) |
|
1267 | freeze t = t |
1269 | freeze t = t |
1268 in t |> exists_subterm is_Var t ? freeze end |
1270 fun freeze_tvar (x, S) = TFree (indexed_name x, S) |
|
1271 in |
|
1272 t |> exists_subterm is_Var t ? freeze |
|
1273 |> exists_type (exists_subtype is_TVar) t |
|
1274 ? map_types (map_type_tvar freeze_tvar) |
|
1275 end |
1269 |
1276 |
1270 fun presimp_prop ctxt type_enc t = |
1277 fun presimp_prop ctxt type_enc t = |
1271 let |
1278 let |
1272 val thy = Proof_Context.theory_of ctxt |
1279 val thy = Proof_Context.theory_of ctxt |
1273 val t = t |> Envir.beta_eta_contract |
1280 val t = t |> Envir.beta_eta_contract |