Skip to content

Commit 47edbcd

Browse files
committed
Tidy up of channel type command
1 parent 4d56eb1 commit 47edbcd

File tree

1 file changed

+9
-16
lines changed

1 file changed

+9
-16
lines changed

Channel_Type.ML

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
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 =
29
struct
310

411
fun
512
add_typerep_tfrees (Type (n, ts)) = Type (n, map add_typerep_tfrees ts) |
613
add_typerep_tfrees (TFree (n, sorts)) = TFree (n, sorts @ @{sort typerep}) |
714
add_typerep_tfrees (TVar (n, sorts)) = TVar (n, sorts @ @{sort typerep})
815

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-
1716
val wb_prism_suffix = "_wb_prism"
18-
val codep_suffix = "_codeps"
1917

2018
val ctor_suffix = "_C"
2119

@@ -67,8 +65,7 @@ fun mk_chantyperep chans ctx =
6765
let val c =
6866
case read_const {proper = false, strict = false} ctx (is_prefix ^ n ^ ctor_suffix)
6967
of Free (c', _) => free c' | Const (c', _) => const c' | _ => raise Match;
70-
in
71-
(* check_term ctx *)
68+
in
7269
(const @{const_name Chanrep}
7370
$ mk_literal n $ t
7471
$ c)
@@ -105,8 +102,6 @@ fun chantyperep_instance raw_vars vars sorts name raw_chans thy =
105102
val exhaust_disc_thms = if length raw_chans = 1 then [] else get_thms thy (tyco ^ ".exhaust_disc")
106103
val ctx4 = fold (Context.proof_map o Named_Theorems.add_thm "Channel_Type.disc_thms") disc_thms ctx3;
107104
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; *)
110105
in
111106
Class.prove_instantiation_exit (fn _ => NO_CONTEXT_TACTIC ctx5 (Method_Closure.apply_method ctx5 @{method chantyperep_inst} [] [] [] ctx5 [])) ctx5
112107
end;
@@ -202,8 +197,6 @@ fun prism_chanrep_proofs (name, chans) thy =
202197
, @{attributes [simp, code_unfold]}), map (prism_has_chanrep_proof ctx) chans @ map (prism_chanrep_proof ctx) chans) ctx))
203198
end
204199

205-
206-
207200
fun compile_chantype ((raw_tvars, name), raw_chans) thy =
208201
let
209202
open Syntax;

0 commit comments

Comments
 (0)