src/HOL/Nominal/Examples/CR.thy
changeset 22823 fa9ff469247f
parent 22730 8bcc8809ed3b
child 23393 31781b2de73d
equal deleted inserted replaced
22822:c1a6a2159e69 22823:fa9ff469247f
   245     hence "a\<sharp>s2" using i2 by simp
   245     hence "a\<sharp>s2" using i2 by simp
   246     thus "a\<sharp>s2[c::=t2]" using c3 by (simp add: fresh_fact)
   246     thus "a\<sharp>s2[c::=t2]" using c3 by (simp add: fresh_fact)
   247   qed
   247   qed
   248 qed
   248 qed
   249 
   249 
       
   250 lemma one_fresh_preserv_automatic:
       
   251   fixes a :: "name"
       
   252   assumes a: "t\<longrightarrow>\<^isub>1s"
       
   253   and     b: "a\<sharp>t"
       
   254   shows "a\<sharp>s"
       
   255 using a b
       
   256 apply(nominal_induct avoiding: a rule: One.strong_induct)
       
   257 apply(auto simp add: abs_fresh fresh_atm fresh_fact)
       
   258 done
       
   259 
   250 lemma subst_rename: 
   260 lemma subst_rename: 
   251   assumes a: "c\<sharp>t1"
   261   assumes a: "c\<sharp>t1"
   252   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
   262   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
   253 using a
   263 using a
   254 by (nominal_induct t1 avoiding: a c t2 rule: lam.induct)
   264 by (nominal_induct t1 avoiding: a c t2 rule: lam.induct)
   261   assumes a: "(Lam [a].t)\<longrightarrow>\<^isub>1t'"
   271   assumes a: "(Lam [a].t)\<longrightarrow>\<^isub>1t'"
   262   shows "\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
   272   shows "\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
   263   using a
   273   using a
   264   apply -
   274   apply -
   265   apply(ind_cases2 "(Lam [a].t)\<longrightarrow>\<^isub>1t'")
   275   apply(ind_cases2 "(Lam [a].t)\<longrightarrow>\<^isub>1t'")
   266   apply(auto simp add: lam.distinct lam.inject alpha)
   276   apply(auto simp add: lam.inject alpha)
   267   apply(rule_tac x="[(a,aa)]\<bullet>s2" in exI)
   277   apply(rule_tac x="[(a,aa)]\<bullet>s2" in exI)
   268   apply(rule conjI)
   278   apply(rule conjI)
   269   apply(rule pt_bij2[OF pt_name_inst, OF at_name_inst, symmetric])
   279   apply(perm_simp)
   270   apply(simp)
   280   apply(simp add: fresh_left calc_atm)
   271   apply(rule pt_name3)
   281   apply(simp add: One.eqvt)
   272   apply(rule at_ds5[OF at_name_inst])
   282   apply(simp add: one_fresh_preserv)
   273   apply(frule_tac a="a" in one_fresh_preserv)
   283 done  
   274   apply(assumption)
   284 
   275   apply(rule conjI)
       
   276   apply(simp add: pt_fresh_left[OF pt_name_inst, OF at_name_inst])
       
   277   apply(simp add: calc_atm)
       
   278   apply(force intro!: One.eqvt)
       
   279   done
       
   280 
   285 
   281 lemma one_app: 
   286 lemma one_app: 
   282   assumes a: "App t1 t2 \<longrightarrow>\<^isub>1 t'"
   287   assumes a: "App t1 t2 \<longrightarrow>\<^isub>1 t'"
   283   shows "(\<exists>s1 s2. t' = App s1 s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
   288   shows "(\<exists>s1 s2. t' = App s1 s2 \<and> t1 \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2) \<or> 
   284          (\<exists>a s s1 s2. t1 = Lam [a].s \<and> a\<sharp>(t2,s2) \<and> t' = s1[a::=s2] \<and> s \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)" 
   289          (\<exists>a s s1 s2. t1 = Lam [a].s \<and> a\<sharp>(t2,s2) \<and> t' = s1[a::=s2] \<and> s \<longrightarrow>\<^isub>1 s1 \<and> t2 \<longrightarrow>\<^isub>1 s2)"