src/HOL/Nominal/Examples/CR.thy
changeset 26966 071f40487734
parent 25996 9fce1718825f
child 41589 bbd861837ebc
equal deleted inserted replaced
26965:003b5781b845 26966:071f40487734
     8 
     8 
     9 lemma forget: 
     9 lemma forget: 
    10   assumes asm: "x\<sharp>L"
    10   assumes asm: "x\<sharp>L"
    11   shows "L[x::=P] = L"
    11   shows "L[x::=P] = L"
    12 using asm
    12 using asm
    13 proof (nominal_induct L avoiding: x P rule: lam.induct)
    13 proof (nominal_induct L avoiding: x P rule: lam.strong_induct)
    14   case (Var z)
    14   case (Var z)
    15   have "x\<sharp>Var z" by fact
    15   have "x\<sharp>Var z" by fact
    16   thus "(Var z)[x::=P] = (Var z)" by (simp add: fresh_atm)
    16   thus "(Var z)[x::=P] = (Var z)" by (simp add: fresh_atm)
    17 next 
    17 next 
    18   case (App M1 M2)
    18   case (App M1 M2)
    34 
    34 
    35 lemma forget_automatic: 
    35 lemma forget_automatic: 
    36   assumes asm: "x\<sharp>L"
    36   assumes asm: "x\<sharp>L"
    37   shows "L[x::=P] = L"
    37   shows "L[x::=P] = L"
    38   using asm 
    38   using asm 
    39 by (nominal_induct L avoiding: x P rule: lam.induct)
    39 by (nominal_induct L avoiding: x P rule: lam.strong_induct)
    40    (auto simp add: abs_fresh fresh_atm)
    40    (auto simp add: abs_fresh fresh_atm)
    41 
    41 
    42 lemma fresh_fact: 
    42 lemma fresh_fact: 
    43   fixes z::"name"
    43   fixes z::"name"
    44   assumes asms: "z\<sharp>N" "z\<sharp>L"
    44   assumes asms: "z\<sharp>N" "z\<sharp>L"
    45   shows "z\<sharp>(N[y::=L])"
    45   shows "z\<sharp>(N[y::=L])"
    46 using asms
    46 using asms
    47 proof (nominal_induct N avoiding: z y L rule: lam.induct)
    47 proof (nominal_induct N avoiding: z y L rule: lam.strong_induct)
    48   case (Var u)
    48   case (Var u)
    49   have "z\<sharp>(Var u)" "z\<sharp>L" by fact+
    49   have "z\<sharp>(Var u)" "z\<sharp>L" by fact+
    50   thus "z\<sharp>((Var u)[y::=L])" by simp
    50   thus "z\<sharp>((Var u)[y::=L])" by simp
    51 next
    51 next
    52   case (App N1 N2)
    52   case (App N1 N2)
    71 lemma fresh_fact_automatic: 
    71 lemma fresh_fact_automatic: 
    72   fixes z::"name"
    72   fixes z::"name"
    73   assumes asms: "z\<sharp>N" "z\<sharp>L"
    73   assumes asms: "z\<sharp>N" "z\<sharp>L"
    74   shows "z\<sharp>(N[y::=L])"
    74   shows "z\<sharp>(N[y::=L])"
    75   using asms 
    75   using asms 
    76 by (nominal_induct N avoiding: z y L rule: lam.induct)
    76 by (nominal_induct N avoiding: z y L rule: lam.strong_induct)
    77    (auto simp add: abs_fresh fresh_atm)
    77    (auto simp add: abs_fresh fresh_atm)
    78 
    78 
    79 lemma fresh_fact': 
    79 lemma fresh_fact': 
    80   fixes a::"name"
    80   fixes a::"name"
    81   assumes a: "a\<sharp>t2"
    81   assumes a: "a\<sharp>t2"
    82   shows "a\<sharp>t1[a::=t2]"
    82   shows "a\<sharp>t1[a::=t2]"
    83 using a 
    83 using a 
    84 by (nominal_induct t1 avoiding: a t2 rule: lam.induct)
    84 by (nominal_induct t1 avoiding: a t2 rule: lam.strong_induct)
    85    (auto simp add: abs_fresh fresh_atm)
    85    (auto simp add: abs_fresh fresh_atm)
    86 
    86 
    87 lemma substitution_lemma:  
    87 lemma substitution_lemma:  
    88   assumes a: "x\<noteq>y"
    88   assumes a: "x\<noteq>y"
    89   and     b: "x\<sharp>L"
    89   and     b: "x\<sharp>L"
    90   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
    90   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
    91 using a b
    91 using a b
    92 proof (nominal_induct M avoiding: x y N L rule: lam.induct)
    92 proof (nominal_induct M avoiding: x y N L rule: lam.strong_induct)
    93   case (Var z) (* case 1: Variables*)
    93   case (Var z) (* case 1: Variables*)
    94   have "x\<noteq>y" by fact
    94   have "x\<noteq>y" by fact
    95   have "x\<sharp>L" by fact
    95   have "x\<sharp>L" by fact
    96   show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS")
    96   show "Var z[x::=N][y::=L] = Var z[y::=L][x::=N[y::=L]]" (is "?LHS = ?RHS")
    97   proof -
    97   proof -
   140 
   140 
   141 lemma substitution_lemma_automatic:  
   141 lemma substitution_lemma_automatic:  
   142   assumes asm: "x\<noteq>y" "x\<sharp>L"
   142   assumes asm: "x\<noteq>y" "x\<sharp>L"
   143   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
   143   shows "M[x::=N][y::=L] = M[y::=L][x::=N[y::=L]]"
   144   using asm 
   144   using asm 
   145 by (nominal_induct M avoiding: x y N L rule: lam.induct)
   145 by (nominal_induct M avoiding: x y N L rule: lam.strong_induct)
   146    (auto simp add: fresh_fact forget)
   146    (auto simp add: fresh_fact forget)
   147 
   147 
   148 section {* Beta Reduction *}
   148 section {* Beta Reduction *}
   149 
   149 
   150 inductive
   150 inductive
   259 
   259 
   260 lemma subst_rename: 
   260 lemma subst_rename: 
   261   assumes a: "c\<sharp>t1"
   261   assumes a: "c\<sharp>t1"
   262   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
   262   shows "t1[a::=t2] = ([(c,a)]\<bullet>t1)[c::=t2]"
   263 using a
   263 using a
   264 by (nominal_induct t1 avoiding: a c t2 rule: lam.induct)
   264 by (nominal_induct t1 avoiding: a c t2 rule: lam.strong_induct)
   265    (auto simp add: calc_atm fresh_atm abs_fresh)
   265    (auto simp add: calc_atm fresh_atm abs_fresh)
   266 
   266 
   267 lemma one_abs: 
   267 lemma one_abs: 
   268   assumes a: "Lam [a].t\<longrightarrow>\<^isub>1t'"
   268   assumes a: "Lam [a].t\<longrightarrow>\<^isub>1t'"
   269   shows "\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
   269   shows "\<exists>t''. t'=Lam [a].t'' \<and> t\<longrightarrow>\<^isub>1t''"
   293 
   293 
   294 lemma one_subst_aux:
   294 lemma one_subst_aux:
   295   assumes a: "N\<longrightarrow>\<^isub>1N'"
   295   assumes a: "N\<longrightarrow>\<^isub>1N'"
   296   shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
   296   shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
   297 using a
   297 using a
   298 proof (nominal_induct M avoiding: x N N' rule: lam.induct)
   298 proof (nominal_induct M avoiding: x N N' rule: lam.strong_induct)
   299   case (Var y) 
   299   case (Var y) 
   300   thus "Var y[x::=N] \<longrightarrow>\<^isub>1 Var y[x::=N']" by (cases "x=y") auto
   300   thus "Var y[x::=N] \<longrightarrow>\<^isub>1 Var y[x::=N']" by (cases "x=y") auto
   301 next
   301 next
   302   case (App P Q) (* application case - third line *)
   302   case (App P Q) (* application case - third line *)
   303   thus "(App P Q)[x::=N] \<longrightarrow>\<^isub>1  (App P Q)[x::=N']" using o2 by simp
   303   thus "(App P Q)[x::=N] \<longrightarrow>\<^isub>1  (App P Q)[x::=N']" using o2 by simp
   308 
   308 
   309 lemma one_subst_aux_automatic:
   309 lemma one_subst_aux_automatic:
   310   assumes a: "N\<longrightarrow>\<^isub>1N'"
   310   assumes a: "N\<longrightarrow>\<^isub>1N'"
   311   shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
   311   shows "M[x::=N] \<longrightarrow>\<^isub>1 M[x::=N']"
   312 using a
   312 using a
   313 by (nominal_induct M avoiding: x N N' rule: lam.induct)
   313 by (nominal_induct M avoiding: x N N' rule: lam.strong_induct)
   314    (auto simp add: fresh_prod fresh_atm)
   314    (auto simp add: fresh_prod fresh_atm)
   315 
   315 
   316 lemma one_subst: 
   316 lemma one_subst: 
   317   assumes a: "M\<longrightarrow>\<^isub>1M'"
   317   assumes a: "M\<longrightarrow>\<^isub>1M'"
   318   and     b: "N\<longrightarrow>\<^isub>1N'"
   318   and     b: "N\<longrightarrow>\<^isub>1N'"