src/HOL/Nominal/Nominal.thy
changeset 39198 f967a16dfcdd
parent 35417 47ee18b6ae32
child 39302 d7728f65b353
equal deleted inserted replaced
39166:19efc2af3e6c 39198:f967a16dfcdd
   146   by (simp add: perm_bool)
   146   by (simp add: perm_bool)
   147 
   147 
   148 (* permutation on sets *)
   148 (* permutation on sets *)
   149 lemma empty_eqvt:
   149 lemma empty_eqvt:
   150   shows "pi\<bullet>{} = {}"
   150   shows "pi\<bullet>{} = {}"
   151   by (simp add: perm_fun_def perm_bool empty_iff [unfolded mem_def] expand_fun_eq)
   151   by (simp add: perm_fun_def perm_bool empty_iff [unfolded mem_def] ext_iff)
   152 
   152 
   153 lemma union_eqvt:
   153 lemma union_eqvt:
   154   shows "(pi\<bullet>(X\<union>Y)) = (pi\<bullet>X) \<union> (pi\<bullet>Y)"
   154   shows "(pi\<bullet>(X\<union>Y)) = (pi\<bullet>X) \<union> (pi\<bullet>Y)"
   155   by (simp add: perm_fun_def perm_bool Un_iff [unfolded mem_def] expand_fun_eq)
   155   by (simp add: perm_fun_def perm_bool Un_iff [unfolded mem_def] ext_iff)
   156 
   156 
   157 (* permutations on products *)
   157 (* permutations on products *)
   158 lemma fst_eqvt:
   158 lemma fst_eqvt:
   159   "pi\<bullet>(fst x) = fst (pi\<bullet>x)"
   159   "pi\<bullet>(fst x) = fst (pi\<bullet>x)"
   160  by (cases x) simp
   160  by (cases x) simp
  2067 next
  2067 next
  2068   assume b: "?RHS"
  2068   assume b: "?RHS"
  2069   show "?LHS"
  2069   show "?LHS"
  2070   proof (rule ccontr)
  2070   proof (rule ccontr)
  2071     assume "(pi\<bullet>f) \<noteq> f"
  2071     assume "(pi\<bullet>f) \<noteq> f"
  2072     hence "\<exists>x. (pi\<bullet>f) x \<noteq> f x" by (simp add: expand_fun_eq)
  2072     hence "\<exists>x. (pi\<bullet>f) x \<noteq> f x" by (simp add: ext_iff)
  2073     then obtain x where b1: "(pi\<bullet>f) x \<noteq> f x" by force
  2073     then obtain x where b1: "(pi\<bullet>f) x \<noteq> f x" by force
  2074     from b have "pi\<bullet>(f ((rev pi)\<bullet>x)) = f (pi\<bullet>((rev pi)\<bullet>x))" by force
  2074     from b have "pi\<bullet>(f ((rev pi)\<bullet>x)) = f (pi\<bullet>((rev pi)\<bullet>x))" by force
  2075     hence "(pi\<bullet>f)(pi\<bullet>((rev pi)\<bullet>x)) = f (pi\<bullet>((rev pi)\<bullet>x))" 
  2075     hence "(pi\<bullet>f)(pi\<bullet>((rev pi)\<bullet>x)) = f (pi\<bullet>((rev pi)\<bullet>x))" 
  2076       by (simp add: pt_fun_app_eq[OF pt, OF at])
  2076       by (simp add: pt_fun_app_eq[OF pt, OF at])
  2077     hence "(pi\<bullet>f) x = f x" by (simp add: pt_pi_rev[OF pt, OF at])
  2077     hence "(pi\<bullet>f) x = f x" by (simp add: pt_pi_rev[OF pt, OF at])
  2761   and     c2: "cp TYPE ('b) TYPE('x) TYPE('y)"
  2761   and     c2: "cp TYPE ('b) TYPE('x) TYPE('y)"
  2762   and     pt: "pt TYPE ('y) TYPE('x)"
  2762   and     pt: "pt TYPE ('y) TYPE('x)"
  2763   and     at: "at TYPE ('x)"
  2763   and     at: "at TYPE ('x)"
  2764   shows "cp TYPE ('a\<Rightarrow>'b) TYPE('x) TYPE('y)"
  2764   shows "cp TYPE ('a\<Rightarrow>'b) TYPE('x) TYPE('y)"
  2765 using c1 c2
  2765 using c1 c2
  2766 apply(auto simp add: cp_def perm_fun_def expand_fun_eq)
  2766 apply(auto simp add: cp_def perm_fun_def ext_iff)
  2767 apply(simp add: rev_eqvt[symmetric])
  2767 apply(simp add: rev_eqvt[symmetric])
  2768 apply(simp add: pt_rev_pi[OF pt_list_inst[OF pt_prod_inst[OF pt, OF pt]], OF at])
  2768 apply(simp add: pt_rev_pi[OF pt_list_inst[OF pt_prod_inst[OF pt, OF pt]], OF at])
  2769 done
  2769 done
  2770 
  2770 
  2771 
  2771 
  2986   and     ptb: "pt TYPE('y) TYPE('x)"
  2986   and     ptb: "pt TYPE('y) TYPE('x)"
  2987   and     at:  "at TYPE('x)"
  2987   and     at:  "at TYPE('x)"
  2988   and     cp:  "cp TYPE('a) TYPE('x) TYPE('y)"
  2988   and     cp:  "cp TYPE('a) TYPE('x) TYPE('y)"
  2989   shows "pi\<bullet>([a].x) = [(pi\<bullet>a)].(pi\<bullet>x)"
  2989   shows "pi\<bullet>([a].x) = [(pi\<bullet>a)].(pi\<bullet>x)"
  2990   apply(simp add: abs_fun_def perm_fun_def abs_fun_if)
  2990   apply(simp add: abs_fun_def perm_fun_def abs_fun_if)
  2991   apply(simp only: expand_fun_eq)
  2991   apply(simp only: ext_iff)
  2992   apply(rule allI)
  2992   apply(rule allI)
  2993   apply(subgoal_tac "(((rev pi)\<bullet>(xa::'y)) = (a::'y)) = (xa = pi\<bullet>a)")(*A*)
  2993   apply(subgoal_tac "(((rev pi)\<bullet>(xa::'y)) = (a::'y)) = (xa = pi\<bullet>a)")(*A*)
  2994   apply(subgoal_tac "(((rev pi)\<bullet>xa)\<sharp>x) = (xa\<sharp>(pi\<bullet>x))")(*B*)
  2994   apply(subgoal_tac "(((rev pi)\<bullet>xa)\<sharp>x) = (xa\<sharp>(pi\<bullet>x))")(*B*)
  2995   apply(subgoal_tac "pi\<bullet>([(a,(rev pi)\<bullet>xa)]\<bullet>x) = [(pi\<bullet>a,xa)]\<bullet>(pi\<bullet>x)")(*C*)
  2995   apply(subgoal_tac "pi\<bullet>([(a,(rev pi)\<bullet>xa)]\<bullet>x) = [(pi\<bullet>a,xa)]\<bullet>(pi\<bullet>x)")(*C*)
  2996   apply(simp)
  2996   apply(simp)
  3027   fixes x  :: "'a"
  3027   fixes x  :: "'a"
  3028   and   y  :: "'a"
  3028   and   y  :: "'a"
  3029   and   a  :: "'x"
  3029   and   a  :: "'x"
  3030   shows "([a].x = [a].y) = (x = y)"
  3030   shows "([a].x = [a].y) = (x = y)"
  3031 apply(auto simp add: abs_fun_def)
  3031 apply(auto simp add: abs_fun_def)
  3032 apply(auto simp add: expand_fun_eq)
  3032 apply(auto simp add: ext_iff)
  3033 apply(drule_tac x="a" in spec)
  3033 apply(drule_tac x="a" in spec)
  3034 apply(simp)
  3034 apply(simp)
  3035 done
  3035 done
  3036 
  3036 
  3037 lemma abs_fun_eq2:
  3037 lemma abs_fun_eq2:
  3043       and at: "at TYPE('x)"
  3043       and at: "at TYPE('x)"
  3044       and a1: "a\<noteq>b" 
  3044       and a1: "a\<noteq>b" 
  3045       and a2: "[a].x = [b].y" 
  3045       and a2: "[a].x = [b].y" 
  3046   shows "x=[(a,b)]\<bullet>y \<and> a\<sharp>y"
  3046   shows "x=[(a,b)]\<bullet>y \<and> a\<sharp>y"
  3047 proof -
  3047 proof -
  3048   from a2 have "\<forall>c::'x. ([a].x) c = ([b].y) c" by (force simp add: expand_fun_eq)
  3048   from a2 have "\<forall>c::'x. ([a].x) c = ([b].y) c" by (force simp add: ext_iff)
  3049   hence "([a].x) a = ([b].y) a" by simp
  3049   hence "([a].x) a = ([b].y) a" by simp
  3050   hence a3: "nSome(x) = ([b].y) a" by (simp add: abs_fun_def)
  3050   hence a3: "nSome(x) = ([b].y) a" by (simp add: abs_fun_def)
  3051   show "x=[(a,b)]\<bullet>y \<and> a\<sharp>y"
  3051   show "x=[(a,b)]\<bullet>y \<and> a\<sharp>y"
  3052   proof (cases "a\<sharp>y")
  3052   proof (cases "a\<sharp>y")
  3053     assume a4: "a\<sharp>y"
  3053     assume a4: "a\<sharp>y"
  3074       and a2: "x=[(a,b)]\<bullet>y" 
  3074       and a2: "x=[(a,b)]\<bullet>y" 
  3075       and a3: "a\<sharp>y" 
  3075       and a3: "a\<sharp>y" 
  3076   shows "[a].x =[b].y"
  3076   shows "[a].x =[b].y"
  3077 proof -
  3077 proof -
  3078   show ?thesis 
  3078   show ?thesis 
  3079   proof (simp only: abs_fun_def expand_fun_eq, intro strip)
  3079   proof (simp only: abs_fun_def ext_iff, intro strip)
  3080     fix c::"'x"
  3080     fix c::"'x"
  3081     let ?LHS = "if c=a then nSome(x) else if c\<sharp>x then nSome([(a,c)]\<bullet>x) else nNone"
  3081     let ?LHS = "if c=a then nSome(x) else if c\<sharp>x then nSome([(a,c)]\<bullet>x) else nNone"
  3082     and ?RHS = "if c=b then nSome(y) else if c\<sharp>y then nSome([(b,c)]\<bullet>y) else nNone"
  3082     and ?RHS = "if c=b then nSome(y) else if c\<sharp>y then nSome([(b,c)]\<bullet>y) else nNone"
  3083     show "?LHS=?RHS"
  3083     show "?LHS=?RHS"
  3084     proof -
  3084     proof -