src/HOL/Nominal/Examples/SN.thy
changeset 26966 071f40487734
parent 26932 c398a3866082
child 27272 75b251e9cdb7
equal deleted inserted replaced
26965:003b5781b845 26966:071f40487734
    10 
    10 
    11 lemma subst_rename: 
    11 lemma subst_rename: 
    12   assumes a: "c\<sharp>t1"
    12   assumes a: "c\<sharp>t1"
    13   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
    13   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
    14 using a
    14 using a
    15 by (nominal_induct t1 avoiding: a c t2 rule: lam.induct)
    15 by (nominal_induct t1 avoiding: a c t2 rule: lam.strong_induct)
    16    (auto simp add: calc_atm fresh_atm abs_fresh)
    16    (auto simp add: calc_atm fresh_atm abs_fresh)
    17 
    17 
    18 lemma forget: 
    18 lemma forget: 
    19   assumes a: "a\<sharp>t1"
    19   assumes a: "a\<sharp>t1"
    20   shows "t1[a::=t2] = t1"
    20   shows "t1[a::=t2] = t1"
    21   using a
    21   using a
    22 by (nominal_induct t1 avoiding: a t2 rule: lam.induct)
    22 by (nominal_induct t1 avoiding: a t2 rule: lam.strong_induct)
    23    (auto simp add: abs_fresh fresh_atm)
    23    (auto simp add: abs_fresh fresh_atm)
    24 
    24 
    25 lemma fresh_fact: 
    25 lemma fresh_fact: 
    26   fixes a::"name"
    26   fixes a::"name"
    27   assumes a: "a\<sharp>t1" "a\<sharp>t2"
    27   assumes a: "a\<sharp>t1" "a\<sharp>t2"
    28   shows "a\<sharp>t1[b::=t2]"
    28   shows "a\<sharp>t1[b::=t2]"
    29 using a
    29 using a
    30 by (nominal_induct t1 avoiding: a b t2 rule: lam.induct)
    30 by (nominal_induct t1 avoiding: a b t2 rule: lam.strong_induct)
    31    (auto simp add: abs_fresh fresh_atm)
    31    (auto simp add: abs_fresh fresh_atm)
    32 
    32 
    33 lemma fresh_fact': 
    33 lemma fresh_fact': 
    34   fixes a::"name"
    34   fixes a::"name"
    35   assumes a: "a\<sharp>t2"
    35   assumes a: "a\<sharp>t2"
    36   shows "a\<sharp>t1[a::=t2]"
    36   shows "a\<sharp>t1[a::=t2]"
    37 using a 
    37 using a 
    38 by (nominal_induct t1 avoiding: a t2 rule: lam.induct)
    38 by (nominal_induct t1 avoiding: a t2 rule: lam.strong_induct)
    39    (auto simp add: abs_fresh fresh_atm)
    39    (auto simp add: abs_fresh fresh_atm)
    40 
    40 
    41 lemma subst_lemma:  
    41 lemma subst_lemma:  
    42   assumes a: "x\<noteq>y"
    42   assumes a: "x\<noteq>y"
    43   and     b: "x\<sharp>L"
    43   and     b: "x\<sharp>L"
    44   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
    44   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
    45 using a b
    45 using a b
    46 by (nominal_induct M avoiding: x y N L rule: lam.induct)
    46 by (nominal_induct M avoiding: x y N L rule: lam.strong_induct)
    47    (auto simp add: fresh_fact forget)
    47    (auto simp add: fresh_fact forget)
    48 
    48 
    49 lemma id_subs: 
    49 lemma id_subs: 
    50   shows "t[x::=Var x] = t"
    50   shows "t[x::=Var x] = t"
    51   by (nominal_induct t avoiding: x rule: lam.induct)
    51   by (nominal_induct t avoiding: x rule: lam.strong_induct)
    52      (simp_all add: fresh_atm)
    52      (simp_all add: fresh_atm)
    53 
    53 
    54 lemma lookup_fresh:
    54 lemma lookup_fresh:
    55   fixes z::"name"
    55   fixes z::"name"
    56   assumes "z\<sharp>\<theta>" "z\<sharp>x"
    56   assumes "z\<sharp>\<theta>" "z\<sharp>x"
    67 
    67 
    68 lemma psubst_subst:
    68 lemma psubst_subst:
    69   assumes h:"c\<sharp>\<theta>"
    69   assumes h:"c\<sharp>\<theta>"
    70   shows "(\<theta><t>)[c::=s] = ((c,s)#\<theta>)<t>"
    70   shows "(\<theta><t>)[c::=s] = ((c,s)#\<theta>)<t>"
    71   using h
    71   using h
    72 by (nominal_induct t avoiding: \<theta> c s rule: lam.induct)
    72 by (nominal_induct t avoiding: \<theta> c s rule: lam.strong_induct)
    73    (auto simp add: fresh_list_cons fresh_atm forget lookup_fresh lookup_fresh')
    73    (auto simp add: fresh_list_cons fresh_atm forget lookup_fresh lookup_fresh')
    74  
    74  
    75 inductive 
    75 inductive 
    76   Beta :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
    76   Beta :: "lam\<Rightarrow>lam\<Rightarrow>bool" (" _ \<longrightarrow>\<^isub>\<beta> _" [80,80] 80)
    77 where
    77 where
   120 
   120 
   121 lemma fresh_ty:
   121 lemma fresh_ty:
   122   fixes a ::"name"
   122   fixes a ::"name"
   123   and   \<tau>  ::"ty"
   123   and   \<tau>  ::"ty"
   124   shows "a\<sharp>\<tau>"
   124   shows "a\<sharp>\<tau>"
   125 by (nominal_induct \<tau> rule: ty.induct)
   125 by (nominal_induct \<tau> rule: ty.strong_induct)
   126    (auto simp add: fresh_nat)
   126    (auto simp add: fresh_nat)
   127 
   127 
   128 (* valid contexts *)
   128 (* valid contexts *)
   129 
   129 
   130 inductive 
   130 inductive 
   352 qed 
   352 qed 
   353 
   353 
   354 text {* properties of the candiadates *}
   354 text {* properties of the candiadates *}
   355 lemma RED_props: 
   355 lemma RED_props: 
   356   shows "CR1 \<tau>" and "CR2 \<tau>" and "CR3 \<tau>"
   356   shows "CR1 \<tau>" and "CR2 \<tau>" and "CR3 \<tau>"
   357 proof (nominal_induct \<tau> rule: ty.induct)
   357 proof (nominal_induct \<tau> rule: ty.strong_induct)
   358   case (TVar a)
   358   case (TVar a)
   359   { case 1 show "CR1 (TVar a)" by (simp add: CR1_def)
   359   { case 1 show "CR1 (TVar a)" by (simp add: CR1_def)
   360   next
   360   next
   361     case 2 show "CR2 (TVar a)" by (auto intro: SN_preserved simp add: CR2_def)
   361     case 2 show "CR2 (TVar a)" by (auto intro: SN_preserved simp add: CR2_def)
   362   next
   362   next
   551 by (induct \<Gamma>)
   551 by (induct \<Gamma>)
   552    (auto simp add: fresh_list_nil fresh_list_cons)
   552    (auto simp add: fresh_list_nil fresh_list_cons)
   553 
   553 
   554 lemma id_apply:  
   554 lemma id_apply:  
   555   shows "(id \<Gamma>)<t> = t"
   555   shows "(id \<Gamma>)<t> = t"
   556 by (nominal_induct t avoiding: \<Gamma> rule: lam.induct)
   556 by (nominal_induct t avoiding: \<Gamma> rule: lam.strong_induct)
   557    (auto simp add: id_maps id_fresh)
   557    (auto simp add: id_maps id_fresh)
   558 
   558 
   559 lemma id_closes:
   559 lemma id_closes:
   560   shows "(id \<Gamma>) closes \<Gamma>"
   560   shows "(id \<Gamma>) closes \<Gamma>"
   561 apply(auto)
   561 apply(auto)