src/HOL/Tools/ATP/atp_proof_reconstruct.ML
changeset 57717 949838aba487
parent 57713 9e4d2f7ad0a0
child 57765 f1108245ba11
equal deleted inserted replaced
57716:4546c9fdd8a7 57717:949838aba487
   567    (@{const_name Meson.COMBC}, @{thm Meson.COMBC_def [abs_def]}),
   567    (@{const_name Meson.COMBC}, @{thm Meson.COMBC_def [abs_def]}),
   568    (@{const_name Meson.COMBS}, @{thm Meson.COMBS_def [abs_def]})]
   568    (@{const_name Meson.COMBS}, @{thm Meson.COMBS_def [abs_def]})]
   569 
   569 
   570 fun uncombine_term thy =
   570 fun uncombine_term thy =
   571   let
   571   let
   572     fun aux (t1 $ t2) = betapply (pairself aux (t1, t2))
   572     fun uncomb (t1 $ t2) = betapply (uncomb t1, uncomb t2)
   573       | aux (Abs (s, T, t')) = Abs (s, T, aux t')
   573       | uncomb (Abs (s, T, t)) = Abs (s, T, uncomb t)
   574       | aux (t as Const (x as (s, _))) =
   574       | uncomb (t as Const (x as (s, _))) =
   575         (case AList.lookup (op =) combinator_table s of
   575         (case AList.lookup (op =) combinator_table s of
   576           SOME thm => thm |> prop_of |> specialize_type thy x |> Logic.dest_equals |> snd
   576           SOME thm => thm |> prop_of |> specialize_type thy x |> Logic.dest_equals |> snd
   577         | NONE => t)
   577         | NONE => t)
   578       | aux t = t
   578       | uncomb t = t
   579   in aux end
   579   in uncomb end
   580 
   580 
   581 fun unlift_term lifted =
   581 fun unlift_aterm lifted (t as Const (s, _)) =
   582   map_aterms (fn t as Const (s, _) =>
   582     if String.isPrefix lam_lifted_prefix s then
   583                  if String.isPrefix lam_lifted_prefix s then
   583       (* FIXME: do something about the types *)
   584                    (* FIXME: do something about the types *)
   584       (case AList.lookup (op =) lifted s of
   585                    (case AList.lookup (op =) lifted s of
   585         SOME t' => unlift_term lifted t'
   586                      SOME t => unlift_term lifted t
   586       | NONE => t)
   587                    | NONE => t)
   587     else
   588                  else
   588       t
   589                    t
   589   | unlift_aterm _ t = t
   590                | t => t)
   590 and unlift_term lifted =
       
   591   map_aterms (unlift_aterm lifted)
   591 
   592 
   592 fun termify_line _ _ _ _ _ (_, Type_Role, _, _, _) = NONE
   593 fun termify_line _ _ _ _ _ (_, Type_Role, _, _, _) = NONE
   593   | termify_line ctxt format type_enc lifted sym_tab (name, role, u, rule, deps) =
   594   | termify_line ctxt format type_enc lifted sym_tab (name, role, u, rule, deps) =
   594     let
   595     let
   595       val thy = Proof_Context.theory_of ctxt
   596       val thy = Proof_Context.theory_of ctxt
   596       val t = u
   597       val t = u
   597         |> prop_of_atp ctxt format type_enc true sym_tab
   598         |> prop_of_atp ctxt format type_enc true sym_tab
       
   599         |> unlift_term lifted
   598         |> uncombine_term thy
   600         |> uncombine_term thy
   599         |> unlift_term lifted
       
   600     in
   601     in
   601       SOME (name, role, t, rule, deps)
   602       SOME (name, role, t, rule, deps)
   602     end
   603     end
   603 
   604 
   604 val waldmeister_conjecture_num = "1.0.0.0"
   605 val waldmeister_conjecture_num = "1.0.0.0"