Skip to content

Commit 41fba58

Browse files
committed
Do not use atoms for data and constructor names
1 parent f229041 commit 41fba58

File tree

3 files changed

+28
-16
lines changed

3 files changed

+28
-16
lines changed

Syntax.thy

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,19 @@ begin
55
atom_decl "var"
66
atom_decl "tyvar"
77

8-
atom_decl "data_name"
9-
atom_decl "ctor_name"
8+
typedef data_name = "{ x. x \<in> (UNIV :: string set) }" by simp
9+
typedef ctor_name = "{ x. x \<in> (UNIV :: string set) }" by simp
10+
11+
instantiation data_name :: pure
12+
begin
13+
definition "p \<bullet> (x::data_name) = x"
14+
instance by (standard, auto simp: permute_data_name_def)
15+
end
16+
instantiation ctor_name :: pure
17+
begin
18+
definition "p \<bullet> (x::ctor_name) = x"
19+
instance by (standard, auto simp: permute_ctor_name_def)
20+
end
1021

1122
nominal_datatype "\<kappa>" =
1223
Star ("\<star>")
@@ -42,6 +53,8 @@ nominal_datatype "axiom" =
4253
type_synonym "\<Gamma>" = "binder list"
4354
type_synonym "\<Delta>" = "axiom list"
4455

56+
declare pure_fresh[simp]
57+
4558
lemma no_vars_in_kinds[simp]: "atom (x :: var) \<sharp> (k :: \<kappa>)"
4659
by (induction k rule: \<kappa>.induct) auto
4760
lemma no_vars_in_ty[simp]: "atom (x :: var) \<sharp> (ty :: \<tau>)"
@@ -64,12 +77,13 @@ lemma supp_empty_kinds[simp]: "supp (k :: \<kappa>) = {}"
6477
by (induction k rule: \<kappa>.induct) (auto simp: \<kappa>.supp)
6578

6679
lemma perm_data_name_var[simp]: "((a::var) \<leftrightarrow> b) \<bullet> (T :: data_name) = T"
67-
using flip_fresh_fresh by force
80+
using flip_fresh_fresh pure_fresh by blast
6881
lemma perm_data_name_tyvar[simp]: "((a::tyvar) \<leftrightarrow> b) \<bullet> (T :: data_name) = T"
69-
using flip_fresh_fresh by force
82+
using flip_fresh_fresh pure_fresh by blast
7083
lemma perm_ctor_name_var[simp]: "((a::var) \<leftrightarrow> b) \<bullet> (D :: ctor_name) = D"
71-
using flip_fresh_fresh by force
84+
using flip_fresh_fresh pure_fresh by blast
7285
lemma perm_ctor_name_tyvar[simp]: "((a::tyvar) \<leftrightarrow> b) \<bullet> (D :: ctor_name) = D"
73-
using flip_fresh_fresh by force
86+
using flip_fresh_fresh pure_fresh by blast
87+
7488

7589
end

Typing.thy

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ inductive Ax :: "\<Delta> \<Rightarrow> bool" ("\<turnstile> _")
1010

1111
Ax_Empty: "\<turnstile> []"
1212

13-
| Ax_Data: "\<lbrakk> \<turnstile> \<Delta> ; atom T \<sharp> \<Delta> \<rbrakk> \<Longrightarrow> \<turnstile> AxData T \<kappa> # \<Delta>"
13+
| Ax_Data: "\<lbrakk> \<turnstile> \<Delta> ; \<nexists>k. AxData T k \<in> set \<Delta> \<rbrakk> \<Longrightarrow> \<turnstile> AxData T \<kappa> # \<Delta>"
1414

