src/HOL/Tools/ATP/atp_translate.ML
changeset 43939 081718c0b0a8
parent 43936 127749bbc639
child 43961 91294d386539
equal deleted inserted replaced
43938:78a0a2ad91a3 43939:081718c0b0a8
    86     connective -> ('a, 'b, 'c) formula list -> ('a, 'b, 'c) formula
    86     connective -> ('a, 'b, 'c) formula list -> ('a, 'b, 'c) formula
    87   val unmangled_const : string -> string * (string, 'b) ho_term list
    87   val unmangled_const : string -> string * (string, 'b) ho_term list
    88   val unmangled_const_name : string -> string
    88   val unmangled_const_name : string -> string
    89   val helper_table : ((string * bool) * thm list) list
    89   val helper_table : ((string * bool) * thm list) list
    90   val factsN : string
    90   val factsN : string
    91   val conceal_lambdas : Proof.context -> term -> term
       
    92   val introduce_combinators : Proof.context -> term -> term
    91   val introduce_combinators : Proof.context -> term -> term
    93   val prepare_atp_problem :
    92   val prepare_atp_problem :
    94     Proof.context -> format -> formula_kind -> formula_kind -> type_enc -> bool
    93     Proof.context -> format -> formula_kind -> formula_kind -> type_enc -> bool
    95     -> bool -> (term list -> term list * term list) -> bool -> bool -> term list
    94     -> bool -> (term list -> term list * term list) -> bool -> bool -> term list
    96     -> term -> ((string * locality) * term) list
    95     -> term -> ((string * locality) * term) list
   158 val prefixed_app_op_name = const_prefix ^ app_op_name
   157 val prefixed_app_op_name = const_prefix ^ app_op_name
   159 val prefixed_type_tag_name = const_prefix ^ type_tag_name
   158 val prefixed_type_tag_name = const_prefix ^ type_tag_name
   160 
   159 
   161 (* Freshness almost guaranteed! *)
   160 (* Freshness almost guaranteed! *)
   162 val atp_weak_prefix = "ATP:"
   161 val atp_weak_prefix = "ATP:"
   163 
       
   164 val concealed_lambda_prefix = atp_weak_prefix ^ "lambda_"
       
   165 
   162 
   166 (*Escaping of special characters.
   163 (*Escaping of special characters.
   167   Alphanumeric characters are left unchanged.
   164   Alphanumeric characters are left unchanged.
   168   The character _ goes to __
   165   The character _ goes to __
   169   Characters in the range ASCII space to / go to _A to _P, respectively.
   166   Characters in the range ASCII space to / go to _A to _P, respectively.
   924 
   921 
   925 fun do_conceal_lambdas Ts (t1 $ t2) =
   922 fun do_conceal_lambdas Ts (t1 $ t2) =
   926     do_conceal_lambdas Ts t1 $ do_conceal_lambdas Ts t2
   923     do_conceal_lambdas Ts t1 $ do_conceal_lambdas Ts t2
   927   | do_conceal_lambdas Ts (Abs (_, T, t)) =
   924   | do_conceal_lambdas Ts (Abs (_, T, t)) =
   928     (* slightly unsound because of hash collisions *)
   925     (* slightly unsound because of hash collisions *)
   929     Free (concealed_lambda_prefix ^ string_of_int (hash_term t),
   926     Free (polymorphic_free_prefix ^ serial_string (), T --> fastype_of1 (Ts, t))
   930           T --> fastype_of1 (Ts, t))
       
   931   | do_conceal_lambdas _ t = t
   927   | do_conceal_lambdas _ t = t
   932 val conceal_lambdas = simple_translate_lambdas (K do_conceal_lambdas)
       
   933 
   928 
   934 fun do_introduce_combinators ctxt Ts t =
   929 fun do_introduce_combinators ctxt Ts t =
   935   let val thy = Proof_Context.theory_of ctxt in
   930   let val thy = Proof_Context.theory_of ctxt in
   936     t |> conceal_bounds Ts
   931     t |> conceal_bounds Ts
   937       |> cterm_of thy
   932       |> cterm_of thy