equal
deleted
inserted
replaced
194 ZAxiom of string |
194 ZAxiom of string |
195 | ZOracle of string |
195 | ZOracle of string |
196 | ZBox of serial |
196 | ZBox of serial |
197 | ZThm of {theory_name: string, thm_name: Thm_Name.T * Position.T, serial: int}; |
197 | ZThm of {theory_name: string, thm_name: Thm_Name.T * Position.T, serial: int}; |
198 |
198 |
|
199 type zproof_const = (zproof_name * zterm) * (ztyp ZTVars.table * zterm ZVars.table); |
|
200 |
199 datatype zproof = |
201 datatype zproof = |
200 ZDummy (*dummy proof*) |
202 ZDummy (*dummy proof*) |
201 | ZConstp of (zproof_name * zterm) * (ztyp ZTVars.table * zterm ZVars.table) |
203 | ZConstp of zproof_const |
202 | ZBoundp of int |
204 | ZBoundp of int |
203 | ZAbst of string * ztyp * zproof |
205 | ZAbst of string * ztyp * zproof |
204 | ZAbsp of string * zterm * zproof |
206 | ZAbsp of string * zterm * zproof |
205 | ZAppt of zproof * zterm |
207 | ZAppt of zproof * zterm |
206 | ZAppp of zproof * zproof |
208 | ZAppp of zproof * zproof |
215 sig |
217 sig |
216 datatype ztyp = datatype ztyp |
218 datatype ztyp = datatype ztyp |
217 datatype zterm = datatype zterm |
219 datatype zterm = datatype zterm |
218 datatype zproof = datatype zproof |
220 datatype zproof = datatype zproof |
219 exception ZTERM of string * ztyp list * zterm list * zproof list |
221 exception ZTERM of string * ztyp list * zterm list * zproof list |
220 type zproof_const = (zproof_name * zterm) * (ztyp ZTVars.table * zterm ZVars.table) |
|
221 val fold_tvars: (indexname * sort -> 'a -> 'a) -> ztyp -> 'a -> 'a |
222 val fold_tvars: (indexname * sort -> 'a -> 'a) -> ztyp -> 'a -> 'a |
222 val fold_aterms: (zterm -> 'a -> 'a) -> zterm -> 'a -> 'a |
223 val fold_aterms: (zterm -> 'a -> 'a) -> zterm -> 'a -> 'a |
223 val fold_types: (ztyp -> 'a -> 'a) -> zterm -> 'a -> 'a |
224 val fold_types: (ztyp -> 'a -> 'a) -> zterm -> 'a -> 'a |
224 val ztyp_ord: ztyp ord |
225 val ztyp_ord: ztyp ord |
225 val fast_zterm_ord: zterm ord |
226 val fast_zterm_ord: zterm ord |
786 |
787 |
787 (** proof construction **) |
788 (** proof construction **) |
788 |
789 |
789 (* constants *) |
790 (* constants *) |
790 |
791 |
791 type zproof_const = (zproof_name * zterm) * (ztyp ZTVars.table * zterm ZVars.table); |
|
792 |
|
793 fun zproof_const (a, A) : zproof_const = |
792 fun zproof_const (a, A) : zproof_const = |
794 let |
793 let |
795 val instT = |
794 val instT = |
796 ZTVars.build (A |> (fold_types o fold_tvars) (fn v => fn tab => |
795 ZTVars.build (A |> (fold_types o fold_tvars) (fn v => fn tab => |
797 if ZTVars.defined tab v then tab else ZTVars.update (v, ZTVar v) tab)); |
796 if ZTVars.defined tab v then tab else ZTVars.update (v, ZTVar v) tab)); |
800 (case t of |
799 (case t of |
801 ZVar v => if ZVars.defined tab v then tab else ZVars.update (v, t) tab |
800 ZVar v => if ZVars.defined tab v then tab else ZVars.update (v, t) tab |
802 | _ => tab))); |
801 | _ => tab))); |
803 in ((a, A), (instT, inst)) end; |
802 in ((a, A), (instT, inst)) end; |
804 |
803 |
805 fun make_const_proof (f, g) (a, insts) = |
804 fun make_const_proof (f, g) ((a, insts): zproof_const) = |
806 let |
805 let |
807 val typ = subst_type_same (Same.function (fn ((x, _), _) => try f x)); |
806 val typ = subst_type_same (Same.function (fn ((x, _), _) => try f x)); |
808 val term = Same.function (fn ZVar ((x, _), _) => try g x | _ => NONE); |
807 val term = Same.function (fn ZVar ((x, _), _) => try g x | _ => NONE); |
809 in ZConstp (a, Same.commit (map_insts_same typ term) insts) end; |
808 in ZConstp (a, Same.commit (map_insts_same typ term) insts) end; |
810 |
809 |