@@ -77,8 +77,8 @@ fun chantyperep_instance name raw_chans thy =
77
77
open Syntax; open HOLogic; open Global_Theory;
78
78
val ty = Syntax.read_typ (Named_Target.theory_init thy) name;
79
79
val tyco = fst (dest_Type ty);
80
- val disc_intro_thms = if length raw_chans = 1 then [] else get_thms thy (tyco ^ " .disc" );
81
- val disc_elim_thms = if length raw_chans = 1 then [] else get_thms thy (tyco ^ " .exhaust_disc " );
80
+ val disc_thms = if length raw_chans = 1 then [] else get_thms thy (tyco ^ " .disc" ) @ get_thms thy (tyco ^ " .exhaust_disc " )
81
+ @ ( if length raw_chans = 2 then [] else get_thms thy (tyco ^ " .distinct_disc " ) );
82
82
val ctx0 = Class.instantiation ([tyco], [], \<^sort>\<open >chantyperep\<close>) thy;
83
83
val chans = map (fn (n, t) => (n, mk_typerep (read_typ ctx0 t))) raw_chans
84
84
val lhs = \<^Const>\<open >chantyperep ty\<close> $ Free (" T" , Term.itselfT ty);
@@ -87,10 +87,9 @@ fun chantyperep_instance name raw_chans thy =
87
87
val eq = check_term ctx1 (HOLogic.mk_Trueprop (HOLogic.mk_eq (lhs, rhs)));
88
88
val (_, ctx2) = Specification.definition NONE [] [] ((Binding.empty, @{attributes [chantyperep_defs]}), eq) ctx1;
89
89
val ctx3 = Local_Theory.end_nested ctx2;
90
- val ctx4 = fold (Context.proof_map o Named_Theorems.add_thm " Channel_Type.datatype_disc_intros" ) disc_intro_thms ctx3;
91
- val ctx5 = fold (Context.proof_map o Named_Theorems.add_thm " Channel_Type.datatype_disc_elims" ) disc_elim_thms ctx4;
90
+ val ctx4 = fold (Context.proof_map o Named_Theorems.add_thm " Channel_Type.datatype_disc_thms" ) disc_thms ctx3;
92
91
in
93
- Class.prove_instantiation_exit (fn _ => NO_CONTEXT_TACTIC ctx5 (Method_Closure.apply_method ctx5 @{method chantyperep_inst} [] [] [] ctx5 [])) ctx5
92
+ Class.prove_instantiation_exit (fn _ => NO_CONTEXT_TACTIC ctx4 (Method_Closure.apply_method ctx4 @{method chantyperep_inst} [] [] [] ctx4 [])) ctx4
94
93
end ;
95
94
96
95
fun compile_chantype (name, chans) thy =
@@ -100,7 +99,6 @@ fun compile_chantype (name, chans) thy =
100
99
val ctx = Named_Target.theory_init thy;
101
100
val ctrs = map (fn (n, t) => (((Binding.empty, Binding.name (n ^ ctor_suffix)), [(Binding.empty, t)]), Mixfix.NoSyn)) chans
102
101
val pnames = map fst chans
103
- val tyreps = map (mk_typerep o read_typ ctx o snd) chans
104
102
val thypfx =
105
103
case (Named_Target.locale_of ctx) of
106
104
SOME loc => loc ^ " ." |
0 commit comments