15-
| Ax_Ctor: "\<lbrakk> [] , \<Delta> \<turnstile>\<^sub>t\<^sub>y \<tau> : \<star> ; ctor_type \<tau> = Some T ; atom D \<sharp> \<Delta> \<rbrakk> \<Longrightarrow> \<turnstile> AxCtor D \<tau> # \<Delta>"
15+
| Ax_Ctor: "\<lbrakk> [] , \<Delta> \<turnstile>\<^sub>t\<^sub>y \<tau> : \<star> ; ctor_type \<tau> = Some T ; \<nexists>t. AxCtor D t \<in> set \<Delta> \<rbrakk> \<Longrightarrow> \<turnstile> AxCtor D \<tau> # \<Delta>"
1616

1717
(* ------------------------------ *)
1818

Typing_Lemmas.thy

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -135,33 +135,31 @@ qed simp_all
135135
lemma axiom_isin_same_kind: "\<lbrakk> AxData T k1 \<in> set (\<Delta>' @ AxData T k2 # \<Delta>) ; \<turnstile> (\<Delta>' @ AxData T k2 # \<Delta>) \<rbrakk> \<Longrightarrow> k1 = k2"
136136
proof (induction \<Delta>')
137137
case Nil
138-
then have "atom T \<sharp> \<Delta>" by auto
139-
then have "\<nexists>k. AxData T k \<in> set \<Delta>" by (metis (mono_tags, lifting) axiom.fresh(1) fresh_Cons fresh_append fresh_at_base(2) in_set_conv_decomp_first)
138+
then have "\<nexists>k. AxData T k \<in> set \<Delta>" by auto
140139
then show ?case using Nil.prems(1) by auto
141140
next
142141
case (Cons a \<Delta>')
143142
then show ?case using axioms_valid(2)
144143
proof (cases a rule: axiom.exhaust)
145144
case (AxData T' k3)
146-
then have "atom T' \<sharp> (\<Delta>' @ AxData T k2 # \<Delta>)" using Cons(3) by auto
147-
then have "T' \<noteq> T" by (simp add: fresh_Cons fresh_append fresh_at_base(2))
145+
then have "\<nexists>k. AxData T' k \<in> set (\<Delta>' @ AxData T k2 # \<Delta>)" using Cons(3) by fastforce
146+
then have "T' \<noteq> T" by auto
148147
then show ?thesis using Cons AxData by auto
149148
qed fastforce
150149
qed
151150

152151
lemma axiom_isin_same_type: "\<lbrakk> AxCtor D \<tau>1 \<in> set (\<Delta>' @ AxCtor D \<tau>2 # \<Delta>) ; \<turnstile> (\<Delta>' @ AxCtor D \<tau>2 # \<Delta>) \<rbrakk> \<Longrightarrow> \<tau>1 = \<tau>2"
153152
proof (induction \<Delta>')
154153
case Nil
155-
then have "atom D \<sharp> \<Delta>" by auto
156-
then have "\<nexists>t. AxCtor D t \<in> set \<Delta>" by (metis (mono_tags, lifting) axiom.fresh(2) fresh_Cons fresh_append fresh_at_base(2) in_set_conv_decomp_first)
154+
then have "\<nexists>t. AxCtor D t \<in> set \<Delta>" by auto
157155
then show ?case using Nil(1) by auto
158156
next
159157
case (Cons a \<Delta>')
160158
then show ?case
161159
proof (cases a rule: axiom.exhaust)
162160
case (AxCtor D' \<tau>')
163-
then have "atom D' \<sharp> (\<Delta>' @ AxCtor D \<tau>2 # \<Delta>)" using Cons(3) by auto
164-
then have "D' \<noteq> D" by (simp add: fresh_Cons fresh_append fresh_at_base(2))
161+
then have "\<nexists>t. AxCtor D' t \<in> set (\<Delta>' @ AxCtor D \<tau>2 # \<Delta>)" using Cons(3) by fastforce
162+
then have "D' \<noteq> D" by auto
165163
then show ?thesis using AxCtor Cons axioms_valid_aux(2) set_ConsD by auto
166164
qed auto
167165
qed

0 commit comments

Comments
 (0)