src/Pure/proofterm.ML
changeset 70511 252e86967a69
parent 70510 5b35d46c994f
child 70529 2ecbbe6b35db
equal deleted inserted replaced
70510:5b35d46c994f 70511:252e86967a69
   819 
   819 
   820 fun OfClasst (T, c) =
   820 fun OfClasst (T, c) =
   821   let val U = Term.itselfT T --> propT
   821   let val U = Term.itselfT T --> propT
   822   in Const ("Pure.OfClass", U --> proofT) $ Const (Logic.const_of_class c, U) end;
   822   in Const ("Pure.OfClass", U --> proofT) $ Const (Logic.const_of_class c, U) end;
   823 
   823 
       
   824 fun term_of _ (PThm ({name, types = Ts, ...}, _)) =
       
   825       fold AppT (these Ts) (Const (Long_Name.append "thm" name, proofT))
       
   826   | term_of _ (PAxm (name, _, Ts)) =
       
   827       fold AppT (these Ts) (Const (Long_Name.append "axm" name, proofT))
       
   828   | term_of _ (OfClass (T, c)) = AppT T (OfClasst (T, c))
       
   829   | term_of _ (PBound i) = Bound i
       
   830   | term_of Ts (Abst (s, opT, prf)) =
       
   831       let val T = the_default dummyT opT in
       
   832         Const ("Pure.Abst", (T --> proofT) --> proofT) $
       
   833           Abs (s, T, term_of (T::Ts) (incr_pboundvars 1 0 prf))
       
   834       end
       
   835   | term_of Ts (AbsP (s, t, prf)) =
       
   836       AbsPt $ the_default Term.dummy_prop t $
       
   837         Abs (s, proofT, term_of (proofT::Ts) (incr_pboundvars 0 1 prf))
       
   838   | term_of Ts (prf1 %% prf2) =
       
   839       AppPt $ term_of Ts prf1 $ term_of Ts prf2
       
   840   | term_of Ts (prf % opt) =
       
   841       let
       
   842         val t = the_default Term.dummy opt;
       
   843         val T = fastype_of1 (Ts, t) handle TERM _ => dummyT;
       
   844       in Const ("Pure.Appt", proofT --> T --> proofT) $ term_of Ts prf $ t end
       
   845   | term_of _ (Hyp t) = Hypt $ t
       
   846   | term_of _ (Oracle (_, t, _)) = Oraclet $ t
       
   847   | term_of _ MinProof = MinProoft;
       
   848 
   824 in
   849 in
   825 
   850 
   826 fun thm_const_default (_: proof_serial) name = Long_Name.append "thm" name;
   851 val term_of_proof = term_of [];
   827 fun axm_const_default name = Long_Name.append "axm" name;
       
   828 
       
   829 fun term_of
       
   830    {thm_const: proof_serial -> string -> string,
       
   831     axm_const: string -> string} =
       
   832   let
       
   833     fun term _ (PThm ({serial = i, name, types = Ts, ...}, _)) =
       
   834           fold AppT (these Ts) (Const (thm_const i name, proofT))
       
   835       | term _ (PAxm (name, _, Ts)) =
       
   836           fold AppT (these Ts) (Const (axm_const name, proofT))
       
   837       | term _ (OfClass (T, c)) = AppT T (OfClasst (T, c))
       
   838       | term _ (PBound i) = Bound i
       
   839       | term Ts (Abst (s, opT, prf)) =
       
   840           let val T = the_default dummyT opT in
       
   841             Const ("Pure.Abst", (T --> proofT) --> proofT) $
       
   842               Abs (s, T, term (T::Ts) (incr_pboundvars 1 0 prf))
       
   843           end
       
   844       | term Ts (AbsP (s, t, prf)) =
       
   845           AbsPt $ the_default Term.dummy_prop t $
       
   846             Abs (s, proofT, term (proofT::Ts) (incr_pboundvars 0 1 prf))
       
   847       | term Ts (prf1 %% prf2) =
       
   848           AppPt $ term Ts prf1 $ term Ts prf2
       
   849       | term Ts (prf % opt) =
       
   850           let
       
   851             val t = the_default Term.dummy opt;
       
   852             val T = fastype_of1 (Ts, t) handle TERM _ => dummyT;
       
   853           in Const ("Pure.Appt", proofT --> T --> proofT) $ term Ts prf $ t end
       
   854       | term _ (Hyp t) = Hypt $ t
       
   855       | term _ (Oracle (_, t, _)) = Oraclet $ t
       
   856       | term _ MinProof = MinProoft;
       
   857   in term [] end;
       
   858 
       
   859 val term_of_proof = term_of {thm_const = thm_const_default, axm_const = axm_const_default};
       
   860 
   852 
   861 end;
   853 end;
   862 
   854 
   863 
   855 
   864 
   856