156 nominal_inductive typing |
156 nominal_inductive typing |
157 by (simp_all add: abs_fresh fresh_ty) |
157 by (simp_all add: abs_fresh fresh_ty) |
158 |
158 |
159 subsection {* a fact about beta *} |
159 subsection {* a fact about beta *} |
160 |
160 |
161 constdefs |
161 definition "NORMAL" :: "lam \<Rightarrow> bool" where |
162 "NORMAL" :: "lam \<Rightarrow> bool" |
|
163 "NORMAL t \<equiv> \<not>(\<exists>t'. t\<longrightarrow>\<^isub>\<beta> t')" |
162 "NORMAL t \<equiv> \<not>(\<exists>t'. t\<longrightarrow>\<^isub>\<beta> t')" |
164 |
163 |
165 lemma NORMAL_Var: |
164 lemma NORMAL_Var: |
166 shows "NORMAL (Var a)" |
165 shows "NORMAL (Var a)" |
167 proof - |
166 proof - |
232 "RED (TVar X) = {t. SN(t)}" |
231 "RED (TVar X) = {t. SN(t)}" |
233 | "RED (\<tau>\<rightarrow>\<sigma>) = {t. \<forall>u. (u\<in>RED \<tau> \<longrightarrow> (App t u)\<in>RED \<sigma>)}" |
232 | "RED (\<tau>\<rightarrow>\<sigma>) = {t. \<forall>u. (u\<in>RED \<tau> \<longrightarrow> (App t u)\<in>RED \<sigma>)}" |
234 by (rule TrueI)+ |
233 by (rule TrueI)+ |
235 |
234 |
236 text {* neutral terms *} |
235 text {* neutral terms *} |
237 constdefs |
236 definition NEUT :: "lam \<Rightarrow> bool" where |
238 NEUT :: "lam \<Rightarrow> bool" |
|
239 "NEUT t \<equiv> (\<exists>a. t = Var a) \<or> (\<exists>t1 t2. t = App t1 t2)" |
237 "NEUT t \<equiv> (\<exists>a. t = Var a) \<or> (\<exists>t1 t2. t = App t1 t2)" |
240 |
238 |
241 (* a slight hack to get the first element of applications *) |
239 (* a slight hack to get the first element of applications *) |
242 (* this is needed to get (SN t) from SN (App t s) *) |
240 (* this is needed to get (SN t) from SN (App t s) *) |
243 inductive |
241 inductive |
272 then show "SN (fst_app (App t s))" by simp |
270 then show "SN (fst_app (App t s))" by simp |
273 qed |
271 qed |
274 |
272 |
275 section {* Candidates *} |
273 section {* Candidates *} |
276 |
274 |
277 constdefs |
275 definition "CR1" :: "ty \<Rightarrow> bool" where |
278 "CR1" :: "ty \<Rightarrow> bool" |
|
279 "CR1 \<tau> \<equiv> \<forall>t. (t\<in>RED \<tau> \<longrightarrow> SN t)" |
276 "CR1 \<tau> \<equiv> \<forall>t. (t\<in>RED \<tau> \<longrightarrow> SN t)" |
280 |
277 |
281 "CR2" :: "ty \<Rightarrow> bool" |
278 definition "CR2" :: "ty \<Rightarrow> bool" where |
282 "CR2 \<tau> \<equiv> \<forall>t t'. (t\<in>RED \<tau> \<and> t \<longrightarrow>\<^isub>\<beta> t') \<longrightarrow> t'\<in>RED \<tau>" |
279 "CR2 \<tau> \<equiv> \<forall>t t'. (t\<in>RED \<tau> \<and> t \<longrightarrow>\<^isub>\<beta> t') \<longrightarrow> t'\<in>RED \<tau>" |
283 |
280 |
284 "CR3_RED" :: "lam \<Rightarrow> ty \<Rightarrow> bool" |
281 definition "CR3_RED" :: "lam \<Rightarrow> ty \<Rightarrow> bool" where |
285 "CR3_RED t \<tau> \<equiv> \<forall>t'. t\<longrightarrow>\<^isub>\<beta> t' \<longrightarrow> t'\<in>RED \<tau>" |
282 "CR3_RED t \<tau> \<equiv> \<forall>t'. t\<longrightarrow>\<^isub>\<beta> t' \<longrightarrow> t'\<in>RED \<tau>" |
286 |
283 |
287 "CR3" :: "ty \<Rightarrow> bool" |
284 definition "CR3" :: "ty \<Rightarrow> bool" where |
288 "CR3 \<tau> \<equiv> \<forall>t. (NEUT t \<and> CR3_RED t \<tau>) \<longrightarrow> t\<in>RED \<tau>" |
285 "CR3 \<tau> \<equiv> \<forall>t. (NEUT t \<and> CR3_RED t \<tau>) \<longrightarrow> t\<in>RED \<tau>" |
289 |
286 |
290 "CR4" :: "ty \<Rightarrow> bool" |
287 definition "CR4" :: "ty \<Rightarrow> bool" where |
291 "CR4 \<tau> \<equiv> \<forall>t. (NEUT t \<and> NORMAL t) \<longrightarrow>t\<in>RED \<tau>" |
288 "CR4 \<tau> \<equiv> \<forall>t. (NEUT t \<and> NORMAL t) \<longrightarrow>t\<in>RED \<tau>" |
292 |
289 |
293 lemma CR3_implies_CR4: |
290 lemma CR3_implies_CR4: |
294 assumes a: "CR3 \<tau>" |
291 assumes a: "CR3 \<tau>" |
295 shows "CR4 \<tau>" |
292 shows "CR4 \<tau>" |