src/HOL/Tools/record.ML
changeset 41575 7b5de3ff2b72
parent 41489 8e2b8649507d
child 41576 83308748c5ae
equal deleted inserted replaced
41574:c209d9f4090a 41575:7b5de3ff2b72
    91   val empty = Symtab.make [tuple_iso_tuple];
    91   val empty = Symtab.make [tuple_iso_tuple];
    92   val extend = I;
    92   val extend = I;
    93   fun merge data = Symtab.merge Thm.eq_thm_prop data;   (* FIXME handle Symtab.DUP ?? *)
    93   fun merge data = Symtab.merge Thm.eq_thm_prop data;   (* FIXME handle Symtab.DUP ?? *)
    94 );
    94 );
    95 
    95 
    96 fun get_typedef_info tyco vs (({ rep_type, Abs_name, Rep_name, ...},
    96 fun get_typedef_info tyco vs
    97     { Abs_inject, Rep_inject, Abs_inverse, Rep_inverse, ... }) : Typedef.info) thy =
    97     (({rep_type, Abs_name, ...}, {Rep_inject, Abs_inverse, ... }) : Typedef.info) thy =
    98   let
    98   let
    99     val exists_thm =
    99     val exists_thm =
   100       UNIV_I
   100       UNIV_I
   101       |> Drule.instantiate' [SOME (ctyp_of thy (Logic.varifyT_global rep_type))] [];
   101       |> Drule.instantiate' [SOME (ctyp_of thy (Logic.varifyT_global rep_type))] [];
   102     val proj_constr = Abs_inverse OF [exists_thm];
   102     val proj_constr = Abs_inverse OF [exists_thm];
   194 
   194 
   195 structure Record: RECORD =
   195 structure Record: RECORD =
   196 struct
   196 struct
   197 
   197 
   198 val eq_reflection = @{thm eq_reflection};
   198 val eq_reflection = @{thm eq_reflection};
   199 val atomize_all = @{thm HOL.atomize_all};
       
   200 val atomize_imp = @{thm HOL.atomize_imp};
       
   201 val meta_allE = @{thm Pure.meta_allE};
   199 val meta_allE = @{thm Pure.meta_allE};
   202 val prop_subst = @{thm prop_subst};
   200 val prop_subst = @{thm prop_subst};
   203 val K_record_comp = @{thm K_record_comp};
   201 val K_record_comp = @{thm K_record_comp};
   204 val K_comp_convs = [@{thm o_apply}, K_record_comp];
   202 val K_comp_convs = [@{thm o_apply}, K_record_comp];
   205 val o_assoc = @{thm o_assoc};
   203 val o_assoc = @{thm o_assoc};
  1507 
  1505 
  1508 (** theory extender interface **)
  1506 (** theory extender interface **)
  1509 
  1507 
  1510 (* prepare arguments *)
  1508 (* prepare arguments *)
  1511 
  1509 
  1512 fun read_raw_parent ctxt raw_T =
       
  1513   (case ProofContext.read_typ_abbrev ctxt raw_T of
       
  1514     Type (name, Ts) => (Ts, name)
       
  1515   | T => error ("Bad parent record specification: " ^ Syntax.string_of_typ ctxt T));
       
  1516 
       
  1517 fun read_typ ctxt raw_T env =
  1510 fun read_typ ctxt raw_T env =
  1518   let
  1511   let
  1519     val ctxt' = fold (Variable.declare_typ o TFree) env ctxt;
  1512     val ctxt' = fold (Variable.declare_typ o TFree) env ctxt;
  1520     val T = Syntax.read_typ ctxt' raw_T;
  1513     val T = Syntax.read_typ ctxt' raw_T;
  1521     val env' = OldTerm.add_typ_tfrees (T, env);
  1514     val env' = OldTerm.add_typ_tfrees (T, env);