src/Pure/Isar/class.ML
changeset 27761 b95e9ba0ca1d
parent 27708 7471449b9695
child 28017 4919bd124a58
equal deleted inserted replaced
27760:3aa86edac080 27761:b95e9ba0ca1d
    63 (** auxiliary **)
    63 (** auxiliary **)
    64 
    64 
    65 fun prove_interpretation tac prfx_atts expr inst =
    65 fun prove_interpretation tac prfx_atts expr inst =
    66   Locale.interpretation_i I prfx_atts expr inst
    66   Locale.interpretation_i I prfx_atts expr inst
    67   #> Proof.global_terminal_proof
    67   #> Proof.global_terminal_proof
    68       (Method.Basic (K (Method.SIMPLE_METHOD tac), Position.none), NONE)
    68       (Method.Basic (fn ctxt => Method.SIMPLE_METHOD (tac ctxt), Position.none), NONE)
    69   #> ProofContext.theory_of;
    69   #> ProofContext.theory_of;
    70 
    70 
    71 fun prove_interpretation_in tac after_qed (name, expr) =
    71 fun prove_interpretation_in tac after_qed (name, expr) =
    72   Locale.interpretation_in_locale
    72   Locale.interpretation_in_locale
    73       (ProofContext.theory after_qed) (name, expr)
    73       (ProofContext.theory after_qed) (name, expr)
   365     val constraints = map (fn (class, c) => map_atyps (K (TFree (Name.aT,
   365     val constraints = map (fn (class, c) => map_atyps (K (TFree (Name.aT,
   366       [class]))) (Sign.the_const_type thy c)) consts;
   366       [class]))) (Sign.the_const_type thy c)) consts;
   367     val no_constraints = map (map_atyps (K (TFree (Name.aT, [])))) constraints;
   367     val no_constraints = map (map_atyps (K (TFree (Name.aT, [])))) constraints;
   368     fun add_constraint c T = Sign.add_const_constraint (c, SOME T);
   368     fun add_constraint c T = Sign.add_const_constraint (c, SOME T);
   369     val inst = (#inst o the_class_data thy) class;
   369     val inst = (#inst o the_class_data thy) class;
   370     val tac = ALLGOALS (ProofContext.fact_tac facts);
   370     fun tac ctxt = ALLGOALS (ProofContext.fact_tac facts
       
   371       ORELSE' (fn n => SELECT_GOAL (Locale.intro_locales_tac false ctxt []) n));
   371     val prfx = class_prefix class;
   372     val prfx = class_prefix class;
   372   in
   373   in
   373     thy
   374     thy
   374     |> fold2 add_constraint (map snd consts) no_constraints
   375     |> fold2 add_constraint (map snd consts) no_constraints
   375     |> prove_interpretation tac ((false, prfx), []) (Locale.Locale class)
   376     |> prove_interpretation tac ((false, prfx), []) (Locale.Locale class)