|
1 |
| -structure Channel_Type = |
| 1 | +signature CHANNEL_TYPE = |
| 2 | +sig |
| 3 | + val ctor_suffix: string |
| 4 | + val compile_chantype: ((binding option * (string * string option)) list * string) * (string * string) list -> theory -> theory |
| 5 | + val make_chantype: string list -> sort list -> string -> (string * string) list -> theory -> theory |
| 6 | +end; |
| 7 | + |
| 8 | +structure Channel_Type : CHANNEL_TYPE = |
2 | 9 | struct
|
3 | 10 |
|
4 | 11 | fun
|
5 | 12 | add_typerep_tfrees (Type (n, ts)) = Type (n, map add_typerep_tfrees ts) |
|
6 | 13 | add_typerep_tfrees (TFree (n, sorts)) = TFree (n, sorts @ @{sort typerep}) |
|
7 | 14 | add_typerep_tfrees (TVar (n, sorts)) = TVar (n, sorts @ @{sort typerep})
|
8 | 15 |
|
9 |
| -fun prove_prism_goal thy = |
10 |
| - let |
11 |
| - open Simplifier; open Global_Theory; open Lens_Lib |
12 |
| - val ctx = Named_Target.theory_init thy |
13 |
| - in |
14 |
| - auto_tac (fold add_simp (get_thms thy lens_defsN) ctx) |
15 |
| -end |
16 |
| - |
17 | 16 | val wb_prism_suffix = "_wb_prism"
|
18 |
| -val codep_suffix = "_codeps" |
19 | 17 |
|
20 | 18 | val ctor_suffix = "_C"
|
21 | 19 |
|
@@ -67,8 +65,7 @@ fun mk_chantyperep chans ctx =
|
67 | 65 | let val c =
|
68 | 66 | case read_const {proper = false, strict = false} ctx (is_prefix ^ n ^ ctor_suffix)
|
69 | 67 | of Free (c', _) => free c' | Const (c', _) => const c' | _ => raise Match;
|
70 |
| - in |
71 |
| - (* check_term ctx *) |
| 68 | + in |
72 | 69 | (const @{const_name Chanrep}
|
73 | 70 | $ mk_literal n $ t
|
74 | 71 | $ c)
|
@@ -105,8 +102,6 @@ fun chantyperep_instance raw_vars vars sorts name raw_chans thy =
|
105 | 102 | val exhaust_disc_thms = if length raw_chans = 1 then [] else get_thms thy (tyco ^ ".exhaust_disc")
|
106 | 103 | val ctx4 = fold (Context.proof_map o Named_Theorems.add_thm "Channel_Type.disc_thms") disc_thms ctx3;
|
107 | 104 | val ctx5 = fold (Context.proof_map o Named_Theorems.add_thm "Channel_Type.exhaust_disc_thms") exhaust_disc_thms ctx4;
|
108 |
| - |
109 |
| - (* val ctx4 = fold (Context.proof_map o Named_Theorems.add_thm "Channel_Type.datatype_disc_thms") disc_thms ctx3; *) |
110 | 105 | in
|
111 | 106 | Class.prove_instantiation_exit (fn _ => NO_CONTEXT_TACTIC ctx5 (Method_Closure.apply_method ctx5 @{method chantyperep_inst} [] [] [] ctx5 [])) ctx5
|
112 | 107 | end;
|
@@ -202,8 +197,6 @@ fun prism_chanrep_proofs (name, chans) thy =
|
202 | 197 | , @{attributes [simp, code_unfold]}), map (prism_has_chanrep_proof ctx) chans @ map (prism_chanrep_proof ctx) chans) ctx))
|
203 | 198 | end
|
204 | 199 |
|
205 |
| - |
206 |
| - |
207 | 200 | fun compile_chantype ((raw_tvars, name), raw_chans) thy =
|
208 | 201 | let
|
209 | 202 | open Syntax;
|
|
0 commit comments