Quot/Examples/LamEx.thy
changeset 758 3104d62e7a16
parent 705 f51c6069cd17
child 766 df053507edba
equal deleted inserted replaced
757:c129354f2ff6 758:3104d62e7a16
     1 theory LamEx
     1 theory LamEx
     2 imports Nominal "../QuotList"
     2 imports Nominal "../QuotMain" "../QuotList"
     3 begin
     3 begin
     4 
     4 
     5 atom_decl name
     5 atom_decl name
     6 
     6 
     7 thm abs_fresh(1)
     7 thm abs_fresh(1)
   163 apply (simp_all add: rlam.inject alpha_refl)
   163 apply (simp_all add: rlam.inject alpha_refl)
   164 done
   164 done
   165 
   165 
   166 
   166 
   167 lemma pi_var: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Var a = Var (pi \<bullet> a)"
   167 lemma pi_var: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Var a = Var (pi \<bullet> a)"
   168 apply (tactic {* lift_tac @{context} @{thm pi_var_com} 1 *})
   168 apply (lifting pi_var_com)
   169 done
   169 done
   170 
   170 
   171 lemma pi_app: "(pi\<Colon>('x \<times> 'x) list) \<bullet> App (x\<Colon>lam) (xa\<Colon>lam) = App (pi \<bullet> x) (pi \<bullet> xa)"
   171 lemma pi_app: "(pi\<Colon>('x \<times> 'x) list) \<bullet> App (x\<Colon>lam) (xa\<Colon>lam) = App (pi \<bullet> x) (pi \<bullet> xa)"
   172 apply (tactic {* lift_tac @{context} @{thm pi_app_com} 1 *})
   172 apply (lifting pi_app_com)
   173 done
   173 done
   174 
   174 
   175 lemma pi_lam: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Lam (a\<Colon>name) (x\<Colon>lam) = Lam (pi \<bullet> a) (pi \<bullet> x)"
   175 lemma pi_lam: "(pi\<Colon>('x \<times> 'x) list) \<bullet> Lam (a\<Colon>name) (x\<Colon>lam) = Lam (pi \<bullet> a) (pi \<bullet> x)"
   176 apply (tactic {* lift_tac @{context} @{thm pi_lam_com} 1 *})
   176 apply (lifting pi_lam_com)
   177 done
   177 done
   178 
   178 
   179 lemma fv_var: "fv (Var (a\<Colon>name)) = {a}"
   179 lemma fv_var: "fv (Var (a\<Colon>name)) = {a}"
   180 apply (tactic {* lift_tac @{context} @{thm rfv_var} 1 *})
   180 apply (lifting rfv_var)
   181 done
   181 done
   182 
   182 
   183 lemma fv_app: "fv (App (x\<Colon>lam) (xa\<Colon>lam)) = fv x \<union> fv xa"
   183 lemma fv_app: "fv (App (x\<Colon>lam) (xa\<Colon>lam)) = fv x \<union> fv xa"
   184 apply (tactic {* lift_tac @{context} @{thm rfv_app} 1 *})
   184 apply (lifting rfv_app)
   185 done
   185 done
   186 
   186 
   187 lemma fv_lam: "fv (Lam (a\<Colon>name) (x\<Colon>lam)) = fv x - {a}"
   187 lemma fv_lam: "fv (Lam (a\<Colon>name) (x\<Colon>lam)) = fv x - {a}"
   188 apply (tactic {* lift_tac @{context} @{thm rfv_lam} 1 *})
   188 apply (lifting rfv_lam)
   189 done
   189 done
   190 
   190 
   191 lemma a1: "(a\<Colon>name) = (b\<Colon>name) \<Longrightarrow> Var a = Var b"
   191 lemma a1: "(a\<Colon>name) = (b\<Colon>name) \<Longrightarrow> Var a = Var b"
   192 apply (tactic {* lift_tac @{context} @{thm a1} 1 *})
   192 apply (lifting a1)
   193 done
   193 done
   194 
   194 
   195 lemma a2: "\<lbrakk>(x\<Colon>lam) = (xa\<Colon>lam); (xb\<Colon>lam) = (xc\<Colon>lam)\<rbrakk> \<Longrightarrow> App x xb = App xa xc"
   195 lemma a2: "\<lbrakk>(x\<Colon>lam) = (xa\<Colon>lam); (xb\<Colon>lam) = (xc\<Colon>lam)\<rbrakk> \<Longrightarrow> App x xb = App xa xc"
   196 apply (tactic {* lift_tac @{context} @{thm a2} 1 *})
   196 apply (lifting a2)
   197 done
   197 done
   198 
   198 
   199 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"
   199 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"
   200 apply (tactic {* lift_tac @{context} @{thm a3} 1 *})
   200 apply (lifting a3)
   201 done
   201 done
   202 
   202 
   203 lemma alpha_cases: "\<lbrakk>a1 = a2; \<And>a b. \<lbrakk>a1 = Var a; a2 = Var b; a = b\<rbrakk> \<Longrightarrow> P;
   203 lemma alpha_cases: "\<lbrakk>a1 = a2; \<And>a b. \<lbrakk>a1 = Var a; a2 = Var b; a = b\<rbrakk> \<Longrightarrow> P;
   204      \<And>x xa xb xc. \<lbrakk>a1 = App x xb; a2 = App xa xc; x = xa; xb = xc\<rbrakk> \<Longrightarrow> P;
   204      \<And>x xa xb xc. \<lbrakk>a1 = App x xb; a2 = App xa xc; x = xa; xb = xc\<rbrakk> \<Longrightarrow> P;
   205      \<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>
   205      \<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>
   206     \<Longrightarrow> P"
   206     \<Longrightarrow> P"
   207 apply (tactic {* lift_tac @{context} @{thm alpha.cases} 1 *})
   207 apply (lifting alpha.cases)
   208 done
   208 done
   209 
   209 
   210 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);
   210 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);
   211      \<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);
   211      \<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);
   212      \<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam.
   212      \<And>(x\<Colon>lam) (a\<Colon>name) (b\<Colon>name) xa\<Colon>lam.
   213         \<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>
   213         \<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>
   214     \<Longrightarrow> qxb qx qxa"
   214     \<Longrightarrow> qxb qx qxa"
   215 apply (tactic {* lift_tac @{context} @{thm alpha.induct} 1 *})
   215 apply (lifting alpha.induct)
   216 done
   216 done
   217 
   217 
   218 lemma var_inject: "(Var a = Var b) = (a = b)"
   218 lemma var_inject: "(Var a = Var b) = (a = b)"
   219 apply (tactic {* lift_tac @{context} @{thm rvar_inject} 1 *})
   219 apply (lifting rvar_inject)
   220 done
   220 done
   221 
   221 
   222 lemma lam_induct:" \<lbrakk>\<And>name. P (Var name); \<And>lam1 lam2. \<lbrakk>P lam1; P lam2\<rbrakk> \<Longrightarrow> P (App lam1 lam2);
   222 lemma lam_induct:" \<lbrakk>\<And>name. P (Var name); \<And>lam1 lam2. \<lbrakk>P lam1; P lam2\<rbrakk> \<Longrightarrow> P (App lam1 lam2);
   223               \<And>name lam. P lam \<Longrightarrow> P (Lam name lam)\<rbrakk> \<Longrightarrow> P lam"
   223               \<And>name lam. P lam \<Longrightarrow> P (Lam name lam)\<rbrakk> \<Longrightarrow> P lam"
   224 apply (tactic {* lift_tac @{context} @{thm rlam.induct} 1 *})
   224 apply (lifting rlam.induct)
   225 done
   225 done
   226 
   226 
   227 lemma var_supp:
   227 lemma var_supp:
   228   shows "supp (Var a) = ((supp a)::name set)"
   228   shows "supp (Var a) = ((supp a)::name set)"
   229   apply(simp add: supp_def)
   229   apply(simp add: supp_def)