equal
deleted
inserted
replaced
61 struct |
61 struct |
62 |
62 |
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 prfx_atts expr inst |
67 ##> Proof.global_terminal_proof |
67 ##> Proof.global_terminal_proof |
68 (Method.Basic (fn ctxt => Method.SIMPLE_METHOD (tac ctxt), 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) = |
75 (Method.Basic (K (Method.SIMPLE_METHOD tac), Position.none), NONE) |
75 (Method.Basic (K (Method.SIMPLE_METHOD tac), Position.none), NONE) |
76 #> ProofContext.theory_of; |
76 #> ProofContext.theory_of; |
77 |
77 |
78 val class_prefix = Logic.const_of_class o Sign.base_name; |
78 val class_prefix = Logic.const_of_class o Sign.base_name; |
79 |
79 |
|
80 fun class_name_morphism class = |
|
81 Name.map_prefix (K (Name.add_prefix false (class_prefix class))); |
|
82 |
80 fun activate_class_morphism thy class inst morphism = |
83 fun activate_class_morphism thy class inst morphism = |
81 Locale.get_interpret_morph thy class (false, class_prefix class) "" morphism class inst; |
84 Locale.get_interpret_morph thy (class_name_morphism class) (class, "") morphism class inst; |
82 |
85 |
83 fun prove_class_interpretation class inst consts hyp_facts def_facts thy = |
86 fun prove_class_interpretation class inst consts hyp_facts def_facts thy = |
84 let |
87 let |
85 val constraints = map (fn (class, c) => map_atyps (K (TFree (Name.aT, |
88 val constraints = map (fn (class, c) => map_atyps (K (TFree (Name.aT, |
86 [class]))) (Sign.the_const_type thy c)) consts; |
89 [class]))) (Sign.the_const_type thy c)) consts; |
90 ORELSE' (fn n => SELECT_GOAL (Locale.intro_locales_tac false ctxt []) n)); |
93 ORELSE' (fn n => SELECT_GOAL (Locale.intro_locales_tac false ctxt []) n)); |
91 val prfx = class_prefix class; |
94 val prfx = class_prefix class; |
92 in |
95 in |
93 thy |
96 thy |
94 |> fold2 add_constraint (map snd consts) no_constraints |
97 |> fold2 add_constraint (map snd consts) no_constraints |
95 |> prove_interpretation tac (false, prfx) (Locale.Locale class) |
98 |> prove_interpretation tac (class_name_morphism class) (Locale.Locale class) |
96 (map SOME inst, map (pair (Attrib.no_binding) o Thm.prop_of) def_facts) |
99 (map SOME inst, map (pair (Attrib.no_binding) o Thm.prop_of) def_facts) |
97 ||> fold2 add_constraint (map snd consts) constraints |
100 ||> fold2 add_constraint (map snd consts) constraints |
98 end; |
101 end; |
99 |
102 |
100 |
103 |
619 val (((sups, supparams), (supsort, base_sort, mergeexpr)), (elems, global_syntax)) = |
622 val (((sups, supparams), (supsort, base_sort, mergeexpr)), (elems, global_syntax)) = |
620 prep_spec thy raw_supclasses raw_elems; |
623 prep_spec thy raw_supclasses raw_elems; |
621 val supconsts = map (apsnd fst o snd) (these_params thy sups); |
624 val supconsts = map (apsnd fst o snd) (these_params thy sups); |
622 in |
625 in |
623 thy |
626 thy |
624 |> Locale.add_locale_i "" bname mergeexpr elems |
627 |> Locale.add_locale "" bname mergeexpr elems |
625 |> snd |
628 |> snd |
626 |> ProofContext.theory_of |
629 |> ProofContext.theory_of |
627 |> adjungate_axclass bname class base_sort sups supsort supparams global_syntax |
630 |> adjungate_axclass bname class base_sort sups supsort supparams global_syntax |
628 |-> (fn (inst, param_map, params, assm_axiom) => |
631 |-> (fn (inst, param_map, params, assm_axiom) => |
629 `(fn thy => calculate_axiom thy sups base_sort assm_axiom param_map class) |
632 `(fn thy => calculate_axiom thy sups base_sort assm_axiom param_map class) |