1.1 --- a/src/HOL/Tools/ATP/atp_translate.ML Tue Jul 26 14:53:00 2011 +0200
1.2 +++ b/src/HOL/Tools/ATP/atp_translate.ML Tue Jul 26 14:53:00 2011 +0200
1.3 @@ -805,32 +805,44 @@
1.4
1.5 fun introduce_proxies type_enc =
1.6 let
1.7 - fun intro top_level (IApp (tm1, tm2)) =
1.8 - IApp (intro top_level tm1, intro false tm2)
1.9 - | intro top_level (IConst (name as (s, _), T, T_args)) =
1.10 + fun tweak_ho_quant ho_quant T [IAbs _] = IConst (`I ho_quant, T, [])
1.11 + | tweak_ho_quant ho_quant (T as Type (_, [p_T as Type (_, [x_T, _]), _]))
1.12 + _ =
1.13 + (* Eta-expand "!!" and "??", to work around LEO-II 1.2.8 parser
1.14 + limitation. This works in conjuction with special code in
1.15 + "ATP_Problem" that uses the syntactic sugar "!" and "?" whenever
1.16 + possible. *)
1.17 + IAbs ((`I "P", p_T),
1.18 + IApp (IConst (`I ho_quant, T, []),
1.19 + IAbs ((`I "X", x_T),
1.20 + IApp (IConst (`I "P", p_T, []),
1.21 + IConst (`I "X", x_T, [])))))
1.22 + | tweak_ho_quant _ _ _ = raise Fail "unexpected type for quantifier"
1.23 + fun intro top_level args (IApp (tm1, tm2)) =
1.24 + IApp (intro top_level (tm2 :: args) tm1, intro false [] tm2)
1.25 + | intro top_level args (IConst (name as (s, _), T, T_args)) =
1.26 (case proxify_const s of
1.27 SOME proxy_base =>
1.28 if top_level orelse is_type_enc_higher_order type_enc then
1.29 case (top_level, s) of
1.30 - (_, "c_False") => (`I tptp_false, [])
1.31 - | (_, "c_True") => (`I tptp_true, [])
1.32 - | (false, "c_Not") => (`I tptp_not, [])
1.33 - | (false, "c_conj") => (`I tptp_and, [])
1.34 - | (false, "c_disj") => (`I tptp_or, [])
1.35 - | (false, "c_implies") => (`I tptp_implies, [])
1.36 - | (false, "c_All") => (`I tptp_ho_forall, [])
1.37 - | (false, "c_Ex") => (`I tptp_ho_exists, [])
1.38 + (_, "c_False") => IConst (`I tptp_false, T, [])
1.39 + | (_, "c_True") => IConst (`I tptp_true, T, [])
1.40 + | (false, "c_Not") => IConst (`I tptp_not, T, [])
1.41 + | (false, "c_conj") => IConst (`I tptp_and, T, [])
1.42 + | (false, "c_disj") => IConst (`I tptp_or, T, [])
1.43 + | (false, "c_implies") => IConst (`I tptp_implies, T, [])
1.44 + | (false, "c_All") => tweak_ho_quant tptp_ho_forall T args
1.45 + | (false, "c_Ex") => tweak_ho_quant tptp_ho_exists T args
1.46 | (false, s) =>
1.47 - if is_tptp_equal s then (`I tptp_equal, [])
1.48 - else (proxy_base |>> prefix const_prefix, T_args)
1.49 - | _ => (name, [])
1.50 + if is_tptp_equal s then IConst (`I tptp_equal, T, [])
1.51 + else IConst (proxy_base |>> prefix const_prefix, T, T_args)
1.52 + | _ => IConst (name, T, [])
1.53 else
1.54 - (proxy_base |>> prefix const_prefix, T_args)
1.55 - | NONE => (name, T_args))
1.56 - |> (fn (name, T_args) => IConst (name, T, T_args))
1.57 - | intro _ (IAbs (bound, tm)) = IAbs (bound, intro false tm)
1.58 - | intro _ tm = tm
1.59 - in intro true end
1.60 + IConst (proxy_base |>> prefix const_prefix, T, T_args)
1.61 + | NONE => IConst (name, T, T_args))
1.62 + | intro _ _ (IAbs (bound, tm)) = IAbs (bound, intro false [] tm)
1.63 + | intro _ _ tm = tm
1.64 + in intro true [] end
1.65
1.66 fun iformula_from_prop thy type_enc eq_as_iff =
1.67 let