equal
deleted
inserted
replaced
71 fun add_const_def s th name_opt thy = |
71 fun add_const_def s th name_opt thy = |
72 let |
72 let |
73 val th = Thm.legacy_freezeT th |
73 val th = Thm.legacy_freezeT th |
74 val name = case name_opt of |
74 val name = case name_opt of |
75 NONE => (fst o dest_Const o fst o HOLogic.dest_eq o |
75 NONE => (fst o dest_Const o fst o HOLogic.dest_eq o |
76 HOLogic.dest_Trueprop o prop_of) th |
76 HOLogic.dest_Trueprop o Thm.prop_of) th |
77 | SOME n => n |
77 | SOME n => n |
78 val thy' = add_const_map s name thy |
78 val thy' = add_const_map s name thy |
79 in |
79 in |
80 Data.map (fn {const_map, ty_map, const_def, ty_def} => |
80 Data.map (fn {const_map, ty_map, const_def, ty_def} => |
81 {const_map = const_map, ty_map = ty_map, |
81 {const_map = const_map, ty_map = ty_map, |
83 end |
83 end |
84 |
84 |
85 fun add_typ_def tyname absname repname th thy = |
85 fun add_typ_def tyname absname repname th thy = |
86 let |
86 let |
87 val th = Thm.legacy_freezeT th |
87 val th = Thm.legacy_freezeT th |
88 val (l, _) = dest_comb (HOLogic.dest_Trueprop (prop_of th)) |
88 val (l, _) = dest_comb (HOLogic.dest_Trueprop (Thm.prop_of th)) |
89 val (l, abst) = dest_comb l |
89 val (l, abst) = dest_comb l |
90 val (_, rept) = dest_comb l |
90 val (_, rept) = dest_comb l |
91 val (absn, _) = dest_Const abst |
91 val (absn, _) = dest_Const abst |
92 val (repn, _) = dest_Const rept |
92 val (repn, _) = dest_Const rept |
93 val nty = domain_type (fastype_of rept) |
93 val nty = domain_type (fastype_of rept) |