LamEx.thy
changeset 378 86fba2c4eeef
parent 376 e99c0334d8bf
child 379 57bde65f6eb2
equal deleted inserted replaced
377:edd71fd83a2d 378:86fba2c4eeef
   216 
   216 
   217 lemma a3: "\<lbrakk>(x\<Colon>lam) = [(a\<Colon>name, b\<Colon>name)] \<bullet> (xa\<Colon>lam); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> Lam a x = Lam b xa"
   217 lemma a3: "\<lbrakk>(x\<Colon>lam) = [(a\<Colon>name, b\<Colon>name)] \<bullet> (xa\<Colon>lam); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> Lam a x = Lam b xa"
   218 apply (tactic {* lift_tac_lam @{context} @{thm a3} 1 *})
   218 apply (tactic {* lift_tac_lam @{context} @{thm a3} 1 *})
   219 done
   219 done
   220 
   220 
   221 ML {* val alpha_cases = lift_thm_lam @{context} @{thm alpha.cases} *}
   221 lemma alpha_cases: "\<lbrakk>a1 = a2; \<And>a b. \<lbrakk>a1 = Var a; a2 = Var b; a = b\<rbrakk> \<Longrightarrow> P;
   222 lemma "\<lbrakk>(x\<Colon>lam) = (xa\<Colon>lam); \<And>(a\<Colon>name) b\<Colon>name. \<lbrakk>x = Var a; xa = Var b; a = b\<rbrakk> \<Longrightarrow> P\<Colon>bool;
   222      \<And>x xa xb xc. \<lbrakk>a1 = App x xb; a2 = App xa xc; x = xa; xb = xc\<rbrakk> \<Longrightarrow> P;
   223      \<And>(x\<Colon>lam) (xa\<Colon>lam) (xb\<Colon>lam) xc\<Colon>lam. \<lbrakk>x = App x xb; xa = App xa xc; x = xa; xb = xc\<rbrakk> \<Longrightarrow> P;
   223      \<And>x a b xa. \<lbrakk>a1 = Lam a x; a2 = Lam b xa; x = [(a, b)] \<bullet> xa; a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> P\<rbrakk>
   224      \<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam. \<lbrakk>x = Lam a x; xa = Lam b xa; x = [(a, b)] \<bullet> xa; a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> P\<rbrakk>
       
   225     \<Longrightarrow> P"
   224     \<Longrightarrow> P"
   226 apply (tactic {* procedure_tac @{thm alpha.cases} @{context} 1 *})
   225 apply (tactic {* lift_tac_lam @{context} @{thm alpha.cases} 1 *})
   227 sorry
   226 done
   228 ML {* val alpha_induct = lift_thm_lam @{context} @{thm alpha.induct} *}
   227 
   229 lemma "\<lbrakk>(qx\<Colon>lam) = (qxa\<Colon>lam); \<And>(a\<Colon>name) b\<Colon>name. a = b \<Longrightarrow> (qxb\<Colon>lam \<Rightarrow> lam \<Rightarrow> bool) (Var a) (Var b);
   228 ML {* val aps = findaps rty (prop_of (atomize_thm @{thm alpha.induct})) *}
       
   229 ML {* val app_prs_thms = map (applic_prs @{context} rty qty absrep) aps *}
       
   230 lemma alpha_induct: "\<lbrakk>(qx\<Colon>lam) = (qxa\<Colon>lam); \<And>(a\<Colon>name) b\<Colon>name. a = b \<Longrightarrow> (qxb\<Colon>lam \<Rightarrow> lam \<Rightarrow> bool) (Var a) (Var b);
   230      \<And>(x\<Colon>lam) (xa\<Colon>lam) (xb\<Colon>lam) xc\<Colon>lam. \<lbrakk>x = xa; qxb x xa; xb = xc; qxb xb xc\<rbrakk> \<Longrightarrow> qxb (App x xb) (App xa xc);
   231      \<And>(x\<Colon>lam) (xa\<Colon>lam) (xb\<Colon>lam) xc\<Colon>lam. \<lbrakk>x = xa; qxb x xa; xb = xc; qxb xb xc\<rbrakk> \<Longrightarrow> qxb (App x xb) (App xa xc);
   231      \<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam.
   232      \<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam.
   232         \<lbrakk>x = [(a, b)] \<bullet> xa; qxb x ([(a, b)] \<bullet> xa); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> qxb (Lam a x) (Lam b xa)\<rbrakk>
   233         \<lbrakk>x = [(a, b)] \<bullet> xa; qxb x ([(a, b)] \<bullet> xa); a \<notin> fv (Lam b x)\<rbrakk> \<Longrightarrow> qxb (Lam a x) (Lam b xa)\<rbrakk>
   233     \<Longrightarrow> qxb qx qxa"
   234     \<Longrightarrow> qxb qx qxa"
   234 (* apply (tactic {* lift_tac_lam @{context} @{thm alpha.induct} 1 *}) *)
   235 apply (tactic {* lift_tac_lam @{context} @{thm alpha.induct} 1 *})
   235 sorry
   236 apply (tactic {* REPEAT_ALL_NEW (EqSubst.eqsubst_tac @{context} [0] app_prs_thms) 1 *})
       
   237 apply (tactic {* simp_tac (HOL_ss addsimps [reps_same]) 1 *})
       
   238 done
   236 
   239 
   237 lemma var_inject: "(Var a = Var b) = (a = b)"
   240 lemma var_inject: "(Var a = Var b) = (a = b)"
   238 apply (tactic {* lift_tac_lam @{context} @{thm rvar_inject} 1 *})
   241 apply (tactic {* lift_tac_lam @{context} @{thm rvar_inject} 1 *})
   239 done
   242 done
   240 
   243