src/Pure/axclass.ML
changeset 19134 47d337aefc21
parent 19123 a278d1e65c1d
child 19243 5dcb899a8486
equal deleted inserted replaced
19133:7e84a1a3741c 19134:47d337aefc21
    16     theory -> {intro: thm, axioms: thm list} * theory
    16     theory -> {intro: thm, axioms: thm list} * theory
    17   val add_classrel_thms: thm list -> theory -> theory
    17   val add_classrel_thms: thm list -> theory -> theory
    18   val add_arity_thms: thm list -> theory -> theory
    18   val add_arity_thms: thm list -> theory -> theory
    19   val add_inst_subclass: xstring * xstring -> tactic -> theory -> theory
    19   val add_inst_subclass: xstring * xstring -> tactic -> theory -> theory
    20   val add_inst_subclass_i: class * class -> tactic -> theory -> theory
    20   val add_inst_subclass_i: class * class -> tactic -> theory -> theory
    21   val add_inst_arity: (theory -> theory) ->
    21   val add_inst_arity: xstring * string list * string -> tactic -> theory -> theory
    22     xstring * string list * string -> tactic -> theory -> theory
    22   val add_inst_arity_i: string * sort list * sort -> tactic -> theory -> theory
    23   val add_inst_arity_i: (theory -> theory) ->
       
    24     string * sort list * sort -> tactic -> theory -> theory
       
    25   val instance_subclass: xstring * xstring -> theory -> Proof.state
    23   val instance_subclass: xstring * xstring -> theory -> Proof.state
    26   val instance_subclass_i: class * class -> theory -> Proof.state
    24   val instance_subclass_i: class * class -> theory -> Proof.state
    27   val instance_arity: (theory -> theory) -> xstring * string list * string -> theory -> Proof.state
    25   val instance_arity: (theory -> theory) -> xstring * string list * string -> theory -> Proof.state
    28   val instance_arity_i: (theory -> theory) -> string * sort list * sort -> theory -> Proof.state
    26   val instance_arity_i: (theory -> theory) -> string * sort list * sort -> theory -> Proof.state
    29   val read_arity: theory -> xstring * string list * string -> arity
    27   val read_arity: theory -> xstring * string list * string -> arity
   276     val _ = message ("Proving class inclusion " ^ txt ^ " ...");
   274     val _ = message ("Proving class inclusion " ^ txt ^ " ...");
   277     val th = Goal.prove thy [] [] (mk_classrel (c1, c2)) (K tac) handle ERROR msg =>
   275     val th = Goal.prove thy [] [] (mk_classrel (c1, c2)) (K tac) handle ERROR msg =>
   278       cat_error msg ("The error(s) above occurred while trying to prove " ^ txt);
   276       cat_error msg ("The error(s) above occurred while trying to prove " ^ txt);
   279   in add_classrel_thms [th] thy end;
   277   in add_classrel_thms [th] thy end;
   280 
   278 
   281 fun ext_inst_arity prep_arity (after_qed : theory -> theory) raw_arity tac thy =
   279 fun ext_inst_arity prep_arity raw_arity tac thy =
   282   let
   280   let
   283     val arity = prep_arity thy raw_arity;
   281     val arity = prep_arity thy raw_arity;
   284     val txt = quote (Sign.string_of_arity thy arity);
   282     val txt = quote (Sign.string_of_arity thy arity);
   285     val _ = message ("Proving type arity " ^ txt ^ " ...");
   283     val _ = message ("Proving type arity " ^ txt ^ " ...");
   286     val props = (mk_arities arity);
   284     val props = (mk_arities arity);
   287     val ths = Goal.prove_multi thy [] [] props
   285     val ths = Goal.prove_multi thy [] [] props
   288       (fn _ => Tactic.precise_conjunction_tac (length props) 1 THEN tac) handle ERROR msg =>
   286       (fn _ => Tactic.precise_conjunction_tac (length props) 1 THEN tac) handle ERROR msg =>
   289         cat_error msg ("\nThe error(s) above occurred while trying to prove " ^ txt);
   287         cat_error msg ("\nThe error(s) above occurred while trying to prove " ^ txt);
   290   in
   288   in add_arity_thms ths thy end;
   291     thy
       
   292     |> add_arity_thms ths
       
   293     |> after_qed
       
   294   end;
       
   295 
   289 
   296 in
   290 in
   297 
   291 
   298 val add_inst_subclass = ext_inst_subclass read_classrel;
   292 val add_inst_subclass = ext_inst_subclass read_classrel;
   299 val add_inst_subclass_i = ext_inst_subclass cert_classrel;
   293 val add_inst_subclass_i = ext_inst_subclass cert_classrel;