src/HOL/Tools/record.ML
changeset 45836 8bed07ec172b
parent 45741 088256c289e7
child 46043 c66fa5ea4305
equal deleted inserted replaced
45835:14bf7ca4ef3a 45836:8bed07ec172b
    47   val split_wrapper: string * (Proof.context -> wrapper)
    47   val split_wrapper: string * (Proof.context -> wrapper)
    48 
    48 
    49   val updateN: string
    49   val updateN: string
    50   val ext_typeN: string
    50   val ext_typeN: string
    51   val extN: string
    51   val extN: string
    52   val read_typ: Proof.context -> string -> (string * sort) list -> typ * (string * sort) list
       
    53   val cert_typ: Proof.context -> typ -> (string * sort) list -> typ * (string * sort) list
       
    54   val setup: theory -> theory
    52   val setup: theory -> theory
    55 end;
    53 end;
    56 
    54 
    57 
    55 
    58 signature ISO_TUPLE_SUPPORT =
    56 signature ISO_TUPLE_SUPPORT =
  1487 
  1485 
  1488 
  1486 
  1489 
  1487 
  1490 (** theory extender interface **)
  1488 (** theory extender interface **)
  1491 
  1489 
  1492 (* prepare arguments *)
       
  1493 
       
  1494 fun read_typ ctxt raw_T env =
       
  1495   let
       
  1496     val ctxt' = fold (Variable.declare_typ o TFree) env ctxt;
       
  1497     val T = Syntax.read_typ ctxt' raw_T;
       
  1498     val env' = Term.add_tfreesT T env;
       
  1499   in (T, env') end;
       
  1500 
       
  1501 fun cert_typ ctxt raw_T env =
       
  1502   let
       
  1503     val thy = Proof_Context.theory_of ctxt;
       
  1504     val T = Type.no_tvars (Sign.certify_typ thy raw_T)
       
  1505       handle TYPE (msg, _, _) => error msg;
       
  1506     val env' = Term.add_tfreesT T env;
       
  1507   in (T, env') end;
       
  1508 
       
  1509 
       
  1510 (* attributes *)
  1490 (* attributes *)
  1511 
  1491 
  1512 fun case_names_fields x = Rule_Cases.case_names ["fields"] x;
  1492 fun case_names_fields x = Rule_Cases.case_names ["fields"] x;
  1513 fun induct_type_global name = [case_names_fields, Induct.induct_type name];
  1493 fun induct_type_global name = [case_names_fields, Induct.induct_type name];
  1514 fun cases_type_global name = [case_names_fields, Induct.cases_type name];
  1494 fun cases_type_global name = [case_names_fields, Induct.cases_type name];