src/HOL/Nominal/Examples/Class3.thy
changeset 50252 4aa34bd43228
parent 39246 9e58f0499f57
child 53015 a1119cf551e8
equal deleted inserted replaced
50251:227477f17c26 50252:4aa34bd43228
  3089 
  3089 
  3090 fun 
  3090 fun 
  3091  findn :: "(name\<times>coname\<times>trm) list\<Rightarrow>name\<Rightarrow>(coname\<times>trm) option"
  3091  findn :: "(name\<times>coname\<times>trm) list\<Rightarrow>name\<Rightarrow>(coname\<times>trm) option"
  3092 where
  3092 where
  3093   "findn [] x = None"
  3093   "findn [] x = None"
  3094 | "findn ((y,c,P)#\<theta>n) x = (if y=x then Some (c,P) else findn \<theta>n x)"
  3094 | "findn ((y,c,P)#\<theta>_n) x = (if y=x then Some (c,P) else findn \<theta>_n x)"
  3095 
  3095 
  3096 lemma findn_eqvt[eqvt]:
  3096 lemma findn_eqvt[eqvt]:
  3097   fixes pi1::"name prm"
  3097   fixes pi1::"name prm"
  3098   and   pi2::"coname prm"
  3098   and   pi2::"coname prm"
  3099   shows "(pi1\<bullet>findn \<theta>n x) = findn (pi1\<bullet>\<theta>n) (pi1\<bullet>x)" 
  3099   shows "(pi1\<bullet>findn \<theta>_n x) = findn (pi1\<bullet>\<theta>_n) (pi1\<bullet>x)" 
  3100   and   "(pi2\<bullet>findn \<theta>n x) = findn (pi2\<bullet>\<theta>n) (pi2\<bullet>x)"
  3100   and   "(pi2\<bullet>findn \<theta>_n x) = findn (pi2\<bullet>\<theta>_n) (pi2\<bullet>x)"
  3101 apply(induct \<theta>n)
  3101 apply(induct \<theta>_n)
  3102 apply(auto simp add: perm_bij) 
  3102 apply(auto simp add: perm_bij) 
  3103 done
  3103 done
  3104 
  3104 
  3105 lemma findn_fresh:
  3105 lemma findn_fresh:
  3106   assumes a: "x\<sharp>\<theta>n"
  3106   assumes a: "x\<sharp>\<theta>_n"
  3107   shows "findn \<theta>n x = None"
  3107   shows "findn \<theta>_n x = None"
  3108 using a
  3108 using a
  3109 apply(induct \<theta>n)
  3109 apply(induct \<theta>_n)
  3110 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3110 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3111 done
  3111 done
  3112 
  3112 
  3113 fun 
  3113 fun 
  3114  findc :: "(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>(name\<times>trm) option"
  3114  findc :: "(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>(name\<times>trm) option"
  3115 where
  3115 where
  3116   "findc [] x = None"
  3116   "findc [] x = None"
  3117 | "findc ((c,y,P)#\<theta>c) a = (if a=c then Some (y,P) else findc \<theta>c a)"
  3117 | "findc ((c,y,P)#\<theta>_c) a = (if a=c then Some (y,P) else findc \<theta>_c a)"
  3118 
  3118 
  3119 lemma findc_eqvt[eqvt]:
  3119 lemma findc_eqvt[eqvt]:
  3120   fixes pi1::"name prm"
  3120   fixes pi1::"name prm"
  3121   and   pi2::"coname prm"
  3121   and   pi2::"coname prm"
  3122   shows "(pi1\<bullet>findc \<theta>c a) = findc (pi1\<bullet>\<theta>c) (pi1\<bullet>a)" 
  3122   shows "(pi1\<bullet>findc \<theta>_c a) = findc (pi1\<bullet>\<theta>_c) (pi1\<bullet>a)" 
  3123   and   "(pi2\<bullet>findc \<theta>c a) = findc (pi2\<bullet>\<theta>c) (pi2\<bullet>a)"
  3123   and   "(pi2\<bullet>findc \<theta>_c a) = findc (pi2\<bullet>\<theta>_c) (pi2\<bullet>a)"
  3124 apply(induct \<theta>c)
  3124 apply(induct \<theta>_c)
  3125 apply(auto simp add: perm_bij) 
  3125 apply(auto simp add: perm_bij) 
  3126 done
  3126 done
  3127 
  3127 
  3128 lemma findc_fresh:
  3128 lemma findc_fresh:
  3129   assumes a: "a\<sharp>\<theta>c"
  3129   assumes a: "a\<sharp>\<theta>_c"
  3130   shows "findc \<theta>c a = None"
  3130   shows "findc \<theta>_c a = None"
  3131 using a
  3131 using a
  3132 apply(induct \<theta>c)
  3132 apply(induct \<theta>_c)
  3133 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3133 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3134 done
  3134 done
  3135 
  3135 
  3136 abbreviation 
  3136 abbreviation 
  3137  nmaps :: "(name\<times>coname\<times>trm) list \<Rightarrow> name \<Rightarrow> (coname\<times>trm) option \<Rightarrow> bool" ("_ nmaps _ to _" [55,55,55] 55) 
  3137  nmaps :: "(name\<times>coname\<times>trm) list \<Rightarrow> name \<Rightarrow> (coname\<times>trm) option \<Rightarrow> bool" ("_ nmaps _ to _" [55,55,55] 55) 
  3138 where
  3138 where
  3139  "\<theta>n nmaps x to P \<equiv> (findn \<theta>n x) = P"
  3139  "\<theta>_n nmaps x to P \<equiv> (findn \<theta>_n x) = P"
  3140 
  3140 
  3141 abbreviation 
  3141 abbreviation 
  3142  cmaps :: "(coname\<times>name\<times>trm) list \<Rightarrow> coname \<Rightarrow> (name\<times>trm) option \<Rightarrow> bool" ("_ cmaps _ to _" [55,55,55] 55) 
  3142  cmaps :: "(coname\<times>name\<times>trm) list \<Rightarrow> coname \<Rightarrow> (name\<times>trm) option \<Rightarrow> bool" ("_ cmaps _ to _" [55,55,55] 55) 
  3143 where
  3143 where
  3144  "\<theta>c cmaps a to P \<equiv> (findc \<theta>c a) = P"
  3144  "\<theta>_c cmaps a to P \<equiv> (findc \<theta>_c a) = P"
  3145 
  3145 
  3146 lemma nmaps_fresh:
  3146 lemma nmaps_fresh:
  3147   shows "\<theta>n nmaps x to Some (c,P) \<Longrightarrow> a\<sharp>\<theta>n \<Longrightarrow> a\<sharp>(c,P)"
  3147   shows "\<theta>_n nmaps x to Some (c,P) \<Longrightarrow> a\<sharp>\<theta>_n \<Longrightarrow> a\<sharp>(c,P)"
  3148 apply(induct \<theta>n)
  3148 apply(induct \<theta>_n)
  3149 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3149 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3150 apply(case_tac "aa=x")
  3150 apply(case_tac "aa=x")
  3151 apply(auto)
  3151 apply(auto)
  3152 apply(case_tac "aa=x")
  3152 apply(case_tac "aa=x")
  3153 apply(auto)
  3153 apply(auto)
  3154 done
  3154 done
  3155 
  3155 
  3156 lemma cmaps_fresh:
  3156 lemma cmaps_fresh:
  3157   shows "\<theta>c cmaps a to Some (y,P) \<Longrightarrow> x\<sharp>\<theta>c \<Longrightarrow> x\<sharp>(y,P)"
  3157   shows "\<theta>_c cmaps a to Some (y,P) \<Longrightarrow> x\<sharp>\<theta>_c \<Longrightarrow> x\<sharp>(y,P)"
  3158 apply(induct \<theta>c)
  3158 apply(induct \<theta>_c)
  3159 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3159 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3160 apply(case_tac "a=aa")
  3160 apply(case_tac "a=aa")
  3161 apply(auto)
  3161 apply(auto)
  3162 apply(case_tac "a=aa")
  3162 apply(case_tac "a=aa")
  3163 apply(auto)
  3163 apply(auto)
  3164 done
  3164 done
  3165 
  3165 
  3166 lemma nmaps_false:
  3166 lemma nmaps_false:
  3167   shows "\<theta>n nmaps x to Some (c,P) \<Longrightarrow> x\<sharp>\<theta>n \<Longrightarrow> False"
  3167   shows "\<theta>_n nmaps x to Some (c,P) \<Longrightarrow> x\<sharp>\<theta>_n \<Longrightarrow> False"
  3168 apply(induct \<theta>n)
  3168 apply(induct \<theta>_n)
  3169 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3169 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3170 done
  3170 done
  3171 
  3171 
  3172 lemma cmaps_false:
  3172 lemma cmaps_false:
  3173   shows "\<theta>c cmaps c to Some (x,P) \<Longrightarrow> c\<sharp>\<theta>c \<Longrightarrow> False"
  3173   shows "\<theta>_c cmaps c to Some (x,P) \<Longrightarrow> c\<sharp>\<theta>_c \<Longrightarrow> False"
  3174 apply(induct \<theta>c)
  3174 apply(induct \<theta>_c)
  3175 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3175 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3176 done
  3176 done
  3177 
  3177 
  3178 fun 
  3178 fun 
  3179  lookupa :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3179  lookupa :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3180 where
  3180 where
  3181   "lookupa x a [] = Ax x a"
  3181   "lookupa x a [] = Ax x a"
  3182 | "lookupa x a ((c,y,P)#\<theta>c) = (if a=c then Cut <a>.Ax x a (y).P else lookupa x a \<theta>c)"
  3182 | "lookupa x a ((c,y,P)#\<theta>_c) = (if a=c then Cut <a>.Ax x a (y).P else lookupa x a \<theta>_c)"
  3183 
  3183 
  3184 lemma lookupa_eqvt[eqvt]:
  3184 lemma lookupa_eqvt[eqvt]:
  3185   fixes pi1::"name prm"
  3185   fixes pi1::"name prm"
  3186   and   pi2::"coname prm"
  3186   and   pi2::"coname prm"
  3187   shows "(pi1\<bullet>(lookupa x a \<theta>c)) = lookupa (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>c)"
  3187   shows "(pi1\<bullet>(lookupa x a \<theta>_c)) = lookupa (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_c)"
  3188   and   "(pi2\<bullet>(lookupa x a \<theta>c)) = lookupa (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>c)"
  3188   and   "(pi2\<bullet>(lookupa x a \<theta>_c)) = lookupa (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_c)"
  3189 apply -
  3189 apply -
  3190 apply(induct \<theta>c)
  3190 apply(induct \<theta>_c)
  3191 apply(auto simp add: eqvts)
  3191 apply(auto simp add: eqvts)
  3192 apply(induct \<theta>c)
  3192 apply(induct \<theta>_c)
  3193 apply(auto simp add: eqvts)
  3193 apply(auto simp add: eqvts)
  3194 done
  3194 done
  3195 
  3195 
  3196 lemma lookupa_fire:
  3196 lemma lookupa_fire:
  3197   assumes a: "\<theta>c cmaps a to Some (y,P)"
  3197   assumes a: "\<theta>_c cmaps a to Some (y,P)"
  3198   shows "(lookupa x a \<theta>c) = Cut <a>.Ax x a (y).P"
  3198   shows "(lookupa x a \<theta>_c) = Cut <a>.Ax x a (y).P"
  3199 using a
  3199 using a
  3200 apply(induct \<theta>c arbitrary: x a y P)
  3200 apply(induct \<theta>_c arbitrary: x a y P)
  3201 apply(auto)
  3201 apply(auto)
  3202 done
  3202 done
  3203 
  3203 
  3204 fun 
  3204 fun 
  3205  lookupb :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>trm\<Rightarrow>trm"
  3205  lookupb :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>coname\<Rightarrow>trm\<Rightarrow>trm"
  3206 where
  3206 where
  3207   "lookupb x a [] c P = Cut <c>.P (x).Ax x a"
  3207   "lookupb x a [] c P = Cut <c>.P (x).Ax x a"
  3208 | "lookupb x a ((d,y,N)#\<theta>c) c P = (if a=d then Cut <c>.P (y).N  else lookupb x a \<theta>c c P)"
  3208 | "lookupb x a ((d,y,N)#\<theta>_c) c P = (if a=d then Cut <c>.P (y).N  else lookupb x a \<theta>_c c P)"
  3209 
  3209 
  3210 lemma lookupb_eqvt[eqvt]:
  3210 lemma lookupb_eqvt[eqvt]:
  3211   fixes pi1::"name prm"
  3211   fixes pi1::"name prm"
  3212   and   pi2::"coname prm"
  3212   and   pi2::"coname prm"
  3213   shows "(pi1\<bullet>(lookupb x a \<theta>c c P)) = lookupb (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>c) (pi1\<bullet>c) (pi1\<bullet>P)"
  3213   shows "(pi1\<bullet>(lookupb x a \<theta>_c c P)) = lookupb (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_c) (pi1\<bullet>c) (pi1\<bullet>P)"
  3214   and   "(pi2\<bullet>(lookupb x a \<theta>c c P)) = lookupb (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>c) (pi2\<bullet>c) (pi2\<bullet>P)"
  3214   and   "(pi2\<bullet>(lookupb x a \<theta>_c c P)) = lookupb (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_c) (pi2\<bullet>c) (pi2\<bullet>P)"
  3215 apply -
  3215 apply -
  3216 apply(induct \<theta>c)
  3216 apply(induct \<theta>_c)
  3217 apply(auto simp add: eqvts)
  3217 apply(auto simp add: eqvts)
  3218 apply(induct \<theta>c)
  3218 apply(induct \<theta>_c)
  3219 apply(auto simp add: eqvts)
  3219 apply(auto simp add: eqvts)
  3220 done
  3220 done
  3221 
  3221 
  3222 fun 
  3222 fun 
  3223   lookup :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3223   lookup :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3224 where
  3224 where
  3225   "lookup x a [] \<theta>c = lookupa x a \<theta>c"
  3225   "lookup x a [] \<theta>_c = lookupa x a \<theta>_c"
  3226 | "lookup x a ((y,c,P)#\<theta>n) \<theta>c = (if x=y then (lookupb x a \<theta>c c P) else lookup x a \<theta>n \<theta>c)"
  3226 | "lookup x a ((y,c,P)#\<theta>_n) \<theta>_c = (if x=y then (lookupb x a \<theta>_c c P) else lookup x a \<theta>_n \<theta>_c)"
  3227 
  3227 
  3228 lemma lookup_eqvt[eqvt]:
  3228 lemma lookup_eqvt[eqvt]:
  3229   fixes pi1::"name prm"
  3229   fixes pi1::"name prm"
  3230   and   pi2::"coname prm"
  3230   and   pi2::"coname prm"
  3231   shows "(pi1\<bullet>(lookup x a \<theta>n \<theta>c)) = lookup (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>n) (pi1\<bullet>\<theta>c)"
  3231   shows "(pi1\<bullet>(lookup x a \<theta>_n \<theta>_c)) = lookup (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n) (pi1\<bullet>\<theta>_c)"
  3232   and   "(pi2\<bullet>(lookup x a \<theta>n \<theta>c)) = lookup (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>n) (pi2\<bullet>\<theta>c)"
  3232   and   "(pi2\<bullet>(lookup x a \<theta>_n \<theta>_c)) = lookup (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n) (pi2\<bullet>\<theta>_c)"
  3233 apply -
  3233 apply -
  3234 apply(induct \<theta>n)
  3234 apply(induct \<theta>_n)
  3235 apply(auto simp add: eqvts)
  3235 apply(auto simp add: eqvts)
  3236 apply(induct \<theta>n)
  3236 apply(induct \<theta>_n)
  3237 apply(auto simp add: eqvts)
  3237 apply(auto simp add: eqvts)
  3238 done
  3238 done
  3239 
  3239 
  3240 fun 
  3240 fun 
  3241   lookupc :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm"
  3241   lookupc :: "name\<Rightarrow>coname\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm"
  3242 where
  3242 where
  3243   "lookupc x a [] = Ax x a"
  3243   "lookupc x a [] = Ax x a"
  3244 | "lookupc x a ((y,c,P)#\<theta>n) = (if x=y then P[c\<turnstile>c>a] else lookupc x a \<theta>n)"
  3244 | "lookupc x a ((y,c,P)#\<theta>_n) = (if x=y then P[c\<turnstile>c>a] else lookupc x a \<theta>_n)"
  3245 
  3245 
  3246 lemma lookupc_eqvt[eqvt]:
  3246 lemma lookupc_eqvt[eqvt]:
  3247   fixes pi1::"name prm"
  3247   fixes pi1::"name prm"
  3248   and   pi2::"coname prm"
  3248   and   pi2::"coname prm"
  3249   shows "(pi1\<bullet>(lookupc x a \<theta>n)) = lookupc (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>n)"
  3249   shows "(pi1\<bullet>(lookupc x a \<theta>_n)) = lookupc (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n)"
  3250   and   "(pi2\<bullet>(lookupc x a \<theta>n)) = lookupc (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>n)"
  3250   and   "(pi2\<bullet>(lookupc x a \<theta>_n)) = lookupc (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n)"
  3251 apply -
  3251 apply -
  3252 apply(induct \<theta>n)
  3252 apply(induct \<theta>_n)
  3253 apply(auto simp add: eqvts)
  3253 apply(auto simp add: eqvts)
  3254 apply(induct \<theta>n)
  3254 apply(induct \<theta>_n)
  3255 apply(auto simp add: eqvts)
  3255 apply(auto simp add: eqvts)
  3256 done
  3256 done
  3257 
  3257 
  3258 fun 
  3258 fun 
  3259   lookupd :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3259   lookupd :: "name\<Rightarrow>coname\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm"
  3260 where
  3260 where
  3261   "lookupd x a [] = Ax x a"
  3261   "lookupd x a [] = Ax x a"
  3262 | "lookupd x a ((c,y,P)#\<theta>c) = (if a=c then P[y\<turnstile>n>x] else lookupd x a \<theta>c)"
  3262 | "lookupd x a ((c,y,P)#\<theta>_c) = (if a=c then P[y\<turnstile>n>x] else lookupd x a \<theta>_c)"
  3263 
  3263 
  3264 lemma lookupd_eqvt[eqvt]:
  3264 lemma lookupd_eqvt[eqvt]:
  3265   fixes pi1::"name prm"
  3265   fixes pi1::"name prm"
  3266   and   pi2::"coname prm"
  3266   and   pi2::"coname prm"
  3267   shows "(pi1\<bullet>(lookupd x a \<theta>n)) = lookupd (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>n)"
  3267   shows "(pi1\<bullet>(lookupd x a \<theta>_n)) = lookupd (pi1\<bullet>x) (pi1\<bullet>a) (pi1\<bullet>\<theta>_n)"
  3268   and   "(pi2\<bullet>(lookupd x a \<theta>n)) = lookupd (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>n)"
  3268   and   "(pi2\<bullet>(lookupd x a \<theta>_n)) = lookupd (pi2\<bullet>x) (pi2\<bullet>a) (pi2\<bullet>\<theta>_n)"
  3269 apply -
  3269 apply -
  3270 apply(induct \<theta>n)
  3270 apply(induct \<theta>_n)
  3271 apply(auto simp add: eqvts)
  3271 apply(auto simp add: eqvts)
  3272 apply(induct \<theta>n)
  3272 apply(induct \<theta>_n)
  3273 apply(auto simp add: eqvts)
  3273 apply(auto simp add: eqvts)
  3274 done
  3274 done
  3275 
  3275 
  3276 lemma lookupa_fresh:
  3276 lemma lookupa_fresh:
  3277   assumes a: "a\<sharp>\<theta>c"
  3277   assumes a: "a\<sharp>\<theta>_c"
  3278   shows "lookupa y a \<theta>c = Ax y a"
  3278   shows "lookupa y a \<theta>_c = Ax y a"
  3279 using a
  3279 using a
  3280 apply(induct \<theta>c)
  3280 apply(induct \<theta>_c)
  3281 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3281 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3282 done
  3282 done
  3283 
  3283 
  3284 lemma lookupa_csubst:
  3284 lemma lookupa_csubst:
  3285   assumes a: "a\<sharp>\<theta>c"
  3285   assumes a: "a\<sharp>\<theta>_c"
  3286   shows "Cut <a>.Ax y a (x).P = (lookupa y a \<theta>c){a:=(x).P}"
  3286   shows "Cut <a>.Ax y a (x).P = (lookupa y a \<theta>_c){a:=(x).P}"
  3287 using a by (simp add: lookupa_fresh)
  3287 using a by (simp add: lookupa_fresh)
  3288 
  3288 
  3289 lemma lookupa_freshness:
  3289 lemma lookupa_freshness:
  3290   fixes a::"coname"
  3290   fixes a::"coname"
  3291   and   x::"name"
  3291   and   x::"name"
  3292   shows "a\<sharp>(\<theta>c,c) \<Longrightarrow> a\<sharp>lookupa y c \<theta>c"
  3292   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupa y c \<theta>_c"
  3293   and   "x\<sharp>(\<theta>c,y) \<Longrightarrow> x\<sharp>lookupa y c \<theta>c"
  3293   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupa y c \<theta>_c"
  3294 apply(induct \<theta>c)
  3294 apply(induct \<theta>_c)
  3295 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3295 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3296 done
  3296 done
  3297 
  3297 
  3298 lemma lookupa_unicity:
  3298 lemma lookupa_unicity:
  3299   assumes a: "lookupa x a \<theta>c= Ax y b" "b\<sharp>\<theta>c" "y\<sharp>\<theta>c"
  3299   assumes a: "lookupa x a \<theta>_c= Ax y b" "b\<sharp>\<theta>_c" "y\<sharp>\<theta>_c"
  3300   shows "x=y \<and> a=b"
  3300   shows "x=y \<and> a=b"
  3301 using a
  3301 using a
  3302 apply(induct \<theta>c)
  3302 apply(induct \<theta>_c)
  3303 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3303 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3304 apply(case_tac "a=aa")
  3304 apply(case_tac "a=aa")
  3305 apply(auto)
  3305 apply(auto)
  3306 apply(case_tac "a=aa")
  3306 apply(case_tac "a=aa")
  3307 apply(auto)
  3307 apply(auto)
  3308 done
  3308 done
  3309 
  3309 
  3310 lemma lookupb_csubst:
  3310 lemma lookupb_csubst:
  3311   assumes a: "a\<sharp>(\<theta>c,c,N)"
  3311   assumes a: "a\<sharp>(\<theta>_c,c,N)"
  3312   shows "Cut <c>.N (x).P = (lookupb y a \<theta>c c N){a:=(x).P}"
  3312   shows "Cut <c>.N (x).P = (lookupb y a \<theta>_c c N){a:=(x).P}"
  3313 using a
  3313 using a
  3314 apply(induct \<theta>c)
  3314 apply(induct \<theta>_c)
  3315 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3315 apply(auto simp add: fresh_list_cons fresh_atm fresh_prod)
  3316 apply(rule sym)
  3316 apply(rule sym)
  3317 apply(generate_fresh "name")
  3317 apply(generate_fresh "name")
  3318 apply(generate_fresh "coname")
  3318 apply(generate_fresh "coname")
  3319 apply(subgoal_tac "Cut <c>.N (y).Ax y a = Cut <caa>.([(caa,c)]\<bullet>N) (ca).Ax ca a")
  3319 apply(subgoal_tac "Cut <c>.N (y).Ax y a = Cut <caa>.([(caa,c)]\<bullet>N) (ca).Ax ca a")
  3335 done
  3335 done
  3336 
  3336 
  3337 lemma lookupb_freshness:
  3337 lemma lookupb_freshness:
  3338   fixes a::"coname"
  3338   fixes a::"coname"
  3339   and   x::"name"
  3339   and   x::"name"
  3340   shows "a\<sharp>(\<theta>c,c,b,P) \<Longrightarrow> a\<sharp>lookupb y c \<theta>c b P"
  3340   shows "a\<sharp>(\<theta>_c,c,b,P) \<Longrightarrow> a\<sharp>lookupb y c \<theta>_c b P"
  3341   and   "x\<sharp>(\<theta>c,y,P) \<Longrightarrow> x\<sharp>lookupb y c \<theta>c b P"
  3341   and   "x\<sharp>(\<theta>_c,y,P) \<Longrightarrow> x\<sharp>lookupb y c \<theta>_c b P"
  3342 apply(induct \<theta>c)
  3342 apply(induct \<theta>_c)
  3343 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3343 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3344 done
  3344 done
  3345 
  3345 
  3346 lemma lookupb_unicity:
  3346 lemma lookupb_unicity:
  3347   assumes a: "lookupb x a \<theta>c c P = Ax y b" "b\<sharp>(\<theta>c,c,P)" "y\<sharp>\<theta>c"
  3347   assumes a: "lookupb x a \<theta>_c c P = Ax y b" "b\<sharp>(\<theta>_c,c,P)" "y\<sharp>\<theta>_c"
  3348   shows "x=y \<and> a=b"
  3348   shows "x=y \<and> a=b"
  3349 using a
  3349 using a
  3350 apply(induct \<theta>c)
  3350 apply(induct \<theta>_c)
  3351 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3351 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  3352 apply(case_tac "a=aa")
  3352 apply(case_tac "a=aa")
  3353 apply(auto)
  3353 apply(auto)
  3354 apply(case_tac "a=aa")
  3354 apply(case_tac "a=aa")
  3355 apply(auto)
  3355 apply(auto)
  3356 done
  3356 done
  3357 
  3357 
  3358 lemma lookupb_lookupa:
  3358 lemma lookupb_lookupa:
  3359   assumes a: "x\<sharp>\<theta>c"
  3359   assumes a: "x\<sharp>\<theta>_c"
  3360   shows "lookupb x c \<theta>c a P = (lookupa x c \<theta>c){x:=<a>.P}"
  3360   shows "lookupb x c \<theta>_c a P = (lookupa x c \<theta>_c){x:=<a>.P}"
  3361 using a
  3361 using a
  3362 apply(induct \<theta>c)
  3362 apply(induct \<theta>_c)
  3363 apply(auto simp add: fresh_list_cons fresh_prod)
  3363 apply(auto simp add: fresh_list_cons fresh_prod)
  3364 apply(generate_fresh "coname")
  3364 apply(generate_fresh "coname")
  3365 apply(generate_fresh "name")
  3365 apply(generate_fresh "name")
  3366 apply(subgoal_tac "Cut <c>.Ax x c (aa).b = Cut <ca>.Ax x ca (caa).([(caa,aa)]\<bullet>b)")
  3366 apply(subgoal_tac "Cut <c>.Ax x c (aa).b = Cut <ca>.Ax x ca (caa).([(caa,aa)]\<bullet>b)")
  3367 apply(simp)
  3367 apply(simp)
  3381 apply(rule sym)
  3381 apply(rule sym)
  3382 apply(simp add: alpha calc_atm fresh_atm fresh_prod)
  3382 apply(simp add: alpha calc_atm fresh_atm fresh_prod)
  3383 done
  3383 done
  3384 
  3384 
  3385 lemma lookup_csubst:
  3385 lemma lookup_csubst:
  3386   assumes a: "a\<sharp>(\<theta>n,\<theta>c)"
  3386   assumes a: "a\<sharp>(\<theta>_n,\<theta>_c)"
  3387   shows "lookup y c \<theta>n ((a,x,P)#\<theta>c) = (lookup y c \<theta>n \<theta>c){a:=(x).P}"
  3387   shows "lookup y c \<theta>_n ((a,x,P)#\<theta>_c) = (lookup y c \<theta>_n \<theta>_c){a:=(x).P}"
  3388 using a
  3388 using a
  3389 apply(induct \<theta>n)
  3389 apply(induct \<theta>_n)
  3390 apply(auto simp add: fresh_prod fresh_list_cons)
  3390 apply(auto simp add: fresh_prod fresh_list_cons)
  3391 apply(simp add: lookupa_csubst)
  3391 apply(simp add: lookupa_csubst)
  3392 apply(simp add: lookupa_freshness forget fresh_atm fresh_prod)
  3392 apply(simp add: lookupa_freshness forget fresh_atm fresh_prod)
  3393 apply(rule lookupb_csubst)
  3393 apply(rule lookupb_csubst)
  3394 apply(simp)
  3394 apply(simp)
  3395 apply(auto simp add: lookupb_freshness forget fresh_atm fresh_prod)
  3395 apply(auto simp add: lookupb_freshness forget fresh_atm fresh_prod)
  3396 done
  3396 done
  3397 
  3397 
  3398 lemma lookup_fresh:
  3398 lemma lookup_fresh:
  3399   assumes a: "x\<sharp>(\<theta>n,\<theta>c)"
  3399   assumes a: "x\<sharp>(\<theta>_n,\<theta>_c)"
  3400   shows "lookup x c \<theta>n \<theta>c = lookupa x c \<theta>c"
  3400   shows "lookup x c \<theta>_n \<theta>_c = lookupa x c \<theta>_c"
  3401 using a
  3401 using a
  3402 apply(induct \<theta>n)
  3402 apply(induct \<theta>_n)
  3403 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3403 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3404 done
  3404 done
  3405 
  3405 
  3406 lemma lookup_unicity:
  3406 lemma lookup_unicity:
  3407   assumes a: "lookup x a \<theta>n \<theta>c= Ax y b" "b\<sharp>(\<theta>c,\<theta>n)" "y\<sharp>(\<theta>c,\<theta>n)"
  3407   assumes a: "lookup x a \<theta>_n \<theta>_c= Ax y b" "b\<sharp>(\<theta>_c,\<theta>_n)" "y\<sharp>(\<theta>_c,\<theta>_n)"
  3408   shows "x=y \<and> a=b"
  3408   shows "x=y \<and> a=b"
  3409 using a
  3409 using a
  3410 apply(induct \<theta>n)
  3410 apply(induct \<theta>_n)
  3411 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3411 apply(auto simp add: trm.inject fresh_list_cons fresh_prod fresh_atm)
  3412 apply(drule lookupa_unicity)
  3412 apply(drule lookupa_unicity)
  3413 apply(simp)+
  3413 apply(simp)+
  3414 apply(drule lookupa_unicity)
  3414 apply(drule lookupa_unicity)
  3415 apply(simp)+
  3415 apply(simp)+
  3428 done
  3428 done
  3429 
  3429 
  3430 lemma lookup_freshness:
  3430 lemma lookup_freshness:
  3431   fixes a::"coname"
  3431   fixes a::"coname"
  3432   and   x::"name"
  3432   and   x::"name"
  3433   shows "a\<sharp>(c,\<theta>c,\<theta>n) \<Longrightarrow> a\<sharp>lookup y c \<theta>n \<theta>c"
  3433   shows "a\<sharp>(c,\<theta>_c,\<theta>_n) \<Longrightarrow> a\<sharp>lookup y c \<theta>_n \<theta>_c"
  3434   and   "x\<sharp>(y,\<theta>c,\<theta>n) \<Longrightarrow> x\<sharp>lookup y c \<theta>n \<theta>c"   
  3434   and   "x\<sharp>(y,\<theta>_c,\<theta>_n) \<Longrightarrow> x\<sharp>lookup y c \<theta>_n \<theta>_c"   
  3435 apply(induct \<theta>n)
  3435 apply(induct \<theta>_n)
  3436 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3436 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3437 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3437 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3438 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3438 apply(simp add: fresh_atm fresh_prod lookupa_freshness)
  3439 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3439 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3440 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3440 apply(simp add: fresh_atm fresh_prod lookupb_freshness)
  3441 done
  3441 done
  3442 
  3442 
  3443 lemma lookupc_freshness:
  3443 lemma lookupc_freshness:
  3444   fixes a::"coname"
  3444   fixes a::"coname"
  3445   and   x::"name"
  3445   and   x::"name"
  3446   shows "a\<sharp>(\<theta>c,c) \<Longrightarrow> a\<sharp>lookupc y c \<theta>c"
  3446   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupc y c \<theta>_c"
  3447   and   "x\<sharp>(\<theta>c,y) \<Longrightarrow> x\<sharp>lookupc y c \<theta>c"
  3447   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupc y c \<theta>_c"
  3448 apply(induct \<theta>c)
  3448 apply(induct \<theta>_c)
  3449 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3449 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3450 apply(rule rename_fresh)
  3450 apply(rule rename_fresh)
  3451 apply(simp add: fresh_atm)
  3451 apply(simp add: fresh_atm)
  3452 apply(rule rename_fresh)
  3452 apply(rule rename_fresh)
  3453 apply(simp add: fresh_atm)
  3453 apply(simp add: fresh_atm)
  3454 done
  3454 done
  3455 
  3455 
  3456 lemma lookupc_fresh:
  3456 lemma lookupc_fresh:
  3457   assumes a: "y\<sharp>\<theta>n"
  3457   assumes a: "y\<sharp>\<theta>_n"
  3458   shows "lookupc y a \<theta>n = Ax y a"
  3458   shows "lookupc y a \<theta>_n = Ax y a"
  3459 using a
  3459 using a
  3460 apply(induct \<theta>n)
  3460 apply(induct \<theta>_n)
  3461 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3461 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3462 done
  3462 done
  3463 
  3463 
  3464 lemma lookupc_nmaps:
  3464 lemma lookupc_nmaps:
  3465   assumes a: "\<theta>n nmaps x to Some (c,P)"
  3465   assumes a: "\<theta>_n nmaps x to Some (c,P)"
  3466   shows "lookupc x a \<theta>n = P[c\<turnstile>c>a]"
  3466   shows "lookupc x a \<theta>_n = P[c\<turnstile>c>a]"
  3467 using a
  3467 using a
  3468 apply(induct \<theta>n)
  3468 apply(induct \<theta>_n)
  3469 apply(auto)
  3469 apply(auto)
  3470 done 
  3470 done 
  3471 
  3471 
  3472 lemma lookupc_unicity:
  3472 lemma lookupc_unicity:
  3473   assumes a: "lookupc y a \<theta>n = Ax x b" "x\<sharp>\<theta>n"
  3473   assumes a: "lookupc y a \<theta>_n = Ax x b" "x\<sharp>\<theta>_n"
  3474   shows "y=x"
  3474   shows "y=x"
  3475 using a
  3475 using a
  3476 apply(induct \<theta>n)
  3476 apply(induct \<theta>_n)
  3477 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3477 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3478 apply(case_tac "y=aa")
  3478 apply(case_tac "y=aa")
  3479 apply(auto)
  3479 apply(auto)
  3480 apply(subgoal_tac "x\<sharp>(ba[aa\<turnstile>c>a])")
  3480 apply(subgoal_tac "x\<sharp>(ba[aa\<turnstile>c>a])")
  3481 apply(simp add: fresh_atm)
  3481 apply(simp add: fresh_atm)
  3482 apply(rule rename_fresh)
  3482 apply(rule rename_fresh)
  3483 apply(simp)
  3483 apply(simp)
  3484 done
  3484 done
  3485 
  3485 
  3486 lemma lookupd_fresh:
  3486 lemma lookupd_fresh:
  3487   assumes a: "a\<sharp>\<theta>c"
  3487   assumes a: "a\<sharp>\<theta>_c"
  3488   shows "lookupd y a \<theta>c = Ax y a"
  3488   shows "lookupd y a \<theta>_c = Ax y a"
  3489 using a
  3489 using a
  3490 apply(induct \<theta>c)
  3490 apply(induct \<theta>_c)
  3491 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3491 apply(auto simp add: fresh_prod fresh_list_cons fresh_atm)
  3492 done 
  3492 done 
  3493 
  3493 
  3494 lemma lookupd_unicity:
  3494 lemma lookupd_unicity:
  3495   assumes a: "lookupd y a \<theta>c = Ax y b" "b\<sharp>\<theta>c"
  3495   assumes a: "lookupd y a \<theta>_c = Ax y b" "b\<sharp>\<theta>_c"
  3496   shows "a=b"
  3496   shows "a=b"
  3497 using a
  3497 using a
  3498 apply(induct \<theta>c)
  3498 apply(induct \<theta>_c)
  3499 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3499 apply(auto simp add: trm.inject fresh_list_cons fresh_prod)
  3500 apply(case_tac "a=aa")
  3500 apply(case_tac "a=aa")
  3501 apply(auto)
  3501 apply(auto)
  3502 apply(subgoal_tac "b\<sharp>(ba[aa\<turnstile>n>y])")
  3502 apply(subgoal_tac "b\<sharp>(ba[aa\<turnstile>n>y])")
  3503 apply(simp add: fresh_atm)
  3503 apply(simp add: fresh_atm)
  3506 done
  3506 done
  3507 
  3507 
  3508 lemma lookupd_freshness:
  3508 lemma lookupd_freshness:
  3509   fixes a::"coname"
  3509   fixes a::"coname"
  3510   and   x::"name"
  3510   and   x::"name"
  3511   shows "a\<sharp>(\<theta>c,c) \<Longrightarrow> a\<sharp>lookupd y c \<theta>c"
  3511   shows "a\<sharp>(\<theta>_c,c) \<Longrightarrow> a\<sharp>lookupd y c \<theta>_c"
  3512   and   "x\<sharp>(\<theta>c,y) \<Longrightarrow> x\<sharp>lookupd y c \<theta>c"
  3512   and   "x\<sharp>(\<theta>_c,y) \<Longrightarrow> x\<sharp>lookupd y c \<theta>_c"
  3513 apply(induct \<theta>c)
  3513 apply(induct \<theta>_c)
  3514 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3514 apply(auto simp add: fresh_prod fresh_list_cons abs_fresh fresh_atm)
  3515 apply(rule rename_fresh)
  3515 apply(rule rename_fresh)
  3516 apply(simp add: fresh_atm)
  3516 apply(simp add: fresh_atm)
  3517 apply(rule rename_fresh)
  3517 apply(rule rename_fresh)
  3518 apply(simp add: fresh_atm)
  3518 apply(simp add: fresh_atm)
  3519 done
  3519 done
  3520 
  3520 
  3521 lemma lookupd_cmaps:
  3521 lemma lookupd_cmaps:
  3522   assumes a: "\<theta>c cmaps a to Some (x,P)"
  3522   assumes a: "\<theta>_c cmaps a to Some (x,P)"
  3523   shows "lookupd y a \<theta>c = P[x\<turnstile>n>y]"
  3523   shows "lookupd y a \<theta>_c = P[x\<turnstile>n>y]"
  3524 using a
  3524 using a
  3525 apply(induct \<theta>c)
  3525 apply(induct \<theta>_c)
  3526 apply(auto)
  3526 apply(auto)
  3527 done 
  3527 done 
  3528 
  3528 
  3529 nominal_primrec (freshness_context: "\<theta>n::(name\<times>coname\<times>trm)")
  3529 nominal_primrec (freshness_context: "\<theta>_n::(name\<times>coname\<times>trm)")
  3530   stn :: "trm\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm" 
  3530   stn :: "trm\<Rightarrow>(name\<times>coname\<times>trm) list\<Rightarrow>trm" 
  3531 where
  3531 where
  3532   "stn (Ax x a) \<theta>n = lookupc x a \<theta>n"
  3532   "stn (Ax x a) \<theta>_n = lookupc x a \<theta>_n"
  3533 | "\<lbrakk>a\<sharp>(N,\<theta>n);x\<sharp>(M,\<theta>n)\<rbrakk> \<Longrightarrow> stn (Cut <a>.M (x).N) \<theta>n = (Cut <a>.M (x).N)" 
  3533 | "\<lbrakk>a\<sharp>(N,\<theta>_n);x\<sharp>(M,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (Cut <a>.M (x).N) \<theta>_n = (Cut <a>.M (x).N)" 
  3534 | "x\<sharp>\<theta>n \<Longrightarrow> stn (NotR (x).M a) \<theta>n = (NotR (x).M a)"
  3534 | "x\<sharp>\<theta>_n \<Longrightarrow> stn (NotR (x).M a) \<theta>_n = (NotR (x).M a)"
  3535 | "a\<sharp>\<theta>n \<Longrightarrow>stn (NotL <a>.M x) \<theta>n = (NotL <a>.M x)"
  3535 | "a\<sharp>\<theta>_n \<Longrightarrow>stn (NotL <a>.M x) \<theta>_n = (NotL <a>.M x)"
  3536 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>n);b\<sharp>(M,d,a,\<theta>n)\<rbrakk> \<Longrightarrow> stn (AndR <a>.M <b>.N d) \<theta>n = (AndR <a>.M <b>.N d)"
  3536 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>_n);b\<sharp>(M,d,a,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (AndR <a>.M <b>.N d) \<theta>_n = (AndR <a>.M <b>.N d)"
  3537 | "x\<sharp>(z,\<theta>n) \<Longrightarrow> stn (AndL1 (x).M z) \<theta>n = (AndL1 (x).M z)"
  3537 | "x\<sharp>(z,\<theta>_n) \<Longrightarrow> stn (AndL1 (x).M z) \<theta>_n = (AndL1 (x).M z)"
  3538 | "x\<sharp>(z,\<theta>n) \<Longrightarrow> stn (AndL2 (x).M z) \<theta>n = (AndL2 (x).M z)"
  3538 | "x\<sharp>(z,\<theta>_n) \<Longrightarrow> stn (AndL2 (x).M z) \<theta>_n = (AndL2 (x).M z)"
  3539 | "a\<sharp>(b,\<theta>n) \<Longrightarrow> stn (OrR1 <a>.M b) \<theta>n = (OrR1 <a>.M b)"
  3539 | "a\<sharp>(b,\<theta>_n) \<Longrightarrow> stn (OrR1 <a>.M b) \<theta>_n = (OrR1 <a>.M b)"
  3540 | "a\<sharp>(b,\<theta>n) \<Longrightarrow> stn (OrR2 <a>.M b) \<theta>n = (OrR2 <a>.M b)"
  3540 | "a\<sharp>(b,\<theta>_n) \<Longrightarrow> stn (OrR2 <a>.M b) \<theta>_n = (OrR2 <a>.M b)"
  3541 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>n);u\<sharp>(M,z,x,\<theta>n)\<rbrakk> \<Longrightarrow> stn (OrL (x).M (u).N z) \<theta>n = (OrL (x).M (u).N z)"
  3541 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>_n);u\<sharp>(M,z,x,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (OrL (x).M (u).N z) \<theta>_n = (OrL (x).M (u).N z)"
  3542 | "\<lbrakk>a\<sharp>(b,\<theta>n);x\<sharp>\<theta>n\<rbrakk> \<Longrightarrow> stn (ImpR (x).<a>.M b) \<theta>n = (ImpR (x).<a>.M b)"
  3542 | "\<lbrakk>a\<sharp>(b,\<theta>_n);x\<sharp>\<theta>_n\<rbrakk> \<Longrightarrow> stn (ImpR (x).<a>.M b) \<theta>_n = (ImpR (x).<a>.M b)"
  3543 | "\<lbrakk>a\<sharp>(N,\<theta>n);x\<sharp>(M,z,\<theta>n)\<rbrakk> \<Longrightarrow> stn (ImpL <a>.M (x).N z) \<theta>n = (ImpL <a>.M (x).N z)"
  3543 | "\<lbrakk>a\<sharp>(N,\<theta>_n);x\<sharp>(M,z,\<theta>_n)\<rbrakk> \<Longrightarrow> stn (ImpL <a>.M (x).N z) \<theta>_n = (ImpL <a>.M (x).N z)"
  3544 apply(finite_guess)+
  3544 apply(finite_guess)+
  3545 apply(rule TrueI)+
  3545 apply(rule TrueI)+
  3546 apply(simp add: abs_fresh abs_supp fin_supp)+
  3546 apply(simp add: abs_fresh abs_supp fin_supp)+
  3547 apply(fresh_guess)+
  3547 apply(fresh_guess)+
  3548 done
  3548 done
  3549 
  3549 
  3550 nominal_primrec (freshness_context: "\<theta>c::(coname\<times>name\<times>trm)")
  3550 nominal_primrec (freshness_context: "\<theta>_c::(coname\<times>name\<times>trm)")
  3551   stc :: "trm\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm" 
  3551   stc :: "trm\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm" 
  3552 where
  3552 where
  3553   "stc (Ax x a) \<theta>c = lookupd x a \<theta>c"
  3553   "stc (Ax x a) \<theta>_c = lookupd x a \<theta>_c"
  3554 | "\<lbrakk>a\<sharp>(N,\<theta>c);x\<sharp>(M,\<theta>c)\<rbrakk> \<Longrightarrow> stc (Cut <a>.M (x).N) \<theta>c = (Cut <a>.M (x).N)" 
  3554 | "\<lbrakk>a\<sharp>(N,\<theta>_c);x\<sharp>(M,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (Cut <a>.M (x).N) \<theta>_c = (Cut <a>.M (x).N)" 
  3555 | "x\<sharp>\<theta>c \<Longrightarrow> stc (NotR (x).M a) \<theta>c = (NotR (x).M a)"
  3555 | "x\<sharp>\<theta>_c \<Longrightarrow> stc (NotR (x).M a) \<theta>_c = (NotR (x).M a)"
  3556 | "a\<sharp>\<theta>c \<Longrightarrow> stc (NotL <a>.M x) \<theta>c = (NotL <a>.M x)"
  3556 | "a\<sharp>\<theta>_c \<Longrightarrow> stc (NotL <a>.M x) \<theta>_c = (NotL <a>.M x)"
  3557 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>c);b\<sharp>(M,d,a,\<theta>c)\<rbrakk> \<Longrightarrow> stc (AndR <a>.M <b>.N d) \<theta>c = (AndR <a>.M <b>.N d)"
  3557 | "\<lbrakk>a\<sharp>(N,d,b,\<theta>_c);b\<sharp>(M,d,a,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (AndR <a>.M <b>.N d) \<theta>_c = (AndR <a>.M <b>.N d)"
  3558 | "x\<sharp>(z,\<theta>c) \<Longrightarrow> stc (AndL1 (x).M z) \<theta>c = (AndL1 (x).M z)"
  3558 | "x\<sharp>(z,\<theta>_c) \<Longrightarrow> stc (AndL1 (x).M z) \<theta>_c = (AndL1 (x).M z)"
  3559 | "x\<sharp>(z,\<theta>c) \<Longrightarrow> stc (AndL2 (x).M z) \<theta>c = (AndL2 (x).M z)"
  3559 | "x\<sharp>(z,\<theta>_c) \<Longrightarrow> stc (AndL2 (x).M z) \<theta>_c = (AndL2 (x).M z)"
  3560 | "a\<sharp>(b,\<theta>c) \<Longrightarrow> stc (OrR1 <a>.M b) \<theta>c = (OrR1 <a>.M b)"
  3560 | "a\<sharp>(b,\<theta>_c) \<Longrightarrow> stc (OrR1 <a>.M b) \<theta>_c = (OrR1 <a>.M b)"
  3561 | "a\<sharp>(b,\<theta>c) \<Longrightarrow> stc (OrR2 <a>.M b) \<theta>c = (OrR2 <a>.M b)"
  3561 | "a\<sharp>(b,\<theta>_c) \<Longrightarrow> stc (OrR2 <a>.M b) \<theta>_c = (OrR2 <a>.M b)"
  3562 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>c);u\<sharp>(M,z,x,\<theta>c)\<rbrakk> \<Longrightarrow> stc (OrL (x).M (u).N z) \<theta>c = (OrL (x).M (u).N z)"
  3562 | "\<lbrakk>x\<sharp>(N,z,u,\<theta>_c);u\<sharp>(M,z,x,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (OrL (x).M (u).N z) \<theta>_c = (OrL (x).M (u).N z)"
  3563 | "\<lbrakk>a\<sharp>(b,\<theta>c);x\<sharp>\<theta>c\<rbrakk> \<Longrightarrow> stc (ImpR (x).<a>.M b) \<theta>c = (ImpR (x).<a>.M b)"
  3563 | "\<lbrakk>a\<sharp>(b,\<theta>_c);x\<sharp>\<theta>_c\<rbrakk> \<Longrightarrow> stc (ImpR (x).<a>.M b) \<theta>_c = (ImpR (x).<a>.M b)"
  3564 | "\<lbrakk>a\<sharp>(N,\<theta>c);x\<sharp>(M,z,\<theta>c)\<rbrakk> \<Longrightarrow> stc (ImpL <a>.M (x).N z) \<theta>c = (ImpL <a>.M (x).N z)"
  3564 | "\<lbrakk>a\<sharp>(N,\<theta>_c);x\<sharp>(M,z,\<theta>_c)\<rbrakk> \<Longrightarrow> stc (ImpL <a>.M (x).N z) \<theta>_c = (ImpL <a>.M (x).N z)"
  3565 apply(finite_guess)+
  3565 apply(finite_guess)+
  3566 apply(rule TrueI)+
  3566 apply(rule TrueI)+
  3567 apply(simp add: abs_fresh abs_supp fin_supp)+
  3567 apply(simp add: abs_fresh abs_supp fin_supp)+
  3568 apply(fresh_guess)+
  3568 apply(fresh_guess)+
  3569 done
  3569 done
  3570 
  3570 
  3571 lemma stn_eqvt[eqvt]:
  3571 lemma stn_eqvt[eqvt]:
  3572   fixes pi1::"name prm"
  3572   fixes pi1::"name prm"
  3573   and   pi2::"coname prm"
  3573   and   pi2::"coname prm"
  3574   shows "(pi1\<bullet>(stn M \<theta>n)) = stn (pi1\<bullet>M) (pi1\<bullet>\<theta>n)"
  3574   shows "(pi1\<bullet>(stn M \<theta>_n)) = stn (pi1\<bullet>M) (pi1\<bullet>\<theta>_n)"
  3575   and   "(pi2\<bullet>(stn M \<theta>n)) = stn (pi2\<bullet>M) (pi2\<bullet>\<theta>n)"
  3575   and   "(pi2\<bullet>(stn M \<theta>_n)) = stn (pi2\<bullet>M) (pi2\<bullet>\<theta>_n)"
  3576 apply -
  3576 apply -
  3577 apply(nominal_induct M avoiding: \<theta>n rule: trm.strong_induct)
  3577 apply(nominal_induct M avoiding: \<theta>_n rule: trm.strong_induct)
  3578 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3578 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3579 apply(nominal_induct M avoiding: \<theta>n rule: trm.strong_induct)
  3579 apply(nominal_induct M avoiding: \<theta>_n rule: trm.strong_induct)
  3580 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3580 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3581 done
  3581 done
  3582 
  3582 
  3583 lemma stc_eqvt[eqvt]:
  3583 lemma stc_eqvt[eqvt]:
  3584   fixes pi1::"name prm"
  3584   fixes pi1::"name prm"
  3585   and   pi2::"coname prm"
  3585   and   pi2::"coname prm"
  3586   shows "(pi1\<bullet>(stc M \<theta>c)) = stc (pi1\<bullet>M) (pi1\<bullet>\<theta>c)"
  3586   shows "(pi1\<bullet>(stc M \<theta>_c)) = stc (pi1\<bullet>M) (pi1\<bullet>\<theta>_c)"
  3587   and   "(pi2\<bullet>(stc M \<theta>c)) = stc (pi2\<bullet>M) (pi2\<bullet>\<theta>c)"
  3587   and   "(pi2\<bullet>(stc M \<theta>_c)) = stc (pi2\<bullet>M) (pi2\<bullet>\<theta>_c)"
  3588 apply -
  3588 apply -
  3589 apply(nominal_induct M avoiding: \<theta>c rule: trm.strong_induct)
  3589 apply(nominal_induct M avoiding: \<theta>_c rule: trm.strong_induct)
  3590 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3590 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3591 apply(nominal_induct M avoiding: \<theta>c rule: trm.strong_induct)
  3591 apply(nominal_induct M avoiding: \<theta>_c rule: trm.strong_induct)
  3592 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3592 apply(auto simp add: eqvts fresh_bij fresh_prod eq_bij fresh_atm)
  3593 done
  3593 done
  3594 
  3594 
  3595 lemma stn_fresh:
  3595 lemma stn_fresh:
  3596   fixes a::"coname"
  3596   fixes a::"coname"
  3597   and   x::"name"
  3597   and   x::"name"
  3598   shows "a\<sharp>(\<theta>n,M) \<Longrightarrow> a\<sharp>stn M \<theta>n"
  3598   shows "a\<sharp>(\<theta>_n,M) \<Longrightarrow> a\<sharp>stn M \<theta>_n"
  3599   and   "x\<sharp>(\<theta>n,M) \<Longrightarrow> x\<sharp>stn M \<theta>n"
  3599   and   "x\<sharp>(\<theta>_n,M) \<Longrightarrow> x\<sharp>stn M \<theta>_n"
  3600 apply(nominal_induct M avoiding: \<theta>n a x rule: trm.strong_induct)
  3600 apply(nominal_induct M avoiding: \<theta>_n a x rule: trm.strong_induct)
  3601 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3601 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3602 apply(rule lookupc_freshness)
  3602 apply(rule lookupc_freshness)
  3603 apply(simp add: fresh_atm)
  3603 apply(simp add: fresh_atm)
  3604 apply(rule lookupc_freshness)
  3604 apply(rule lookupc_freshness)
  3605 apply(simp add: fresh_atm)
  3605 apply(simp add: fresh_atm)
  3606 done
  3606 done
  3607 
  3607 
  3608 lemma stc_fresh:
  3608 lemma stc_fresh:
  3609   fixes a::"coname"
  3609   fixes a::"coname"
  3610   and   x::"name"
  3610   and   x::"name"
  3611   shows "a\<sharp>(\<theta>c,M) \<Longrightarrow> a\<sharp>stc M \<theta>c"
  3611   shows "a\<sharp>(\<theta>_c,M) \<Longrightarrow> a\<sharp>stc M \<theta>_c"
  3612   and   "x\<sharp>(\<theta>c,M) \<Longrightarrow> x\<sharp>stc M \<theta>c"
  3612   and   "x\<sharp>(\<theta>_c,M) \<Longrightarrow> x\<sharp>stc M \<theta>_c"
  3613 apply(nominal_induct M avoiding: \<theta>c a x rule: trm.strong_induct)
  3613 apply(nominal_induct M avoiding: \<theta>_c a x rule: trm.strong_induct)
  3614 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3614 apply(auto simp add: abs_fresh fresh_prod fresh_atm)
  3615 apply(rule lookupd_freshness)
  3615 apply(rule lookupd_freshness)
  3616 apply(simp add: fresh_atm)
  3616 apply(simp add: fresh_atm)
  3617 apply(rule lookupd_freshness)
  3617 apply(rule lookupd_freshness)
  3618 apply(simp add: fresh_atm)
  3618 apply(simp add: fresh_atm)
  3650 apply(cases "B")
  3650 apply(cases "B")
  3651 apply(auto)
  3651 apply(auto)
  3652 apply(perm_simp)
  3652 apply(perm_simp)
  3653 done
  3653 done
  3654 
  3654 
  3655 nominal_primrec (freshness_context: "(\<theta>n::(name\<times>coname\<times>trm) list,\<theta>c::(coname\<times>name\<times>trm) list)")
  3655 nominal_primrec (freshness_context: "(\<theta>_n::(name\<times>coname\<times>trm) list,\<theta>_c::(coname\<times>name\<times>trm) list)")
  3656   psubst :: "(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm\<Rightarrow>trm" ("_,_<_>" [100,100,100] 100) 
  3656   psubst :: "(name\<times>coname\<times>trm) list\<Rightarrow>(coname\<times>name\<times>trm) list\<Rightarrow>trm\<Rightarrow>trm" ("_,_<_>" [100,100,100] 100) 
  3657 where
  3657 where
  3658   "\<theta>n,\<theta>c<Ax x a> = lookup x a \<theta>n \<theta>c" 
  3658   "\<theta>_n,\<theta>_c<Ax x a> = lookup x a \<theta>_n \<theta>_c" 
  3659 | "\<lbrakk>a\<sharp>(N,\<theta>n,\<theta>c);x\<sharp>(M,\<theta>n,\<theta>c)\<rbrakk> \<Longrightarrow> \<theta>n,\<theta>c<Cut <a>.M (x).N> = 
  3659 | "\<lbrakk>a\<sharp>(N,\<theta>_n,\<theta>_c);x\<sharp>(M,\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> \<theta>_n,\<theta>_c<Cut <a>.M (x).N> = 
  3660    Cut <a>.(if \<exists>x. M=Ax x a then stn M \<theta>n else \<theta>n,\<theta>c<M>) 
  3660    Cut <a>.(if \<exists>x. M=Ax x a then stn M \<theta>_n else \<theta>_n,\<theta>_c<M>) 
  3661        (x).(if \<exists>a. N=Ax x a then stc N \<theta>c else \<theta>n,\<theta>c<N>)" 
  3661        (x).(if \<exists>a. N=Ax x a then stc N \<theta>_c else \<theta>_n,\<theta>_c<N>)" 
  3662 | "x\<sharp>(\<theta>n,\<theta>c) \<Longrightarrow> \<theta>n,\<theta>c<NotR (x).M a> = 
  3662 | "x\<sharp>(\<theta>_n,\<theta>_c) \<Longrightarrow> \<theta>_n,\<theta>_c<NotR (x).M a> = 
  3663   (case (findc \<theta>c a) of 
  3663   (case (findc \<theta>_c a) of 
  3664        Some (u,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.NotR (x).(\<theta>n,\<theta>c<M>) a' (u).P) 
  3664        Some (u,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.NotR (x).(\<theta>_n,\<theta>_c<M>) a' (u).P) 
  3665      | None \<Rightarrow> NotR (x).(\<theta>n,\<theta>c<M>) a)"
  3665      | None \<Rightarrow> NotR (x).(\<theta>_n,\<theta>_c<M>) a)"
  3666 | "a\<sharp>(\<theta>n,\<theta>c) \<Longrightarrow> \<theta>n,\<theta>c<NotL <a>.M x> = 
  3666 | "a\<sharp>(\<theta>_n,\<theta>_c) \<Longrightarrow> \<theta>_n,\<theta>_c<NotL <a>.M x> = 
  3667   (case (findn \<theta>n x) of 
  3667   (case (findn \<theta>_n x) of 
  3668        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>x'. Cut <c>.P (x').(NotL <a>.(\<theta>n,\<theta>c<M>) x')) 
  3668        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>x'. Cut <c>.P (x').(NotL <a>.(\<theta>_n,\<theta>_c<M>) x')) 
  3669      | None \<Rightarrow> NotL <a>.(\<theta>n,\<theta>c<M>) x)"
  3669      | None \<Rightarrow> NotL <a>.(\<theta>_n,\<theta>_c<M>) x)"
  3670 | "\<lbrakk>a\<sharp>(N,c,\<theta>n,\<theta>c);b\<sharp>(M,c,\<theta>n,\<theta>c);b\<noteq>a\<rbrakk> \<Longrightarrow> (\<theta>n,\<theta>c<AndR <a>.M <b>.N c>) = 
  3670 | "\<lbrakk>a\<sharp>(N,c,\<theta>_n,\<theta>_c);b\<sharp>(M,c,\<theta>_n,\<theta>_c);b\<noteq>a\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<AndR <a>.M <b>.N c>) = 
  3671   (case (findc \<theta>c c) of 
  3671   (case (findc \<theta>_c c) of 
  3672        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.(AndR <a>.(\<theta>n,\<theta>c<M>) <b>.(\<theta>n,\<theta>c<N>) a') (x).P)
  3672        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.(AndR <a>.(\<theta>_n,\<theta>_c<M>) <b>.(\<theta>_n,\<theta>_c<N>) a') (x).P)
  3673      | None \<Rightarrow> AndR <a>.(\<theta>n,\<theta>c<M>) <b>.(\<theta>n,\<theta>c<N>) c)"
  3673      | None \<Rightarrow> AndR <a>.(\<theta>_n,\<theta>_c<M>) <b>.(\<theta>_n,\<theta>_c<N>) c)"
  3674 | "x\<sharp>(z,\<theta>n,\<theta>c) \<Longrightarrow> (\<theta>n,\<theta>c<AndL1 (x).M z>) = 
  3674 | "x\<sharp>(z,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<AndL1 (x).M z>) = 
  3675   (case (findn \<theta>n z) of 
  3675   (case (findn \<theta>_n z) of 
  3676        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL1 (x).(\<theta>n,\<theta>c<M>) z') 
  3676        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL1 (x).(\<theta>_n,\<theta>_c<M>) z') 
  3677      | None \<Rightarrow> AndL1 (x).(\<theta>n,\<theta>c<M>) z)"
  3677      | None \<Rightarrow> AndL1 (x).(\<theta>_n,\<theta>_c<M>) z)"
  3678 | "x\<sharp>(z,\<theta>n,\<theta>c) \<Longrightarrow> (\<theta>n,\<theta>c<AndL2 (x).M z>) = 
  3678 | "x\<sharp>(z,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<AndL2 (x).M z>) = 
  3679   (case (findn \<theta>n z) of 
  3679   (case (findn \<theta>_n z) of 
  3680        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL2 (x).(\<theta>n,\<theta>c<M>) z') 
  3680        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').AndL2 (x).(\<theta>_n,\<theta>_c<M>) z') 
  3681      | None \<Rightarrow> AndL2 (x).(\<theta>n,\<theta>c<M>) z)"
  3681      | None \<Rightarrow> AndL2 (x).(\<theta>_n,\<theta>_c<M>) z)"
  3682 | "\<lbrakk>x\<sharp>(N,z,\<theta>n,\<theta>c);u\<sharp>(M,z,\<theta>n,\<theta>c);x\<noteq>u\<rbrakk> \<Longrightarrow> (\<theta>n,\<theta>c<OrL (x).M (u).N z>) =
  3682 | "\<lbrakk>x\<sharp>(N,z,\<theta>_n,\<theta>_c);u\<sharp>(M,z,\<theta>_n,\<theta>_c);x\<noteq>u\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<OrL (x).M (u).N z>) =
  3683   (case (findn \<theta>n z) of  
  3683   (case (findn \<theta>_n z) of  
  3684        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').OrL (x).(\<theta>n,\<theta>c<M>) (u).(\<theta>n,\<theta>c<N>) z') 
  3684        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').OrL (x).(\<theta>_n,\<theta>_c<M>) (u).(\<theta>_n,\<theta>_c<N>) z') 
  3685      | None \<Rightarrow> OrL (x).(\<theta>n,\<theta>c<M>) (u).(\<theta>n,\<theta>c<N>) z)"
  3685      | None \<Rightarrow> OrL (x).(\<theta>_n,\<theta>_c<M>) (u).(\<theta>_n,\<theta>_c<N>) z)"
  3686 | "a\<sharp>(b,\<theta>n,\<theta>c) \<Longrightarrow> (\<theta>n,\<theta>c<OrR1 <a>.M b>) = 
  3686 | "a\<sharp>(b,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<OrR1 <a>.M b>) = 
  3687   (case (findc \<theta>c b) of
  3687   (case (findc \<theta>_c b) of
  3688        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR1 <a>.(\<theta>n,\<theta>c<M>) a' (x).P) 
  3688        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR1 <a>.(\<theta>_n,\<theta>_c<M>) a' (x).P) 
  3689      | None \<Rightarrow> OrR1 <a>.(\<theta>n,\<theta>c<M>) b)"
  3689      | None \<Rightarrow> OrR1 <a>.(\<theta>_n,\<theta>_c<M>) b)"
  3690 | "a\<sharp>(b,\<theta>n,\<theta>c) \<Longrightarrow> (\<theta>n,\<theta>c<OrR2 <a>.M b>) = 
  3690 | "a\<sharp>(b,\<theta>_n,\<theta>_c) \<Longrightarrow> (\<theta>_n,\<theta>_c<OrR2 <a>.M b>) = 
  3691   (case (findc \<theta>c b) of
  3691   (case (findc \<theta>_c b) of
  3692        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR2 <a>.(\<theta>n,\<theta>c<M>) a' (x).P) 
  3692        Some (x,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.OrR2 <a>.(\<theta>_n,\<theta>_c<M>) a' (x).P) 
  3693      | None \<Rightarrow> OrR2 <a>.(\<theta>n,\<theta>c<M>) b)"
  3693      | None \<Rightarrow> OrR2 <a>.(\<theta>_n,\<theta>_c<M>) b)"
  3694 | "\<lbrakk>a\<sharp>(b,\<theta>n,\<theta>c); x\<sharp>(\<theta>n,\<theta>c)\<rbrakk> \<Longrightarrow> (\<theta>n,\<theta>c<ImpR (x).<a>.M b>) = 
  3694 | "\<lbrakk>a\<sharp>(b,\<theta>_n,\<theta>_c); x\<sharp>(\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<ImpR (x).<a>.M b>) = 
  3695   (case (findc \<theta>c b) of
  3695   (case (findc \<theta>_c b) of
  3696        Some (z,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.ImpR (x).<a>.(\<theta>n,\<theta>c<M>) a' (z).P)
  3696        Some (z,P) \<Rightarrow> fresh_fun (\<lambda>a'. Cut <a'>.ImpR (x).<a>.(\<theta>_n,\<theta>_c<M>) a' (z).P)
  3697      | None \<Rightarrow> ImpR (x).<a>.(\<theta>n,\<theta>c<M>) b)"
  3697      | None \<Rightarrow> ImpR (x).<a>.(\<theta>_n,\<theta>_c<M>) b)"
  3698 | "\<lbrakk>a\<sharp>(N,\<theta>n,\<theta>c); x\<sharp>(z,M,\<theta>n,\<theta>c)\<rbrakk> \<Longrightarrow> (\<theta>n,\<theta>c<ImpL <a>.M (x).N z>) = 
  3698 | "\<lbrakk>a\<sharp>(N,\<theta>_n,\<theta>_c); x\<sharp>(z,M,\<theta>_n,\<theta>_c)\<rbrakk> \<Longrightarrow> (\<theta>_n,\<theta>_c<ImpL <a>.M (x).N z>) = 
  3699   (case (findn \<theta>n z) of
  3699   (case (findn \<theta>_n z) of
  3700        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').ImpL <a>.(\<theta>n,\<theta>c<M>) (x).(\<theta>n,\<theta>c<N>) z') 
  3700        Some (c,P) \<Rightarrow> fresh_fun (\<lambda>z'. Cut <c>.P (z').ImpL <a>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>) z') 
  3701      | None \<Rightarrow> ImpL <a>.(\<theta>n,\<theta>c<M>) (x).(\<theta>n,\<theta>c<N>) z)"
  3701      | None \<Rightarrow> ImpL <a>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>) z)"
  3702 apply(finite_guess)+
  3702 apply(finite_guess)+
  3703 apply(rule TrueI)+
  3703 apply(rule TrueI)+
  3704 apply(simp add: abs_fresh stc_fresh)
  3704 apply(simp add: abs_fresh stc_fresh)
  3705 apply(simp add: abs_fresh stn_fresh)
  3705 apply(simp add: abs_fresh stn_fresh)
  3706 apply(case_tac "findc \<theta>c x3")
  3706 apply(case_tac "findc \<theta>_c x3")
  3707 apply(simp add: abs_fresh)
  3707 apply(simp add: abs_fresh)
  3708 apply(auto)[1]
  3708 apply(auto)[1]
  3709 apply(generate_fresh "coname")
  3709 apply(generate_fresh "coname")
  3710 apply(fresh_fun_simp (no_asm))
  3710 apply(fresh_fun_simp (no_asm))
  3711 apply(drule cmaps_fresh)
  3711 apply(drule cmaps_fresh)
  3712 apply(auto simp add: fresh_prod)[1]
  3712 apply(auto simp add: fresh_prod)[1]
  3713 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3713 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3714 apply(case_tac "findn \<theta>n x3")
  3714 apply(case_tac "findn \<theta>_n x3")
  3715 apply(simp add: abs_fresh)
  3715 apply(simp add: abs_fresh)
  3716 apply(auto)[1]
  3716 apply(auto)[1]
  3717 apply(generate_fresh "name")
  3717 apply(generate_fresh "name")
  3718 apply(fresh_fun_simp (no_asm))
  3718 apply(fresh_fun_simp (no_asm))
  3719 apply(drule nmaps_fresh)
  3719 apply(drule nmaps_fresh)
  3720 apply(auto simp add: fresh_prod)[1]
  3720 apply(auto simp add: fresh_prod)[1]
  3721 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3721 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3722 apply(case_tac "findc \<theta>c x5")
  3722 apply(case_tac "findc \<theta>_c x5")
  3723 apply(simp add: abs_fresh)
  3723 apply(simp add: abs_fresh)
  3724 apply(auto)[1]
  3724 apply(auto)[1]
  3725 apply(generate_fresh "coname")
  3725 apply(generate_fresh "coname")
  3726 apply(fresh_fun_simp (no_asm))
  3726 apply(fresh_fun_simp (no_asm))
  3727 apply(drule cmaps_fresh)
  3727 apply(drule cmaps_fresh)
  3728 apply(auto simp add: fresh_prod)[1]
  3728 apply(auto simp add: fresh_prod)[1]
  3729 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3729 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3730 apply(case_tac "findc \<theta>c x5")
  3730 apply(case_tac "findc \<theta>_c x5")
  3731 apply(simp add: abs_fresh)
  3731 apply(simp add: abs_fresh)
  3732 apply(auto)[1]
  3732 apply(auto)[1]
  3733 apply(generate_fresh "coname")
  3733 apply(generate_fresh "coname")
  3734 apply(fresh_fun_simp (no_asm))
  3734 apply(fresh_fun_simp (no_asm))
  3735 apply(drule_tac x="x3" in cmaps_fresh)
  3735 apply(drule_tac x="x3" in cmaps_fresh)
  3736 apply(auto simp add: fresh_prod)[1]
  3736 apply(auto simp add: fresh_prod)[1]
  3737 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3737 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3738 apply(case_tac "findn \<theta>n x3")
  3738 apply(case_tac "findn \<theta>_n x3")
  3739 apply(simp add: abs_fresh)
  3739 apply(simp add: abs_fresh)
  3740 apply(auto)[1]
  3740 apply(auto)[1]
  3741 apply(generate_fresh "name")
  3741 apply(generate_fresh "name")
  3742 apply(fresh_fun_simp (no_asm))
  3742 apply(fresh_fun_simp (no_asm))
  3743 apply(drule nmaps_fresh)
  3743 apply(drule nmaps_fresh)
  3744 apply(auto simp add: fresh_prod)[1]
  3744 apply(auto simp add: fresh_prod)[1]
  3745 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3745 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3746 apply(case_tac "findn \<theta>n x3")
  3746 apply(case_tac "findn \<theta>_n x3")
  3747 apply(simp add: abs_fresh)
  3747 apply(simp add: abs_fresh)
  3748 apply(auto)[1]
  3748 apply(auto)[1]
  3749 apply(generate_fresh "name")
  3749 apply(generate_fresh "name")
  3750 apply(fresh_fun_simp (no_asm))
  3750 apply(fresh_fun_simp (no_asm))
  3751 apply(drule nmaps_fresh)
  3751 apply(drule nmaps_fresh)
  3752 apply(auto simp add: fresh_prod)[1]
  3752 apply(auto simp add: fresh_prod)[1]
  3753 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3753 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3754 apply(case_tac "findc \<theta>c x3")
  3754 apply(case_tac "findc \<theta>_c x3")
  3755 apply(simp add: abs_fresh)
  3755 apply(simp add: abs_fresh)
  3756 apply(auto)[1]
  3756 apply(auto)[1]
  3757 apply(generate_fresh "coname")
  3757 apply(generate_fresh "coname")
  3758 apply(fresh_fun_simp (no_asm))
  3758 apply(fresh_fun_simp (no_asm))
  3759 apply(drule cmaps_fresh)
  3759 apply(drule cmaps_fresh)
  3760 apply(auto simp add: fresh_prod)[1]
  3760 apply(auto simp add: fresh_prod)[1]
  3761 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3761 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3762 apply(case_tac "findc \<theta>c x3")
  3762 apply(case_tac "findc \<theta>_c x3")
  3763 apply(simp add: abs_fresh)
  3763 apply(simp add: abs_fresh)
  3764 apply(auto)[1]
  3764 apply(auto)[1]
  3765 apply(generate_fresh "coname")
  3765 apply(generate_fresh "coname")
  3766 apply(fresh_fun_simp (no_asm))
  3766 apply(fresh_fun_simp (no_asm))
  3767 apply(drule cmaps_fresh)
  3767 apply(drule cmaps_fresh)
  3768 apply(auto simp add: fresh_prod)[1]
  3768 apply(auto simp add: fresh_prod)[1]
  3769 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3769 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3770 apply(case_tac "findn \<theta>n x5")
  3770 apply(case_tac "findn \<theta>_n x5")
  3771 apply(simp add: abs_fresh)
  3771 apply(simp add: abs_fresh)
  3772 apply(auto)[1]
  3772 apply(auto)[1]
  3773 apply(generate_fresh "name")
  3773 apply(generate_fresh "name")
  3774 apply(fresh_fun_simp (no_asm))
  3774 apply(fresh_fun_simp (no_asm))
  3775 apply(drule nmaps_fresh)
  3775 apply(drule nmaps_fresh)
  3776 apply(auto simp add: fresh_prod)[1]
  3776 apply(auto simp add: fresh_prod)[1]
  3777 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3777 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3778 apply(case_tac "findn \<theta>n x5")
  3778 apply(case_tac "findn \<theta>_n x5")
  3779 apply(simp add: abs_fresh)
  3779 apply(simp add: abs_fresh)
  3780 apply(auto)[1]
  3780 apply(auto)[1]
  3781 apply(generate_fresh "name")
  3781 apply(generate_fresh "name")
  3782 apply(fresh_fun_simp (no_asm))
  3782 apply(fresh_fun_simp (no_asm))
  3783 apply(drule_tac a="x3" in nmaps_fresh)
  3783 apply(drule_tac a="x3" in nmaps_fresh)
  3784 apply(auto simp add: fresh_prod)[1]
  3784 apply(auto simp add: fresh_prod)[1]
  3785 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3785 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3786 apply(case_tac "findc \<theta>c x4")
  3786 apply(case_tac "findc \<theta>_c x4")
  3787 apply(simp add: abs_fresh abs_supp fin_supp)
  3787 apply(simp add: abs_fresh abs_supp fin_supp)
  3788 apply(auto)[1]
  3788 apply(auto)[1]
  3789 apply(generate_fresh "coname")
  3789 apply(generate_fresh "coname")
  3790 apply(fresh_fun_simp (no_asm))
  3790 apply(fresh_fun_simp (no_asm))
  3791 apply(drule cmaps_fresh)
  3791 apply(drule cmaps_fresh)
  3792 apply(auto simp add: fresh_prod)[1]
  3792 apply(auto simp add: fresh_prod)[1]
  3793 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3793 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3794 apply(case_tac "findc \<theta>c x4")
  3794 apply(case_tac "findc \<theta>_c x4")
  3795 apply(simp add: abs_fresh abs_supp fin_supp)
  3795 apply(simp add: abs_fresh abs_supp fin_supp)
  3796 apply(auto)[1]
  3796 apply(auto)[1]
  3797 apply(generate_fresh "coname")
  3797 apply(generate_fresh "coname")
  3798 apply(fresh_fun_simp (no_asm))
  3798 apply(fresh_fun_simp (no_asm))
  3799 apply(drule_tac x="x2" in cmaps_fresh)
  3799 apply(drule_tac x="x2" in cmaps_fresh)
  3800 apply(auto simp add: fresh_prod)[1]
  3800 apply(auto simp add: fresh_prod)[1]
  3801 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3801 apply(simp add: abs_fresh fresh_prod fresh_atm abs_supp fin_supp)
  3802 apply(case_tac "findn \<theta>n x5")
  3802 apply(case_tac "findn \<theta>_n x5")
  3803 apply(simp add: abs_fresh)
  3803 apply(simp add: abs_fresh)
  3804 apply(auto)[1]
  3804 apply(auto)[1]
  3805 apply(generate_fresh "name")
  3805 apply(generate_fresh "name")
  3806 apply(fresh_fun_simp (no_asm))
  3806 apply(fresh_fun_simp (no_asm))
  3807 apply(drule nmaps_fresh)
  3807 apply(drule nmaps_fresh)
  3808 apply(auto simp add: fresh_prod)[1]
  3808 apply(auto simp add: fresh_prod)[1]
  3809 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3809 apply(simp add: abs_fresh fresh_prod fresh_atm)
  3810 apply(case_tac "findn \<theta>n x5")
  3810 apply(case_tac "findn \<theta>_n x5")
  3811 apply(simp add: abs_fresh)
  3811 apply(simp add: abs_fresh)
  3812 apply(auto)[1]
  3812 apply(auto)[1]
  3813 apply(generate_fresh "name")
  3813 apply(generate_fresh "name")
  3814 apply(fresh_fun_simp (no_asm))
  3814 apply(fresh_fun_simp (no_asm))
  3815 apply(drule_tac a="x3" in nmaps_fresh)
  3815 apply(drule_tac a="x3" in nmaps_fresh)
  3824 using a
  3824 using a
  3825 apply(auto)
  3825 apply(auto)
  3826 done
  3826 done
  3827 
  3827 
  3828 lemma find_maps:
  3828 lemma find_maps:
  3829   shows "\<theta>c cmaps a to (findc \<theta>c a)"
  3829   shows "\<theta>_c cmaps a to (findc \<theta>_c a)"
  3830   and   "\<theta>n nmaps x to (findn \<theta>n x)"
  3830   and   "\<theta>_n nmaps x to (findn \<theta>_n x)"
  3831 apply(auto)
  3831 apply(auto)
  3832 done
  3832 done
  3833 
  3833 
  3834 lemma psubst_eqvt[eqvt]:
  3834 lemma psubst_eqvt[eqvt]:
  3835   fixes pi1::"name prm"
  3835   fixes pi1::"name prm"
  3836   and   pi2::"coname prm"
  3836   and   pi2::"coname prm"
  3837   shows "pi1\<bullet>(\<theta>n,\<theta>c<M>) = (pi1\<bullet>\<theta>n),(pi1\<bullet>\<theta>c)<(pi1\<bullet>M)>"
  3837   shows "pi1\<bullet>(\<theta>_n,\<theta>_c<M>) = (pi1\<bullet>\<theta>_n),(pi1\<bullet>\<theta>_c)<(pi1\<bullet>M)>"
  3838   and   "pi2\<bullet>(\<theta>n,\<theta>c<M>) = (pi2\<bullet>\<theta>n),(pi2\<bullet>\<theta>c)<(pi2\<bullet>M)>"
  3838   and   "pi2\<bullet>(\<theta>_n,\<theta>_c<M>) = (pi2\<bullet>\<theta>_n),(pi2\<bullet>\<theta>_c)<(pi2\<bullet>M)>"
  3839 apply(nominal_induct M avoiding: \<theta>n \<theta>c rule: trm.strong_induct)
  3839 apply(nominal_induct M avoiding: \<theta>_n \<theta>_c rule: trm.strong_induct)
  3840 apply(auto simp add: eq_bij fresh_bij eqvts perm_pi_simp)
  3840 apply(auto simp add: eq_bij fresh_bij eqvts perm_pi_simp)
  3841 apply(rule case_cong)
  3841 apply(rule case_cong)
  3842 apply(rule find_maps)
  3842 apply(rule find_maps)
  3843 apply(simp)
  3843 apply(simp)
  3844 apply(perm_simp add: eqvts)
  3844 apply(perm_simp add: eqvts)
  3919 apply(simp)
  3919 apply(simp)
  3920 apply(perm_simp add: eqvts)
  3920 apply(perm_simp add: eqvts)
  3921 done
  3921 done
  3922 
  3922 
  3923 lemma ax_psubst:
  3923 lemma ax_psubst:
  3924   assumes a: "\<theta>n,\<theta>c<M> = Ax x a"
  3924   assumes a: "\<theta>_n,\<theta>_c<M> = Ax x a"
  3925   and     b: "a\<sharp>(\<theta>n,\<theta>c)" "x\<sharp>(\<theta>n,\<theta>c)"
  3925   and     b: "a\<sharp>(\<theta>_n,\<theta>_c)" "x\<sharp>(\<theta>_n,\<theta>_c)"
  3926   shows "M = Ax x a"
  3926   shows "M = Ax x a"
  3927 using a b
  3927 using a b
  3928 apply(nominal_induct M avoiding: \<theta>n \<theta>c rule: trm.strong_induct)
  3928 apply(nominal_induct M avoiding: \<theta>_n \<theta>_c rule: trm.strong_induct)
  3929 apply(auto)
  3929 apply(auto)
  3930 apply(drule lookup_unicity)
  3930 apply(drule lookup_unicity)
  3931 apply(simp)+
  3931 apply(simp)+
  3932 apply(case_tac "findc \<theta>c coname")
  3932 apply(case_tac "findc \<theta>_c coname")
  3933 apply(simp)
  3933 apply(simp)
  3934 apply(auto)[1]
  3934 apply(auto)[1]
  3935 apply(generate_fresh "coname")
  3935 apply(generate_fresh "coname")
  3936 apply(fresh_fun_simp)
  3936 apply(fresh_fun_simp)
  3937 apply(simp)
  3937 apply(simp)
  3938 apply(case_tac "findn \<theta>n name")
  3938 apply(case_tac "findn \<theta>_n name")
  3939 apply(simp)
  3939 apply(simp)
  3940 apply(auto)[1]
  3940 apply(auto)[1]
  3941 apply(generate_fresh "name")
  3941 apply(generate_fresh "name")
  3942 apply(fresh_fun_simp)
  3942 apply(fresh_fun_simp)
  3943 apply(simp)
  3943 apply(simp)
  3944 apply(case_tac "findc \<theta>c coname3")
  3944 apply(case_tac "findc \<theta>_c coname3")
  3945 apply(simp)
  3945 apply(simp)
  3946 apply(auto)[1]
  3946 apply(auto)[1]
  3947 apply(generate_fresh "coname")
  3947 apply(generate_fresh "coname")
  3948 apply(fresh_fun_simp)
  3948 apply(fresh_fun_simp)
  3949 apply(simp)
  3949 apply(simp)
  3950 apply(case_tac "findn \<theta>n name2")
  3950 apply(case_tac "findn \<theta>_n name2")
  3951 apply(simp)
  3951 apply(simp)
  3952 apply(auto)[1]
  3952 apply(auto)[1]
  3953 apply(generate_fresh "name")
  3953 apply(generate_fresh "name")
  3954 apply(fresh_fun_simp)
  3954 apply(fresh_fun_simp)
  3955 apply(simp)
  3955 apply(simp)
  3956 apply(case_tac "findn \<theta>n name2")
  3956 apply(case_tac "findn \<theta>_n name2")
  3957 apply(simp)
  3957 apply(simp)
  3958 apply(auto)[1]
  3958 apply(auto)[1]
  3959 apply(generate_fresh "name")
  3959 apply(generate_fresh "name")
  3960 apply(fresh_fun_simp)
  3960 apply(fresh_fun_simp)
  3961 apply(simp)
  3961 apply(simp)
  3962 apply(case_tac "findc \<theta>c coname2")
  3962 apply(case_tac "findc \<theta>_c coname2")
  3963 apply(simp)
  3963 apply(simp)
  3964 apply(auto)[1]
  3964 apply(auto)[1]
  3965 apply(generate_fresh "coname")
  3965 apply(generate_fresh "coname")
  3966 apply(fresh_fun_simp)
  3966 apply(fresh_fun_simp)
  3967 apply(simp)
  3967 apply(simp)
  3968 apply(case_tac "findc \<theta>c coname2")
  3968 apply(case_tac "findc \<theta>_c coname2")
  3969 apply(simp)
  3969 apply(simp)
  3970 apply(auto)[1]
  3970 apply(auto)[1]
  3971 apply(generate_fresh "coname")
  3971 apply(generate_fresh "coname")
  3972 apply(fresh_fun_simp)
  3972 apply(fresh_fun_simp)
  3973 apply(simp)
  3973 apply(simp)
  3974 apply(case_tac "findn \<theta>n name3")
  3974 apply(case_tac "findn \<theta>_n name3")
  3975 apply(simp)
  3975 apply(simp)
  3976 apply(auto)[1]
  3976 apply(auto)[1]
  3977 apply(generate_fresh "name")
  3977 apply(generate_fresh "name")
  3978 apply(fresh_fun_simp)
  3978 apply(fresh_fun_simp)
  3979 apply(simp)
  3979 apply(simp)
  3980 apply(case_tac "findc \<theta>c coname2")
  3980 apply(case_tac "findc \<theta>_c coname2")
  3981 apply(simp)
  3981 apply(simp)
  3982 apply(auto)[1]
  3982 apply(auto)[1]
  3983 apply(generate_fresh "coname")
  3983 apply(generate_fresh "coname")
  3984 apply(fresh_fun_simp)
  3984 apply(fresh_fun_simp)
  3985 apply(simp)
  3985 apply(simp)
  3986 apply(case_tac "findn \<theta>n name2")
  3986 apply(case_tac "findn \<theta>_n name2")
  3987 apply(simp)
  3987 apply(simp)
  3988 apply(auto)[1]
  3988 apply(auto)[1]
  3989 apply(generate_fresh "name")
  3989 apply(generate_fresh "name")
  3990 apply(fresh_fun_simp)
  3990 apply(fresh_fun_simp)
  3991 apply(simp)
  3991 apply(simp)
  4111 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4111 apply(simp add: alpha eqvts calc_atm fresh_prod fresh_atm subst_fresh)[1]
  4112 done
  4112 done
  4113 
  4113 
  4114 lemma psubst_fresh_name:
  4114 lemma psubst_fresh_name:
  4115   fixes x::"name"
  4115   fixes x::"name"
  4116   assumes a: "x\<sharp>\<theta>n" "x\<sharp>\<theta>c" "x\<sharp>M"
  4116   assumes a: "x\<sharp>\<theta>_n" "x\<sharp>\<theta>_c" "x\<sharp>M"
  4117   shows "x\<sharp>\<theta>n,\<theta>c<M>"
  4117   shows "x\<sharp>\<theta>_n,\<theta>_c<M>"
  4118 using a
  4118 using a
  4119 apply(nominal_induct M avoiding: x \<theta>n \<theta>c rule: trm.strong_induct)
  4119 apply(nominal_induct M avoiding: x \<theta>_n \<theta>_c rule: trm.strong_induct)
  4120 apply(simp add: lookup_freshness)
  4120 apply(simp add: lookup_freshness)
  4121 apply(auto simp add: abs_fresh)[1]
  4121 apply(auto simp add: abs_fresh)[1]
  4122 apply(simp add: lookupc_freshness)
  4122 apply(simp add: lookupc_freshness)
  4123 apply(simp add: lookupc_freshness)
  4123 apply(simp add: lookupc_freshness)
  4124 apply(simp add: lookupc_freshness)
  4124 apply(simp add: lookupc_freshness)
  4125 apply(simp add: lookupd_freshness)
  4125 apply(simp add: lookupd_freshness)
  4126 apply(simp add: lookupd_freshness)
  4126 apply(simp add: lookupd_freshness)
  4127 apply(simp add: lookupc_freshness)
  4127 apply(simp add: lookupc_freshness)
  4128 apply(simp)
  4128 apply(simp)
  4129 apply(case_tac "findc \<theta>c coname")
  4129 apply(case_tac "findc \<theta>_c coname")
  4130 apply(auto simp add: abs_fresh)[1]
  4130 apply(auto simp add: abs_fresh)[1]
  4131 apply(auto)[1]
  4131 apply(auto)[1]
  4132 apply(generate_fresh "coname")
  4132 apply(generate_fresh "coname")
  4133 apply(fresh_fun_simp)
  4133 apply(fresh_fun_simp)
  4134 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4134 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4135 apply(simp)
  4135 apply(simp)
  4136 apply(case_tac "findn \<theta>n name")
  4136 apply(case_tac "findn \<theta>_n name")
  4137 apply(auto simp add: abs_fresh)[1]
  4137 apply(auto simp add: abs_fresh)[1]
  4138 apply(auto)[1]
  4138 apply(auto)[1]
  4139 apply(generate_fresh "name")
  4139 apply(generate_fresh "name")
  4140 apply(fresh_fun_simp)
  4140 apply(fresh_fun_simp)
  4141 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4141 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4142 apply(simp)
  4142 apply(simp)
  4143 apply(case_tac "findc \<theta>c coname3")
  4143 apply(case_tac "findc \<theta>_c coname3")
  4144 apply(auto simp add: abs_fresh)[1]
  4144 apply(auto simp add: abs_fresh)[1]
  4145 apply(auto)[1]
  4145 apply(auto)[1]
  4146 apply(generate_fresh "coname")
  4146 apply(generate_fresh "coname")
  4147 apply(fresh_fun_simp)
  4147 apply(fresh_fun_simp)
  4148 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4148 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4149 apply(simp)
  4149 apply(simp)
  4150 apply(case_tac "findn \<theta>n name2")
  4150 apply(case_tac "findn \<theta>_n name2")
  4151 apply(auto simp add: abs_fresh)[1]
  4151 apply(auto simp add: abs_fresh)[1]
  4152 apply(auto)[1]
  4152 apply(auto)[1]
  4153 apply(generate_fresh "name")
  4153 apply(generate_fresh "name")
  4154 apply(fresh_fun_simp)
  4154 apply(fresh_fun_simp)
  4155 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4155 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4156 apply(simp)
  4156 apply(simp)
  4157 apply(case_tac "findn \<theta>n name2")
  4157 apply(case_tac "findn \<theta>_n name2")
  4158 apply(auto simp add: abs_fresh)[1]
  4158 apply(auto simp add: abs_fresh)[1]
  4159 apply(auto)[1]
  4159 apply(auto)[1]
  4160 apply(generate_fresh "name")
  4160 apply(generate_fresh "name")
  4161 apply(fresh_fun_simp)
  4161 apply(fresh_fun_simp)
  4162 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4162 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4163 apply(simp)
  4163 apply(simp)
  4164 apply(case_tac "findc \<theta>c coname2")
  4164 apply(case_tac "findc \<theta>_c coname2")
  4165 apply(auto simp add: abs_fresh)[1]
  4165 apply(auto simp add: abs_fresh)[1]
  4166 apply(auto)[1]
  4166 apply(auto)[1]
  4167 apply(generate_fresh "coname")
  4167 apply(generate_fresh "coname")
  4168 apply(fresh_fun_simp)
  4168 apply(fresh_fun_simp)
  4169 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4169 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4170 apply(simp)
  4170 apply(simp)
  4171 apply(case_tac "findc \<theta>c coname2")
  4171 apply(case_tac "findc \<theta>_c coname2")
  4172 apply(auto simp add: abs_fresh)[1]
  4172 apply(auto simp add: abs_fresh)[1]
  4173 apply(auto)[1]
  4173 apply(auto)[1]
  4174 apply(generate_fresh "coname")
  4174 apply(generate_fresh "coname")
  4175 apply(fresh_fun_simp)
  4175 apply(fresh_fun_simp)
  4176 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4176 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4177 apply(simp)
  4177 apply(simp)
  4178 apply(case_tac "findn \<theta>n name3")
  4178 apply(case_tac "findn \<theta>_n name3")
  4179 apply(auto simp add: abs_fresh)[1]
  4179 apply(auto simp add: abs_fresh)[1]
  4180 apply(auto)[1]
  4180 apply(auto)[1]
  4181 apply(generate_fresh "name")
  4181 apply(generate_fresh "name")
  4182 apply(fresh_fun_simp)
  4182 apply(fresh_fun_simp)
  4183 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4183 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4184 apply(simp)
  4184 apply(simp)
  4185 apply(case_tac "findc \<theta>c coname2")
  4185 apply(case_tac "findc \<theta>_c coname2")
  4186 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4186 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4187 apply(auto)[1]
  4187 apply(auto)[1]
  4188 apply(generate_fresh "coname")
  4188 apply(generate_fresh "coname")
  4189 apply(fresh_fun_simp)
  4189 apply(fresh_fun_simp)
  4190 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4190 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4191 apply(simp)
  4191 apply(simp)
  4192 apply(case_tac "findn \<theta>n name2")
  4192 apply(case_tac "findn \<theta>_n name2")
  4193 apply(auto simp add: abs_fresh)[1]
  4193 apply(auto simp add: abs_fresh)[1]
  4194 apply(auto)[1]
  4194 apply(auto)[1]
  4195 apply(generate_fresh "name")
  4195 apply(generate_fresh "name")
  4196 apply(fresh_fun_simp)
  4196 apply(fresh_fun_simp)
  4197 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4197 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4198 done
  4198 done
  4199 
  4199 
  4200 lemma psubst_fresh_coname:
  4200 lemma psubst_fresh_coname:
  4201   fixes a::"coname"
  4201   fixes a::"coname"
  4202   assumes a: "a\<sharp>\<theta>n" "a\<sharp>\<theta>c" "a\<sharp>M"
  4202   assumes a: "a\<sharp>\<theta>_n" "a\<sharp>\<theta>_c" "a\<sharp>M"
  4203   shows "a\<sharp>\<theta>n,\<theta>c<M>"
  4203   shows "a\<sharp>\<theta>_n,\<theta>_c<M>"
  4204 using a
  4204 using a
  4205 apply(nominal_induct M avoiding: a \<theta>n \<theta>c rule: trm.strong_induct)
  4205 apply(nominal_induct M avoiding: a \<theta>_n \<theta>_c rule: trm.strong_induct)
  4206 apply(simp add: lookup_freshness)
  4206 apply(simp add: lookup_freshness)
  4207 apply(auto simp add: abs_fresh)[1]
  4207 apply(auto simp add: abs_fresh)[1]
  4208 apply(simp add: lookupd_freshness)
  4208 apply(simp add: lookupd_freshness)
  4209 apply(simp add: lookupd_freshness)
  4209 apply(simp add: lookupd_freshness)
  4210 apply(simp add: lookupc_freshness)
  4210 apply(simp add: lookupc_freshness)
  4211 apply(simp add: lookupd_freshness)
  4211 apply(simp add: lookupd_freshness)
  4212 apply(simp add: lookupc_freshness)
  4212 apply(simp add: lookupc_freshness)
  4213 apply(simp add: lookupd_freshness)
  4213 apply(simp add: lookupd_freshness)
  4214 apply(simp)
  4214 apply(simp)
  4215 apply(case_tac "findc \<theta>c coname")
  4215 apply(case_tac "findc \<theta>_c coname")
  4216 apply(auto simp add: abs_fresh)[1]
  4216 apply(auto simp add: abs_fresh)[1]
  4217 apply(auto)[1]
  4217 apply(auto)[1]
  4218 apply(generate_fresh "coname")
  4218 apply(generate_fresh "coname")
  4219 apply(fresh_fun_simp)
  4219 apply(fresh_fun_simp)
  4220 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4220 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4221 apply(simp)
  4221 apply(simp)
  4222 apply(case_tac "findn \<theta>n name")
  4222 apply(case_tac "findn \<theta>_n name")
  4223 apply(auto simp add: abs_fresh)[1]
  4223 apply(auto simp add: abs_fresh)[1]
  4224 apply(auto)[1]
  4224 apply(auto)[1]
  4225 apply(generate_fresh "name")
  4225 apply(generate_fresh "name")
  4226 apply(fresh_fun_simp)
  4226 apply(fresh_fun_simp)
  4227 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4227 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4228 apply(simp)
  4228 apply(simp)
  4229 apply(case_tac "findc \<theta>c coname3")
  4229 apply(case_tac "findc \<theta>_c coname3")
  4230 apply(auto simp add: abs_fresh)[1]
  4230 apply(auto simp add: abs_fresh)[1]
  4231 apply(auto)[1]
  4231 apply(auto)[1]
  4232 apply(generate_fresh "coname")
  4232 apply(generate_fresh "coname")
  4233 apply(fresh_fun_simp)
  4233 apply(fresh_fun_simp)
  4234 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4234 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4235 apply(simp)
  4235 apply(simp)
  4236 apply(case_tac "findn \<theta>n name2")
  4236 apply(case_tac "findn \<theta>_n name2")
  4237 apply(auto simp add: abs_fresh)[1]
  4237 apply(auto simp add: abs_fresh)[1]
  4238 apply(auto)[1]
  4238 apply(auto)[1]
  4239 apply(generate_fresh "name")
  4239 apply(generate_fresh "name")
  4240 apply(fresh_fun_simp)
  4240 apply(fresh_fun_simp)
  4241 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4241 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4242 apply(simp)
  4242 apply(simp)
  4243 apply(case_tac "findn \<theta>n name2")
  4243 apply(case_tac "findn \<theta>_n name2")
  4244 apply(auto simp add: abs_fresh)[1]
  4244 apply(auto simp add: abs_fresh)[1]
  4245 apply(auto)[1]
  4245 apply(auto)[1]
  4246 apply(generate_fresh "name")
  4246 apply(generate_fresh "name")
  4247 apply(fresh_fun_simp)
  4247 apply(fresh_fun_simp)
  4248 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4248 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4249 apply(simp)
  4249 apply(simp)
  4250 apply(case_tac "findc \<theta>c coname2")
  4250 apply(case_tac "findc \<theta>_c coname2")
  4251 apply(auto simp add: abs_fresh)[1]
  4251 apply(auto simp add: abs_fresh)[1]
  4252 apply(auto)[1]
  4252 apply(auto)[1]
  4253 apply(generate_fresh "coname")
  4253 apply(generate_fresh "coname")
  4254 apply(fresh_fun_simp)
  4254 apply(fresh_fun_simp)
  4255 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4255 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4256 apply(simp)
  4256 apply(simp)
  4257 apply(case_tac "findc \<theta>c coname2")
  4257 apply(case_tac "findc \<theta>_c coname2")
  4258 apply(auto simp add: abs_fresh)[1]
  4258 apply(auto simp add: abs_fresh)[1]
  4259 apply(auto)[1]
  4259 apply(auto)[1]
  4260 apply(generate_fresh "coname")
  4260 apply(generate_fresh "coname")
  4261 apply(fresh_fun_simp)
  4261 apply(fresh_fun_simp)
  4262 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4262 apply(simp add: abs_fresh fresh_prod fresh_atm cmaps_fresh)
  4263 apply(simp)
  4263 apply(simp)
  4264 apply(case_tac "findn \<theta>n name3")
  4264 apply(case_tac "findn \<theta>_n name3")
  4265 apply(auto simp add: abs_fresh)[1]
  4265 apply(auto simp add: abs_fresh)[1]
  4266 apply(auto)[1]
  4266 apply(auto)[1]
  4267 apply(generate_fresh "name")
  4267 apply(generate_fresh "name")
  4268 apply(fresh_fun_simp)
  4268 apply(fresh_fun_simp)
  4269 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4269 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4270 apply(simp)
  4270 apply(simp)
  4271 apply(case_tac "findc \<theta>c coname2")
  4271 apply(case_tac "findc \<theta>_c coname2")
  4272 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4272 apply(auto simp add: abs_fresh abs_supp fin_supp)[1]
  4273 apply(auto)[1]
  4273 apply(auto)[1]
  4274 apply(generate_fresh "coname")
  4274 apply(generate_fresh "coname")
  4275 apply(fresh_fun_simp)
  4275 apply(fresh_fun_simp)
  4276 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4276 apply(simp add: abs_fresh abs_supp fin_supp fresh_prod fresh_atm cmaps_fresh)
  4277 apply(simp)
  4277 apply(simp)
  4278 apply(case_tac "findn \<theta>n name2")
  4278 apply(case_tac "findn \<theta>_n name2")
  4279 apply(auto simp add: abs_fresh)[1]
  4279 apply(auto simp add: abs_fresh)[1]
  4280 apply(auto)[1]
  4280 apply(auto)[1]
  4281 apply(generate_fresh "name")
  4281 apply(generate_fresh "name")
  4282 apply(fresh_fun_simp)
  4282 apply(fresh_fun_simp)
  4283 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4283 apply(simp add: abs_fresh fresh_prod fresh_atm nmaps_fresh)
  4284 done
  4284 done
  4285 
  4285 
  4286 lemma psubst_csubst:
  4286 lemma psubst_csubst:
  4287   assumes a: "a\<sharp>(\<theta>n,\<theta>c)"
  4287   assumes a: "a\<sharp>(\<theta>_n,\<theta>_c)"
  4288   shows "\<theta>n,((a,x,P)#\<theta>c)<M> = ((\<theta>n,\<theta>c<M>){a:=(x).P})"
  4288   shows "\<theta>_n,((a,x,P)#\<theta>_c)<M> = ((\<theta>_n,\<theta>_c<M>){a:=(x).P})"
  4289 using a
  4289 using a
  4290 apply(nominal_induct M avoiding: a x \<theta>n \<theta>c P rule: trm.strong_induct)
  4290 apply(nominal_induct M avoiding: a x \<theta>_n \<theta>_c P rule: trm.strong_induct)
  4291 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4291 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4292 apply(simp add: lookup_csubst)
  4292 apply(simp add: lookup_csubst)
  4293 apply(simp add: fresh_list_cons fresh_prod)
  4293 apply(simp add: fresh_list_cons fresh_prod)
  4294 apply(auto)[1]
  4294 apply(auto)[1]
  4295 apply(rule sym)
  4295 apply(rule sym)
  4296 apply(rule trans)
  4296 apply(rule trans)
  4297 apply(rule better_Cut_substc)
  4297 apply(rule better_Cut_substc)
  4298 apply(simp)
  4298 apply(simp)
  4299 apply(simp add: abs_fresh fresh_atm)
  4299 apply(simp add: abs_fresh fresh_atm)
  4300 apply(simp add: lookupd_fresh)
  4300 apply(simp add: lookupd_fresh)
  4301 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>n")
  4301 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4302 apply(simp add: forget)
  4302 apply(simp add: forget)
  4303 apply(simp add: trm.inject)
  4303 apply(simp add: trm.inject)
  4304 apply(rule sym)
  4304 apply(rule sym)
  4305 apply(simp add: alpha nrename_swap fresh_atm)
  4305 apply(simp add: alpha nrename_swap fresh_atm)
  4306 apply(rule lookupc_freshness)
  4306 apply(rule lookupc_freshness)
  4313 apply(simp)
  4313 apply(simp)
  4314 apply(rule conjI)
  4314 apply(rule conjI)
  4315 apply(rule impI)
  4315 apply(rule impI)
  4316 apply(simp add: lookupd_unicity)
  4316 apply(simp add: lookupd_unicity)
  4317 apply(rule impI)
  4317 apply(rule impI)
  4318 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>n")
  4318 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4319 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>c")
  4319 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>_c")
  4320 apply(simp add: forget)
  4320 apply(simp add: forget)
  4321 apply(rule lookupd_freshness)
  4321 apply(rule lookupd_freshness)
  4322 apply(simp add: fresh_atm)
  4322 apply(simp add: fresh_atm)
  4323 apply(rule lookupc_freshness)
  4323 apply(rule lookupc_freshness)
  4324 apply(simp add: fresh_atm)
  4324 apply(simp add: fresh_atm)
  4333 apply(drule ax_psubst)
  4333 apply(drule ax_psubst)
  4334 apply(simp)
  4334 apply(simp)
  4335 apply(simp)
  4335 apply(simp)
  4336 apply(blast)
  4336 apply(blast)
  4337 apply(rule impI)
  4337 apply(rule impI)
  4338 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>n")
  4338 apply(subgoal_tac "a\<sharp>lookupc xa coname \<theta>_n")
  4339 apply(simp add: forget)
  4339 apply(simp add: forget)
  4340 apply(rule lookupc_freshness)
  4340 apply(rule lookupc_freshness)
  4341 apply(simp add: fresh_atm)
  4341 apply(simp add: fresh_atm)
  4342 apply(rule sym)
  4342 apply(rule sym)
  4343 apply(rule trans)
  4343 apply(rule trans)
  4360 apply(simp)
  4360 apply(simp)
  4361 apply(rule conjI)
  4361 apply(rule conjI)
  4362 apply(rule impI)
  4362 apply(rule impI)
  4363 apply(simp add: lookupd_unicity)
  4363 apply(simp add: lookupd_unicity)
  4364 apply(rule impI)
  4364 apply(rule impI)
  4365 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>c")
  4365 apply(subgoal_tac "a\<sharp>lookupd name aa \<theta>_c")
  4366 apply(simp add: forget)
  4366 apply(simp add: forget)
  4367 apply(rule lookupd_freshness)
  4367 apply(rule lookupd_freshness)
  4368 apply(simp add: fresh_atm)
  4368 apply(simp add: fresh_atm)
  4369 apply(rule sym)
  4369 apply(rule sym)
  4370 apply(rule trans)
  4370 apply(rule trans)
  4377 apply(simp)
  4377 apply(simp)
  4378 apply(simp)
  4378 apply(simp)
  4379 apply(blast)
  4379 apply(blast)
  4380 (* NotR *)
  4380 (* NotR *)
  4381 apply(simp)
  4381 apply(simp)
  4382 apply(case_tac "findc \<theta>c coname")
  4382 apply(case_tac "findc \<theta>_c coname")
  4383 apply(simp)
  4383 apply(simp)
  4384 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4384 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4385 apply(simp)
  4385 apply(simp)
  4386 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4386 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4387 apply(drule cmaps_false)
  4387 apply(drule cmaps_false)
  4396 apply(simp)
  4396 apply(simp)
  4397 apply(simp add: cmaps_fresh)
  4397 apply(simp add: cmaps_fresh)
  4398 apply(auto simp add: fresh_prod fresh_atm)[1]
  4398 apply(auto simp add: fresh_prod fresh_atm)[1]
  4399 (* NotL *)
  4399 (* NotL *)
  4400 apply(simp)
  4400 apply(simp)
  4401 apply(case_tac "findn \<theta>n name")
  4401 apply(case_tac "findn \<theta>_n name")
  4402 apply(simp)
  4402 apply(simp)
  4403 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4403 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4404 apply(simp)
  4404 apply(simp)
  4405 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4405 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4406 apply(generate_fresh "name")
  4406 apply(generate_fresh "name")
  4415 apply(simp)
  4415 apply(simp)
  4416 apply(simp)
  4416 apply(simp)
  4417 apply(simp)
  4417 apply(simp)
  4418 (* AndR *)
  4418 (* AndR *)
  4419 apply(simp)
  4419 apply(simp)
  4420 apply(case_tac "findc \<theta>c coname3")
  4420 apply(case_tac "findc \<theta>_c coname3")
  4421 apply(simp)
  4421 apply(simp)
  4422 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4422 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4423 apply(simp)
  4423 apply(simp)
  4424 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4424 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4425 apply(drule cmaps_false)
  4425 apply(drule cmaps_false)
  4434 apply(simp)
  4434 apply(simp)
  4435 apply(simp add: cmaps_fresh)
  4435 apply(simp add: cmaps_fresh)
  4436 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4436 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4437 (* AndL1 *)
  4437 (* AndL1 *)
  4438 apply(simp)
  4438 apply(simp)
  4439 apply(case_tac "findn \<theta>n name2")
  4439 apply(case_tac "findn \<theta>_n name2")
  4440 apply(simp)
  4440 apply(simp)
  4441 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4441 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4442 apply(simp)
  4442 apply(simp)
  4443 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4443 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4444 apply(generate_fresh "name")
  4444 apply(generate_fresh "name")
  4453 apply(simp)
  4453 apply(simp)
  4454 apply(simp)
  4454 apply(simp)
  4455 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4455 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4456 (* AndL2 *)
  4456 (* AndL2 *)
  4457 apply(simp)
  4457 apply(simp)
  4458 apply(case_tac "findn \<theta>n name2")
  4458 apply(case_tac "findn \<theta>_n name2")
  4459 apply(simp)
  4459 apply(simp)
  4460 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4460 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4461 apply(simp)
  4461 apply(simp)
  4462 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4462 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4463 apply(generate_fresh "name")
  4463 apply(generate_fresh "name")
  4472 apply(simp)
  4472 apply(simp)
  4473 apply(simp)
  4473 apply(simp)
  4474 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4474 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4475 (* OrR1 *)
  4475 (* OrR1 *)
  4476 apply(simp)
  4476 apply(simp)
  4477 apply(case_tac "findc \<theta>c coname2")
  4477 apply(case_tac "findc \<theta>_c coname2")
  4478 apply(simp)
  4478 apply(simp)
  4479 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4479 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4480 apply(simp)
  4480 apply(simp)
  4481 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4481 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4482 apply(drule cmaps_false)
  4482 apply(drule cmaps_false)
  4491 apply(simp)
  4491 apply(simp)
  4492 apply(simp add: cmaps_fresh)
  4492 apply(simp add: cmaps_fresh)
  4493 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4493 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4494 (* OrR2 *)
  4494 (* OrR2 *)
  4495 apply(simp)
  4495 apply(simp)
  4496 apply(case_tac "findc \<theta>c coname2")
  4496 apply(case_tac "findc \<theta>_c coname2")
  4497 apply(simp)
  4497 apply(simp)
  4498 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4498 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4499 apply(simp)
  4499 apply(simp)
  4500 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4500 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4501 apply(drule cmaps_false)
  4501 apply(drule cmaps_false)
  4510 apply(simp)
  4510 apply(simp)
  4511 apply(simp add: cmaps_fresh)
  4511 apply(simp add: cmaps_fresh)
  4512 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4512 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4513 (* OrL *)
  4513 (* OrL *)
  4514 apply(simp)
  4514 apply(simp)
  4515 apply(case_tac "findn \<theta>n name3")
  4515 apply(case_tac "findn \<theta>_n name3")
  4516 apply(simp)
  4516 apply(simp)
  4517 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4517 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4518 apply(simp)
  4518 apply(simp)
  4519 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4519 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4520 apply(generate_fresh "name")
  4520 apply(generate_fresh "name")
  4529 apply(simp)
  4529 apply(simp)
  4530 apply(simp)
  4530 apply(simp)
  4531 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4531 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4532 (* ImpR *)
  4532 (* ImpR *)
  4533 apply(simp)
  4533 apply(simp)
  4534 apply(case_tac "findc \<theta>c coname2")
  4534 apply(case_tac "findc \<theta>_c coname2")
  4535 apply(simp)
  4535 apply(simp)
  4536 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4536 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4537 apply(simp)
  4537 apply(simp)
  4538 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4538 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4539 apply(drule cmaps_false)
  4539 apply(drule cmaps_false)
  4548 apply(simp)
  4548 apply(simp)
  4549 apply(simp add: cmaps_fresh)
  4549 apply(simp add: cmaps_fresh)
  4550 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4550 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4551 (* ImpL *)
  4551 (* ImpL *)
  4552 apply(simp)
  4552 apply(simp)
  4553 apply(case_tac "findn \<theta>n name2")
  4553 apply(case_tac "findn \<theta>_n name2")
  4554 apply(simp)
  4554 apply(simp)
  4555 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4555 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4556 apply(simp)
  4556 apply(simp)
  4557 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4557 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4558 apply(generate_fresh "name")
  4558 apply(generate_fresh "name")
  4569 apply(simp)
  4569 apply(simp)
  4570 apply(auto simp add: psubst_fresh_coname psubst_fresh_name fresh_prod fresh_atm)[1]
  4570 apply(auto simp add: psubst_fresh_coname psubst_fresh_name fresh_prod fresh_atm)[1]
  4571 done
  4571 done
  4572 
  4572 
  4573 lemma psubst_nsubst:
  4573 lemma psubst_nsubst:
  4574   assumes a: "x\<sharp>(\<theta>n,\<theta>c)"
  4574   assumes a: "x\<sharp>(\<theta>_n,\<theta>_c)"
  4575   shows "((x,a,P)#\<theta>n),\<theta>c<M> = ((\<theta>n,\<theta>c<M>){x:=<a>.P})"
  4575   shows "((x,a,P)#\<theta>_n),\<theta>_c<M> = ((\<theta>_n,\<theta>_c<M>){x:=<a>.P})"
  4576 using a
  4576 using a
  4577 apply(nominal_induct M avoiding: a x \<theta>n \<theta>c P rule: trm.strong_induct)
  4577 apply(nominal_induct M avoiding: a x \<theta>_n \<theta>_c P rule: trm.strong_induct)
  4578 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4578 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4579 apply(simp add: lookup_fresh)
  4579 apply(simp add: lookup_fresh)
  4580 apply(rule lookupb_lookupa)
  4580 apply(rule lookupb_lookupa)
  4581 apply(simp)
  4581 apply(simp)
  4582 apply(rule sym)
  4582 apply(rule sym)
  4589 apply(rule trans)
  4589 apply(rule trans)
  4590 apply(rule better_Cut_substn)
  4590 apply(rule better_Cut_substn)
  4591 apply(simp add: abs_fresh)
  4591 apply(simp add: abs_fresh)
  4592 apply(simp add: abs_fresh fresh_atm)
  4592 apply(simp add: abs_fresh fresh_atm)
  4593 apply(simp add: lookupd_fresh)
  4593 apply(simp add: lookupd_fresh)
  4594 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>c")
  4594 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4595 apply(simp add: forget)
  4595 apply(simp add: forget)
  4596 apply(simp add: trm.inject)
  4596 apply(simp add: trm.inject)
  4597 apply(rule sym)
  4597 apply(rule sym)
  4598 apply(simp add: alpha crename_swap fresh_atm)
  4598 apply(simp add: alpha crename_swap fresh_atm)
  4599 apply(rule lookupd_freshness)
  4599 apply(rule lookupd_freshness)
  4606 apply(simp)
  4606 apply(simp)
  4607 apply(rule conjI)
  4607 apply(rule conjI)
  4608 apply(rule impI)
  4608 apply(rule impI)
  4609 apply(simp add: lookupc_unicity)
  4609 apply(simp add: lookupc_unicity)
  4610 apply(rule impI)
  4610 apply(rule impI)
  4611 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>n")
  4611 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>_n")
  4612 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>c")
  4612 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4613 apply(simp add: forget)
  4613 apply(simp add: forget)
  4614 apply(rule lookupd_freshness)
  4614 apply(rule lookupd_freshness)
  4615 apply(simp add: fresh_atm)
  4615 apply(simp add: fresh_atm)
  4616 apply(rule lookupc_freshness)
  4616 apply(rule lookupc_freshness)
  4617 apply(simp add: fresh_atm)
  4617 apply(simp add: fresh_atm)
  4636 apply(simp)
  4636 apply(simp)
  4637 apply(rule conjI)
  4637 apply(rule conjI)
  4638 apply(rule impI)
  4638 apply(rule impI)
  4639 apply(simp add: lookupc_unicity)
  4639 apply(simp add: lookupc_unicity)
  4640 apply(rule impI)
  4640 apply(rule impI)
  4641 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>n")
  4641 apply(subgoal_tac "x\<sharp>lookupc xa coname \<theta>_n")
  4642 apply(simp add: forget)
  4642 apply(simp add: forget)
  4643 apply(rule lookupc_freshness)
  4643 apply(rule lookupc_freshness)
  4644 apply(simp add: fresh_prod fresh_atm)
  4644 apply(simp add: fresh_prod fresh_atm)
  4645 apply(rule sym)
  4645 apply(rule sym)
  4646 apply(rule trans)
  4646 apply(rule trans)
  4654 apply(simp)
  4654 apply(simp)
  4655 apply(simp)
  4655 apply(simp)
  4656 apply(simp)
  4656 apply(simp)
  4657 apply(blast)
  4657 apply(blast)
  4658 apply(rule impI)
  4658 apply(rule impI)
  4659 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>c")
  4659 apply(subgoal_tac "x\<sharp>lookupd name aa \<theta>_c")
  4660 apply(simp add: forget)
  4660 apply(simp add: forget)
  4661 apply(rule lookupd_freshness)
  4661 apply(rule lookupd_freshness)
  4662 apply(simp add: fresh_atm)
  4662 apply(simp add: fresh_atm)
  4663 apply(rule sym)
  4663 apply(rule sym)
  4664 apply(rule trans)
  4664 apply(rule trans)
  4671 apply(simp)
  4671 apply(simp)
  4672 apply(simp)
  4672 apply(simp)
  4673 apply(blast)
  4673 apply(blast)
  4674 (* NotR *)
  4674 (* NotR *)
  4675 apply(simp)
  4675 apply(simp)
  4676 apply(case_tac "findc \<theta>c coname")
  4676 apply(case_tac "findc \<theta>_c coname")
  4677 apply(simp)
  4677 apply(simp)
  4678 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4678 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4679 apply(simp)
  4679 apply(simp)
  4680 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4680 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4681 apply(generate_fresh "coname")
  4681 apply(generate_fresh "coname")
  4688 apply(simp)
  4688 apply(simp)
  4689 apply(simp)
  4689 apply(simp)
  4690 apply(simp)
  4690 apply(simp)
  4691 (* NotL *)
  4691 (* NotL *)
  4692 apply(simp)
  4692 apply(simp)
  4693 apply(case_tac "findn \<theta>n name")
  4693 apply(case_tac "findn \<theta>_n name")
  4694 apply(simp)
  4694 apply(simp)
  4695 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4695 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4696 apply(simp)
  4696 apply(simp)
  4697 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4697 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4698 apply(drule nmaps_false)
  4698 apply(drule nmaps_false)
  4707 apply(simp)
  4707 apply(simp)
  4708 apply(simp add: nmaps_fresh)
  4708 apply(simp add: nmaps_fresh)
  4709 apply(simp add: fresh_prod fresh_atm)
  4709 apply(simp add: fresh_prod fresh_atm)
  4710 (* AndR *)
  4710 (* AndR *)
  4711 apply(simp)
  4711 apply(simp)
  4712 apply(case_tac "findc \<theta>c coname3")
  4712 apply(case_tac "findc \<theta>_c coname3")
  4713 apply(simp)
  4713 apply(simp)
  4714 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4714 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4715 apply(simp)
  4715 apply(simp)
  4716 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4716 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4717 apply(generate_fresh "coname")
  4717 apply(generate_fresh "coname")
  4724 apply(simp)
  4724 apply(simp)
  4725 apply(simp)
  4725 apply(simp)
  4726 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4726 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4727 (* AndL1 *)
  4727 (* AndL1 *)
  4728 apply(simp)
  4728 apply(simp)
  4729 apply(case_tac "findn \<theta>n name2")
  4729 apply(case_tac "findn \<theta>_n name2")
  4730 apply(simp)
  4730 apply(simp)
  4731 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4731 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4732 apply(simp)
  4732 apply(simp)
  4733 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4733 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4734 apply(drule nmaps_false)
  4734 apply(drule nmaps_false)
  4743 apply(simp)
  4743 apply(simp)
  4744 apply(simp add: nmaps_fresh)
  4744 apply(simp add: nmaps_fresh)
  4745 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4745 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4746 (* AndL2 *)
  4746 (* AndL2 *)
  4747 apply(simp)
  4747 apply(simp)
  4748 apply(case_tac "findn \<theta>n name2")
  4748 apply(case_tac "findn \<theta>_n name2")
  4749 apply(simp)
  4749 apply(simp)
  4750 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4750 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4751 apply(simp)
  4751 apply(simp)
  4752 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4752 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4753 apply(drule nmaps_false)
  4753 apply(drule nmaps_false)
  4762 apply(simp)
  4762 apply(simp)
  4763 apply(simp add: nmaps_fresh)
  4763 apply(simp add: nmaps_fresh)
  4764 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4764 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4765 (* OrR1 *)
  4765 (* OrR1 *)
  4766 apply(simp)
  4766 apply(simp)
  4767 apply(case_tac "findc \<theta>c coname2")
  4767 apply(case_tac "findc \<theta>_c coname2")
  4768 apply(simp)
  4768 apply(simp)
  4769 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4769 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4770 apply(simp)
  4770 apply(simp)
  4771 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4771 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4772 apply(generate_fresh "coname")
  4772 apply(generate_fresh "coname")
  4779 apply(simp)
  4779 apply(simp)
  4780 apply(simp)
  4780 apply(simp)
  4781 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4781 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4782 (* OrR2 *)
  4782 (* OrR2 *)
  4783 apply(simp)
  4783 apply(simp)
  4784 apply(case_tac "findc \<theta>c coname2")
  4784 apply(case_tac "findc \<theta>_c coname2")
  4785 apply(simp)
  4785 apply(simp)
  4786 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4786 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4787 apply(simp)
  4787 apply(simp)
  4788 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4788 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4789 apply(generate_fresh "coname")
  4789 apply(generate_fresh "coname")
  4796 apply(simp)
  4796 apply(simp)
  4797 apply(simp)
  4797 apply(simp)
  4798 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4798 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4799 (* OrL *)
  4799 (* OrL *)
  4800 apply(simp)
  4800 apply(simp)
  4801 apply(case_tac "findn \<theta>n name3")
  4801 apply(case_tac "findn \<theta>_n name3")
  4802 apply(simp)
  4802 apply(simp)
  4803 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4803 apply(auto simp add: fresh_list_cons psubst_fresh_name fresh_atm fresh_prod)[1]
  4804 apply(simp)
  4804 apply(simp)
  4805 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4805 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4806 apply(drule nmaps_false)
  4806 apply(drule nmaps_false)
  4815 apply(simp)
  4815 apply(simp)
  4816 apply(simp add: nmaps_fresh)
  4816 apply(simp add: nmaps_fresh)
  4817 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4817 apply(auto simp add:  psubst_fresh_name fresh_prod fresh_atm)[1]
  4818 (* ImpR *)
  4818 (* ImpR *)
  4819 apply(simp)
  4819 apply(simp)
  4820 apply(case_tac "findc \<theta>c coname2")
  4820 apply(case_tac "findc \<theta>_c coname2")
  4821 apply(simp)
  4821 apply(simp)
  4822 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4822 apply(auto simp add: psubst_fresh_coname fresh_list_cons fresh_prod fresh_atm)[1]
  4823 apply(simp)
  4823 apply(simp)
  4824 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4824 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4825 apply(generate_fresh "coname")
  4825 apply(generate_fresh "coname")
  4832 apply(simp)
  4832 apply(simp)
  4833 apply(simp)
  4833 apply(simp)
  4834 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4834 apply(auto simp add:  psubst_fresh_coname fresh_prod fresh_atm)[1]
  4835 (* ImpL *)
  4835 (* ImpL *)
  4836 apply(simp)
  4836 apply(simp)
  4837 apply(case_tac "findn \<theta>n name2")
  4837 apply(case_tac "findn \<theta>_n name2")
  4838 apply(simp)
  4838 apply(simp)
  4839 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4839 apply(auto simp add: fresh_list_cons psubst_fresh_coname psubst_fresh_name fresh_atm fresh_prod)[1]
  4840 apply(simp)
  4840 apply(simp)
  4841 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4841 apply(auto simp add: fresh_list_cons fresh_prod)[1]
  4842 apply(drule nmaps_false)
  4842 apply(drule nmaps_false)
  4854 done
  4854 done
  4855 
  4855 
  4856 definition 
  4856 definition 
  4857   ncloses :: "(name\<times>coname\<times>trm) list\<Rightarrow>(name\<times>ty) list \<Rightarrow> bool" ("_ ncloses _" [55,55] 55) 
  4857   ncloses :: "(name\<times>coname\<times>trm) list\<Rightarrow>(name\<times>ty) list \<Rightarrow> bool" ("_ ncloses _" [55,55] 55) 
  4858 where
  4858 where
  4859   "\<theta>n ncloses \<Gamma> \<equiv> \<forall>x B. ((x,B) \<in> set \<Gamma> \<longrightarrow> (\<exists>c P. \<theta>n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)))"
  4859   "\<theta>_n ncloses \<Gamma> \<equiv> \<forall>x B. ((x,B) \<in> set \<Gamma> \<longrightarrow> (\<exists>c P. \<theta>_n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)))"
  4860   
  4860   
  4861 definition 
  4861 definition 
  4862   ccloses :: "(coname\<times>name\<times>trm) list\<Rightarrow>(coname\<times>ty) list \<Rightarrow> bool" ("_ ccloses _" [55,55] 55) 
  4862   ccloses :: "(coname\<times>name\<times>trm) list\<Rightarrow>(coname\<times>ty) list \<Rightarrow> bool" ("_ ccloses _" [55,55] 55) 
  4863 where
  4863 where
  4864   "\<theta>c ccloses \<Delta> \<equiv> \<forall>a B. ((a,B) \<in> set \<Delta> \<longrightarrow> (\<exists>x P. \<theta>c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)))"
  4864   "\<theta>_c ccloses \<Delta> \<equiv> \<forall>a B. ((a,B) \<in> set \<Delta> \<longrightarrow> (\<exists>x P. \<theta>_c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)))"
  4865 
  4865 
  4866 lemma ncloses_elim:
  4866 lemma ncloses_elim:
  4867   assumes a: "(x,B) \<in> set \<Gamma>"
  4867   assumes a: "(x,B) \<in> set \<Gamma>"
  4868   and     b: "\<theta>n ncloses \<Gamma>"
  4868   and     b: "\<theta>_n ncloses \<Gamma>"
  4869   shows "\<exists>c P. \<theta>n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)"
  4869   shows "\<exists>c P. \<theta>_n nmaps x to Some (c,P) \<and> <c>:P \<in> (\<parallel><B>\<parallel>)"
  4870 using a b by (auto simp add: ncloses_def)
  4870 using a b by (auto simp add: ncloses_def)
  4871 
  4871 
  4872 lemma ccloses_elim:
  4872 lemma ccloses_elim:
  4873   assumes a: "(a,B) \<in> set \<Delta>"
  4873   assumes a: "(a,B) \<in> set \<Delta>"
  4874   and     b: "\<theta>c ccloses \<Delta>"
  4874   and     b: "\<theta>_c ccloses \<Delta>"
  4875   shows "\<exists>x P. \<theta>c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)"
  4875   shows "\<exists>x P. \<theta>_c cmaps a to Some (x,P) \<and> (x):P \<in> (\<parallel>(B)\<parallel>)"
  4876 using a b by (auto simp add: ccloses_def)
  4876 using a b by (auto simp add: ccloses_def)
  4877 
  4877 
  4878 lemma ncloses_subset:
  4878 lemma ncloses_subset:
  4879   assumes a: "\<theta>n ncloses \<Gamma>"
  4879   assumes a: "\<theta>_n ncloses \<Gamma>"
  4880   and     b: "set \<Gamma>' \<subseteq> set \<Gamma>"
  4880   and     b: "set \<Gamma>' \<subseteq> set \<Gamma>"
  4881   shows "\<theta>n ncloses \<Gamma>'"
  4881   shows "\<theta>_n ncloses \<Gamma>'"
  4882 using a b by (auto  simp add: ncloses_def)
  4882 using a b by (auto  simp add: ncloses_def)
  4883 
  4883 
  4884 lemma ccloses_subset:
  4884 lemma ccloses_subset:
  4885   assumes a: "\<theta>c ccloses \<Delta>"
  4885   assumes a: "\<theta>_c ccloses \<Delta>"
  4886   and     b: "set \<Delta>' \<subseteq> set \<Delta>"
  4886   and     b: "set \<Delta>' \<subseteq> set \<Delta>"
  4887   shows "\<theta>c ccloses \<Delta>'"
  4887   shows "\<theta>_c ccloses \<Delta>'"
  4888 using a b by (auto  simp add: ccloses_def)
  4888 using a b by (auto  simp add: ccloses_def)
  4889 
  4889 
  4890 lemma validc_fresh:
  4890 lemma validc_fresh:
  4891   fixes a::"coname"
  4891   fixes a::"coname"
  4892   and   \<Delta>::"(coname\<times>ty) list"
  4892   and   \<Delta>::"(coname\<times>ty) list"
  4906 apply(induct \<Gamma>)
  4906 apply(induct \<Gamma>)
  4907 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  4907 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  4908 done
  4908 done
  4909 
  4909 
  4910 lemma ccloses_extend:
  4910 lemma ccloses_extend:
  4911   assumes a: "\<theta>c ccloses \<Delta>" "a\<sharp>\<Delta>" "a\<sharp>\<theta>c" "(x):P\<in>\<parallel>(B)\<parallel>"
  4911   assumes a: "\<theta>_c ccloses \<Delta>" "a\<sharp>\<Delta>" "a\<sharp>\<theta>_c" "(x):P\<in>\<parallel>(B)\<parallel>"
  4912   shows "(a,x,P)#\<theta>c ccloses (a,B)#\<Delta>"
  4912   shows "(a,x,P)#\<theta>_c ccloses (a,B)#\<Delta>"
  4913 using a
  4913 using a
  4914 apply(simp add: ccloses_def)
  4914 apply(simp add: ccloses_def)
  4915 apply(drule validc_fresh)
  4915 apply(drule validc_fresh)
  4916 apply(auto)
  4916 apply(auto)
  4917 done
  4917 done
  4918 
  4918 
  4919 lemma ncloses_extend:
  4919 lemma ncloses_extend:
  4920   assumes a: "\<theta>n ncloses \<Gamma>" "x\<sharp>\<Gamma>" "x\<sharp>\<theta>n" "<a>:P\<in>\<parallel><B>\<parallel>"
  4920   assumes a: "\<theta>_n ncloses \<Gamma>" "x\<sharp>\<Gamma>" "x\<sharp>\<theta>_n" "<a>:P\<in>\<parallel><B>\<parallel>"
  4921   shows "(x,a,P)#\<theta>n ncloses (x,B)#\<Gamma>"
  4921   shows "(x,a,P)#\<theta>_n ncloses (x,B)#\<Gamma>"
  4922 using a
  4922 using a
  4923 apply(simp add: ncloses_def)
  4923 apply(simp add: ncloses_def)
  4924 apply(drule validn_fresh)
  4924 apply(drule validn_fresh)
  4925 apply(auto)
  4925 apply(auto)
  4926 done
  4926 done
  5080 apply(simp_all add: trm.inject)
  5080 apply(simp_all add: trm.inject)
  5081 apply(auto  dest!: validn_elim context_fresh)
  5081 apply(auto  dest!: validn_elim context_fresh)
  5082 done
  5082 done
  5083 
  5083 
  5084 lemma psubst_Ax_aux: 
  5084 lemma psubst_Ax_aux: 
  5085   assumes a: "\<theta>c cmaps a to Some (y,N)"
  5085   assumes a: "\<theta>_c cmaps a to Some (y,N)"
  5086   shows "lookupb x a \<theta>c c P = Cut <c>.P (y).N"
  5086   shows "lookupb x a \<theta>_c c P = Cut <c>.P (y).N"
  5087 using a
  5087 using a
  5088 apply(induct \<theta>c)
  5088 apply(induct \<theta>_c)
  5089 apply(auto)
  5089 apply(auto)
  5090 done
  5090 done
  5091 
  5091 
  5092 lemma psubst_Ax:
  5092 lemma psubst_Ax:
  5093   assumes a: "\<theta>n nmaps x to Some (c,P)"
  5093   assumes a: "\<theta>_n nmaps x to Some (c,P)"
  5094   and     b: "\<theta>c cmaps a to Some (y,N)"
  5094   and     b: "\<theta>_c cmaps a to Some (y,N)"
  5095   shows "\<theta>n,\<theta>c<Ax x a> = Cut <c>.P (y).N"
  5095   shows "\<theta>_n,\<theta>_c<Ax x a> = Cut <c>.P (y).N"
  5096 using a b
  5096 using a b
  5097 apply(induct \<theta>n)
  5097 apply(induct \<theta>_n)
  5098 apply(auto simp add: psubst_Ax_aux)
  5098 apply(auto simp add: psubst_Ax_aux)
  5099 done
  5099 done
  5100 
  5100 
  5101 lemma psubst_Cut:
  5101 lemma psubst_Cut:
  5102   assumes a: "\<forall>x. M\<noteq>Ax x c"
  5102   assumes a: "\<forall>x. M\<noteq>Ax x c"
  5103   and     b: "\<forall>a. N\<noteq>Ax x a"
  5103   and     b: "\<forall>a. N\<noteq>Ax x a"
  5104   and     c: "c\<sharp>(\<theta>n,\<theta>c,N)" "x\<sharp>(\<theta>n,\<theta>c,M)"
  5104   and     c: "c\<sharp>(\<theta>_n,\<theta>_c,N)" "x\<sharp>(\<theta>_n,\<theta>_c,M)"
  5105   shows "\<theta>n,\<theta>c<Cut <c>.M (x).N> = Cut <c>.(\<theta>n,\<theta>c<M>) (x).(\<theta>n,\<theta>c<N>)"
  5105   shows "\<theta>_n,\<theta>_c<Cut <c>.M (x).N> = Cut <c>.(\<theta>_n,\<theta>_c<M>) (x).(\<theta>_n,\<theta>_c<N>)"
  5106 using a b c
  5106 using a b c
  5107 apply(simp)
  5107 apply(simp)
  5108 done
  5108 done
  5109 
  5109 
  5110 lemma all_CAND: 
  5110 lemma all_CAND: 
  5111   assumes a: "\<Gamma> \<turnstile> M \<turnstile> \<Delta>"
  5111   assumes a: "\<Gamma> \<turnstile> M \<turnstile> \<Delta>"
  5112   and     b: "\<theta>n ncloses \<Gamma>"
  5112   and     b: "\<theta>_n ncloses \<Gamma>"
  5113   and     c: "\<theta>c ccloses \<Delta>"
  5113   and     c: "\<theta>_c ccloses \<Delta>"
  5114   shows "SNa (\<theta>n,\<theta>c<M>)"
  5114   shows "SNa (\<theta>_n,\<theta>_c<M>)"
  5115 using a b c
  5115 using a b c
  5116 proof(nominal_induct avoiding: \<theta>n \<theta>c rule: typing.strong_induct)
  5116 proof(nominal_induct avoiding: \<theta>_n \<theta>_c rule: typing.strong_induct)
  5117   case (TAx \<Gamma> \<Delta> x B a \<theta>n \<theta>c)
  5117   case (TAx \<Gamma> \<Delta> x B a \<theta>_n \<theta>_c)
  5118   then show ?case
  5118   then show ?case
  5119     apply -
  5119     apply -
  5120     apply(drule ncloses_elim)
  5120     apply(drule ncloses_elim)
  5121     apply(assumption)
  5121     apply(assumption)
  5122     apply(drule ccloses_elim)
  5122     apply(drule ccloses_elim)
  5123     apply(assumption)
  5123     apply(assumption)
  5124     apply(erule exE)+
  5124     apply(erule exE)+
  5125     apply(erule conjE)+
  5125     apply(erule conjE)+
  5126     apply(rule_tac s="Cut <c>.P (xa).Pa" and t="\<theta>n,\<theta>c<Ax x a>" in subst)
  5126     apply(rule_tac s="Cut <c>.P (xa).Pa" and t="\<theta>_n,\<theta>_c<Ax x a>" in subst)
  5127     apply(rule sym)
  5127     apply(rule sym)
  5128     apply(simp only: psubst_Ax)
  5128     apply(simp only: psubst_Ax)
  5129     apply(simp add: CUT_SNa)
  5129     apply(simp add: CUT_SNa)
  5130     done
  5130     done
  5131 next
  5131 next
  5132   case (TNotR x \<Gamma> B M \<Delta> \<Delta>' a \<theta>n \<theta>c) 
  5132   case (TNotR x \<Gamma> B M \<Delta> \<Delta>' a \<theta>_n \<theta>_c) 
  5133   then show ?case 
  5133   then show ?case 
  5134     apply(simp)
  5134     apply(simp)
  5135     apply(subgoal_tac "(a,NOT B) \<in> set \<Delta>'")
  5135     apply(subgoal_tac "(a,NOT B) \<in> set \<Delta>'")
  5136     apply(drule ccloses_elim)
  5136     apply(drule ccloses_elim)
  5137     apply(assumption)
  5137     apply(assumption)
  5143     apply(simp)
  5143     apply(simp)
  5144     apply(rule disjI2)
  5144     apply(rule disjI2)
  5145     apply(rule disjI2)
  5145     apply(rule disjI2)
  5146     apply(rule_tac x="c" in exI)
  5146     apply(rule_tac x="c" in exI)
  5147     apply(rule_tac x="x" in exI)
  5147     apply(rule_tac x="x" in exI)
  5148     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5148     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5149     apply(simp)
  5149     apply(simp)
  5150     apply(rule conjI)
  5150     apply(rule conjI)
  5151     apply(rule fic.intros)
  5151     apply(rule fic.intros)
  5152     apply(rule psubst_fresh_coname)
  5152     apply(rule psubst_fresh_coname)
  5153     apply(simp)
  5153     apply(simp)
  5155     apply(simp)
  5155     apply(simp)
  5156     apply(rule BINDING_implies_CAND)
  5156     apply(rule BINDING_implies_CAND)
  5157     apply(unfold BINDINGn_def)
  5157     apply(unfold BINDINGn_def)
  5158     apply(simp)
  5158     apply(simp)
  5159     apply(rule_tac x="x" in exI)
  5159     apply(rule_tac x="x" in exI)
  5160     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5160     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5161     apply(simp)
  5161     apply(simp)
  5162     apply(rule allI)+
  5162     apply(rule allI)+
  5163     apply(rule impI)
  5163     apply(rule impI)
  5164     apply(simp add: psubst_nsubst[symmetric])
  5164     apply(simp add: psubst_nsubst[symmetric])
  5165     apply(drule_tac x="(x,aa,Pa)#\<theta>n" in meta_spec)
  5165     apply(drule_tac x="(x,aa,Pa)#\<theta>_n" in meta_spec)
  5166     apply(drule_tac x="\<theta>c" in meta_spec)
  5166     apply(drule_tac x="\<theta>_c" in meta_spec)
  5167     apply(drule meta_mp)
  5167     apply(drule meta_mp)
  5168     apply(rule ncloses_extend)
  5168     apply(rule ncloses_extend)
  5169     apply(assumption)
  5169     apply(assumption)
  5170     apply(assumption)
  5170     apply(assumption)
  5171     apply(assumption)
  5171     apply(assumption)
  5177     apply(assumption)
  5177     apply(assumption)
  5178     apply(simp)
  5178     apply(simp)
  5179     apply(blast)
  5179     apply(blast)
  5180     done
  5180     done
  5181 next
  5181 next
  5182   case (TNotL a \<Delta> \<Gamma> M B \<Gamma>' x \<theta>n \<theta>c)
  5182   case (TNotL a \<Delta> \<Gamma> M B \<Gamma>' x \<theta>_n \<theta>_c)
  5183   then show ?case
  5183   then show ?case
  5184     apply(simp)
  5184     apply(simp)
  5185     apply(subgoal_tac "(x,NOT B) \<in> set \<Gamma>'")
  5185     apply(subgoal_tac "(x,NOT B) \<in> set \<Gamma>'")
  5186     apply(drule ncloses_elim)
  5186     apply(drule ncloses_elim)
  5187     apply(assumption)
  5187     apply(assumption)
  5195     apply(simp (no_asm))
  5195     apply(simp (no_asm))
  5196     apply(rule disjI2)
  5196     apply(rule disjI2)
  5197     apply(rule disjI2)
  5197     apply(rule disjI2)
  5198     apply(rule_tac x="a" in exI)
  5198     apply(rule_tac x="a" in exI)
  5199     apply(rule_tac x="ca" in exI)
  5199     apply(rule_tac x="ca" in exI)
  5200     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5200     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5201     apply(simp del: NEGc.simps)
  5201     apply(simp del: NEGc.simps)
  5202     apply(rule conjI)
  5202     apply(rule conjI)
  5203     apply(rule fin.intros)
  5203     apply(rule fin.intros)
  5204     apply(rule psubst_fresh_name)
  5204     apply(rule psubst_fresh_name)
  5205     apply(simp)
  5205     apply(simp)
  5207     apply(simp)
  5207     apply(simp)
  5208     apply(rule BINDING_implies_CAND)
  5208     apply(rule BINDING_implies_CAND)
  5209     apply(unfold BINDINGc_def)
  5209     apply(unfold BINDINGc_def)
  5210     apply(simp (no_asm))
  5210     apply(simp (no_asm))
  5211     apply(rule_tac x="a" in exI)
  5211     apply(rule_tac x="a" in exI)
  5212     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5212     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5213     apply(simp (no_asm))
  5213     apply(simp (no_asm))
  5214     apply(rule allI)+
  5214     apply(rule allI)+
  5215     apply(rule impI)
  5215     apply(rule impI)
  5216     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5216     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5217     apply(drule_tac x="\<theta>n" in meta_spec)
  5217     apply(drule_tac x="\<theta>_n" in meta_spec)
  5218     apply(drule_tac x="(a,xa,Pa)#\<theta>c" in meta_spec)
  5218     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5219     apply(drule meta_mp)
  5219     apply(drule meta_mp)
  5220     apply(rule ncloses_subset)
  5220     apply(rule ncloses_subset)
  5221     apply(assumption)
  5221     apply(assumption)
  5222     apply(blast)
  5222     apply(blast)
  5223     apply(drule meta_mp)
  5223     apply(drule meta_mp)
  5228     apply(assumption)
  5228     apply(assumption)
  5229     apply(assumption)
  5229     apply(assumption)
  5230     apply(blast)
  5230     apply(blast)
  5231     done
  5231     done
  5232 next
  5232 next
  5233   case (TAndL1 x \<Gamma> y B1 M \<Delta> \<Gamma>' B2 \<theta>n \<theta>c)
  5233   case (TAndL1 x \<Gamma> y B1 M \<Delta> \<Gamma>' B2 \<theta>_n \<theta>_c)
  5234   then show ?case     
  5234   then show ?case     
  5235     apply(simp)
  5235     apply(simp)
  5236     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5236     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5237     apply(drule ncloses_elim)
  5237     apply(drule ncloses_elim)
  5238     apply(assumption)
  5238     apply(assumption)
  5247     apply(rule disjI2)
  5247     apply(rule disjI2)
  5248     apply(rule disjI2)
  5248     apply(rule disjI2)
  5249     apply(rule disjI1)
  5249     apply(rule disjI1)
  5250     apply(rule_tac x="x" in exI)
  5250     apply(rule_tac x="x" in exI)
  5251     apply(rule_tac x="ca" in exI)
  5251     apply(rule_tac x="ca" in exI)
  5252     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5252     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5253     apply(simp del: NEGc.simps)
  5253     apply(simp del: NEGc.simps)
  5254     apply(rule conjI)
  5254     apply(rule conjI)
  5255     apply(rule fin.intros)
  5255     apply(rule fin.intros)
  5256     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5256     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5257     apply(rule psubst_fresh_name)
  5257     apply(rule psubst_fresh_name)
  5260     apply(simp)
  5260     apply(simp)
  5261     apply(rule BINDING_implies_CAND)
  5261     apply(rule BINDING_implies_CAND)
  5262     apply(unfold BINDINGn_def)
  5262     apply(unfold BINDINGn_def)
  5263     apply(simp (no_asm))
  5263     apply(simp (no_asm))
  5264     apply(rule_tac x="x" in exI)
  5264     apply(rule_tac x="x" in exI)
  5265     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5265     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5266     apply(simp (no_asm))
  5266     apply(simp (no_asm))
  5267     apply(rule allI)+
  5267     apply(rule allI)+
  5268     apply(rule impI)
  5268     apply(rule impI)
  5269     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5269     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5270     apply(drule_tac x="(x,a,Pa)#\<theta>n" in meta_spec)
  5270     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5271     apply(drule_tac x="\<theta>c" in meta_spec)
  5271     apply(drule_tac x="\<theta>_c" in meta_spec)
  5272     apply(drule meta_mp)
  5272     apply(drule meta_mp)
  5273     apply(rule ncloses_extend)
  5273     apply(rule ncloses_extend)
  5274     apply(rule ncloses_subset)
  5274     apply(rule ncloses_subset)
  5275     apply(assumption)
  5275     apply(assumption)
  5276     apply(blast)
  5276     apply(blast)
  5281     apply(assumption)
  5281     apply(assumption)
  5282     apply(assumption)
  5282     apply(assumption)
  5283     apply(blast)
  5283     apply(blast)
  5284     done
  5284     done
  5285 next
  5285 next
  5286   case (TAndL2 x \<Gamma> y B2 M \<Delta> \<Gamma>' B1 \<theta>n \<theta>c)
  5286   case (TAndL2 x \<Gamma> y B2 M \<Delta> \<Gamma>' B1 \<theta>_n \<theta>_c)
  5287   then show ?case 
  5287   then show ?case 
  5288     apply(simp)
  5288     apply(simp)
  5289     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5289     apply(subgoal_tac "(y,B1 AND B2) \<in> set \<Gamma>'")
  5290     apply(drule ncloses_elim)
  5290     apply(drule ncloses_elim)
  5291     apply(assumption)
  5291     apply(assumption)
  5300     apply(rule disjI2)
  5300     apply(rule disjI2)
  5301     apply(rule disjI2)
  5301     apply(rule disjI2)
  5302     apply(rule disjI2)
  5302     apply(rule disjI2)
  5303     apply(rule_tac x="x" in exI)
  5303     apply(rule_tac x="x" in exI)
  5304     apply(rule_tac x="ca" in exI)
  5304     apply(rule_tac x="ca" in exI)
  5305     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5305     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5306     apply(simp del: NEGc.simps)
  5306     apply(simp del: NEGc.simps)
  5307     apply(rule conjI)
  5307     apply(rule conjI)
  5308     apply(rule fin.intros)
  5308     apply(rule fin.intros)
  5309     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5309     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5310     apply(rule psubst_fresh_name)
  5310     apply(rule psubst_fresh_name)
  5313     apply(simp)
  5313     apply(simp)
  5314     apply(rule BINDING_implies_CAND)
  5314     apply(rule BINDING_implies_CAND)
  5315     apply(unfold BINDINGn_def)
  5315     apply(unfold BINDINGn_def)
  5316     apply(simp (no_asm))
  5316     apply(simp (no_asm))
  5317     apply(rule_tac x="x" in exI)
  5317     apply(rule_tac x="x" in exI)
  5318     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5318     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5319     apply(simp (no_asm))
  5319     apply(simp (no_asm))
  5320     apply(rule allI)+
  5320     apply(rule allI)+
  5321     apply(rule impI)
  5321     apply(rule impI)
  5322     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5322     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5323     apply(drule_tac x="(x,a,Pa)#\<theta>n" in meta_spec)
  5323     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5324     apply(drule_tac x="\<theta>c" in meta_spec)
  5324     apply(drule_tac x="\<theta>_c" in meta_spec)
  5325     apply(drule meta_mp)
  5325     apply(drule meta_mp)
  5326     apply(rule ncloses_extend)
  5326     apply(rule ncloses_extend)
  5327     apply(rule ncloses_subset)
  5327     apply(rule ncloses_subset)
  5328     apply(assumption)
  5328     apply(assumption)
  5329     apply(blast)
  5329     apply(blast)
  5334     apply(assumption)
  5334     apply(assumption)
  5335     apply(assumption)
  5335     apply(assumption)
  5336     apply(blast)
  5336     apply(blast)
  5337     done
  5337     done
  5338 next
  5338 next
  5339   case (TAndR a \<Delta> N c b M \<Gamma> B C \<Delta>' \<theta>n \<theta>c)
  5339   case (TAndR a \<Delta> N c b M \<Gamma> B C \<Delta>' \<theta>_n \<theta>_c)
  5340   then show ?case 
  5340   then show ?case 
  5341     apply(simp)
  5341     apply(simp)
  5342     apply(subgoal_tac "(c,B AND C) \<in> set \<Delta>'")
  5342     apply(subgoal_tac "(c,B AND C) \<in> set \<Delta>'")
  5343     apply(drule ccloses_elim)
  5343     apply(drule ccloses_elim)
  5344     apply(assumption)
  5344     apply(assumption)
  5351     apply(rule disjI2)
  5351     apply(rule disjI2)
  5352     apply(rule disjI2)
  5352     apply(rule disjI2)
  5353     apply(rule_tac x="ca" in exI)
  5353     apply(rule_tac x="ca" in exI)
  5354     apply(rule_tac x="a" in exI)
  5354     apply(rule_tac x="a" in exI)
  5355     apply(rule_tac x="b" in exI)
  5355     apply(rule_tac x="b" in exI)
  5356     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5356     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5357     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5357     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5358     apply(simp)
  5358     apply(simp)
  5359     apply(rule conjI)
  5359     apply(rule conjI)
  5360     apply(rule fic.intros)
  5360     apply(rule fic.intros)
  5361     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5361     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5362     apply(rule psubst_fresh_coname)
  5362     apply(rule psubst_fresh_coname)
  5371     apply(rule conjI)
  5371     apply(rule conjI)
  5372     apply(rule BINDING_implies_CAND)
  5372     apply(rule BINDING_implies_CAND)
  5373     apply(unfold BINDINGc_def)
  5373     apply(unfold BINDINGc_def)
  5374     apply(simp)
  5374     apply(simp)
  5375     apply(rule_tac x="a" in exI)
  5375     apply(rule_tac x="a" in exI)
  5376     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5376     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5377     apply(simp)
  5377     apply(simp)
  5378     apply(rule allI)+
  5378     apply(rule allI)+
  5379     apply(rule impI)
  5379     apply(rule impI)
  5380     apply(simp add: psubst_csubst[symmetric])
  5380     apply(simp add: psubst_csubst[symmetric])
  5381     apply(drule_tac x="\<theta>n" in meta_spec)
  5381     apply(drule_tac x="\<theta>_n" in meta_spec)
  5382     apply(drule_tac x="(a,xa,Pa)#\<theta>c" in meta_spec)
  5382     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5383     apply(drule meta_mp)
  5383     apply(drule meta_mp)
  5384     apply(assumption)
  5384     apply(assumption)
  5385     apply(drule meta_mp)
  5385     apply(drule meta_mp)
  5386     apply(rule ccloses_extend)
  5386     apply(rule ccloses_extend)
  5387     apply(rule ccloses_subset)
  5387     apply(rule ccloses_subset)
  5393     apply(assumption)
  5393     apply(assumption)
  5394     apply(rule BINDING_implies_CAND)
  5394     apply(rule BINDING_implies_CAND)
  5395     apply(unfold BINDINGc_def)
  5395     apply(unfold BINDINGc_def)
  5396     apply(simp)
  5396     apply(simp)
  5397     apply(rule_tac x="b" in exI)
  5397     apply(rule_tac x="b" in exI)
  5398     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5398     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5399     apply(simp)
  5399     apply(simp)
  5400     apply(rule allI)+
  5400     apply(rule allI)+
  5401     apply(rule impI)
  5401     apply(rule impI)
  5402     apply(simp add: psubst_csubst[symmetric])
  5402     apply(simp add: psubst_csubst[symmetric])
  5403     apply(rotate_tac 14)
  5403     apply(rotate_tac 14)
  5404     apply(drule_tac x="\<theta>n" in meta_spec)
  5404     apply(drule_tac x="\<theta>_n" in meta_spec)
  5405     apply(drule_tac x="(b,xa,Pa)#\<theta>c" in meta_spec)
  5405     apply(drule_tac x="(b,xa,Pa)#\<theta>_c" in meta_spec)
  5406     apply(drule meta_mp)
  5406     apply(drule meta_mp)
  5407     apply(assumption)
  5407     apply(assumption)
  5408     apply(drule meta_mp)
  5408     apply(drule meta_mp)
  5409     apply(rule ccloses_extend)
  5409     apply(rule ccloses_extend)
  5410     apply(rule ccloses_subset)
  5410     apply(rule ccloses_subset)
  5416     apply(assumption)
  5416     apply(assumption)
  5417     apply(simp)
  5417     apply(simp)
  5418     apply(blast)
  5418     apply(blast)
  5419     done
  5419     done
  5420 next
  5420 next
  5421   case (TOrL x \<Gamma> N z y M B \<Delta> C \<Gamma>' \<theta>n \<theta>c)
  5421   case (TOrL x \<Gamma> N z y M B \<Delta> C \<Gamma>' \<theta>_n \<theta>_c)
  5422   then show ?case 
  5422   then show ?case 
  5423     apply(simp)
  5423     apply(simp)
  5424     apply(subgoal_tac "(z,B OR C) \<in> set \<Gamma>'")
  5424     apply(subgoal_tac "(z,B OR C) \<in> set \<Gamma>'")
  5425     apply(drule ncloses_elim)
  5425     apply(drule ncloses_elim)
  5426     apply(assumption)
  5426     apply(assumption)
  5435     apply(rule disjI2)
  5435     apply(rule disjI2)
  5436     apply(rule disjI2)
  5436     apply(rule disjI2)
  5437     apply(rule_tac x="x" in exI)
  5437     apply(rule_tac x="x" in exI)
  5438     apply(rule_tac x="y" in exI)
  5438     apply(rule_tac x="y" in exI)
  5439     apply(rule_tac x="ca" in exI)
  5439     apply(rule_tac x="ca" in exI)
  5440     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5440     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5441     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5441     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5442     apply(simp del: NEGc.simps)
  5442     apply(simp del: NEGc.simps)
  5443     apply(rule conjI)
  5443     apply(rule conjI)
  5444     apply(rule fin.intros)
  5444     apply(rule fin.intros)
  5445     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5445     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5446     apply(rule psubst_fresh_name)
  5446     apply(rule psubst_fresh_name)
  5455     apply(rule conjI)
  5455     apply(rule conjI)
  5456     apply(rule BINDING_implies_CAND)
  5456     apply(rule BINDING_implies_CAND)
  5457     apply(unfold BINDINGn_def)
  5457     apply(unfold BINDINGn_def)
  5458     apply(simp del: NEGc.simps)
  5458     apply(simp del: NEGc.simps)
  5459     apply(rule_tac x="x" in exI)
  5459     apply(rule_tac x="x" in exI)
  5460     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5460     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5461     apply(simp del: NEGc.simps)
  5461     apply(simp del: NEGc.simps)
  5462     apply(rule allI)+
  5462     apply(rule allI)+
  5463     apply(rule impI)
  5463     apply(rule impI)
  5464     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5464     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5465     apply(drule_tac x="(x,a,Pa)#\<theta>n" in meta_spec)
  5465     apply(drule_tac x="(x,a,Pa)#\<theta>_n" in meta_spec)
  5466     apply(drule_tac x="\<theta>c" in meta_spec)
  5466     apply(drule_tac x="\<theta>_c" in meta_spec)
  5467     apply(drule meta_mp)
  5467     apply(drule meta_mp)
  5468     apply(rule ncloses_extend)
  5468     apply(rule ncloses_extend)
  5469     apply(rule ncloses_subset)
  5469     apply(rule ncloses_subset)
  5470     apply(assumption)
  5470     apply(assumption)
  5471     apply(blast)
  5471     apply(blast)
  5477     apply(assumption)
  5477     apply(assumption)
  5478     apply(rule BINDING_implies_CAND)
  5478     apply(rule BINDING_implies_CAND)
  5479     apply(unfold BINDINGn_def)
  5479     apply(unfold BINDINGn_def)
  5480     apply(simp del: NEGc.simps)
  5480     apply(simp del: NEGc.simps)
  5481     apply(rule_tac x="y" in exI)
  5481     apply(rule_tac x="y" in exI)
  5482     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5482     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5483     apply(simp del: NEGc.simps)
  5483     apply(simp del: NEGc.simps)
  5484     apply(rule allI)+
  5484     apply(rule allI)+
  5485     apply(rule impI)
  5485     apply(rule impI)
  5486     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5486     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5487     apply(rotate_tac 14)
  5487     apply(rotate_tac 14)
  5488     apply(drule_tac x="(y,a,Pa)#\<theta>n" in meta_spec)
  5488     apply(drule_tac x="(y,a,Pa)#\<theta>_n" in meta_spec)
  5489     apply(drule_tac x="\<theta>c" in meta_spec)
  5489     apply(drule_tac x="\<theta>_c" in meta_spec)
  5490     apply(drule meta_mp)
  5490     apply(drule meta_mp)
  5491     apply(rule ncloses_extend)
  5491     apply(rule ncloses_extend)
  5492     apply(rule ncloses_subset)
  5492     apply(rule ncloses_subset)
  5493     apply(assumption)
  5493     apply(assumption)
  5494     apply(blast)
  5494     apply(blast)
  5499     apply(assumption)
  5499     apply(assumption)
  5500     apply(assumption)
  5500     apply(assumption)
  5501     apply(blast)
  5501     apply(blast)
  5502     done
  5502     done
  5503 next
  5503 next
  5504   case (TOrR1 a \<Delta> b \<Gamma> M B1 \<Delta>' B2 \<theta>n \<theta>c)
  5504   case (TOrR1 a \<Delta> b \<Gamma> M B1 \<Delta>' B2 \<theta>_n \<theta>_c)
  5505   then show ?case
  5505   then show ?case
  5506     apply(simp)
  5506     apply(simp)
  5507     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5507     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5508     apply(drule ccloses_elim)
  5508     apply(drule ccloses_elim)
  5509     apply(assumption)
  5509     apply(assumption)
  5516     apply(rule disjI2)
  5516     apply(rule disjI2)
  5517     apply(rule disjI2)
  5517     apply(rule disjI2)
  5518     apply(rule disjI1)
  5518     apply(rule disjI1)
  5519     apply(rule_tac x="a" in exI)
  5519     apply(rule_tac x="a" in exI)
  5520     apply(rule_tac x="c" in exI)
  5520     apply(rule_tac x="c" in exI)
  5521     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5521     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5522     apply(simp)
  5522     apply(simp)
  5523     apply(rule conjI)
  5523     apply(rule conjI)
  5524     apply(rule fic.intros)
  5524     apply(rule fic.intros)
  5525     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5525     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5526     apply(rule psubst_fresh_coname)
  5526     apply(rule psubst_fresh_coname)
  5529     apply(simp)
  5529     apply(simp)
  5530     apply(rule BINDING_implies_CAND)
  5530     apply(rule BINDING_implies_CAND)
  5531     apply(unfold BINDINGc_def)
  5531     apply(unfold BINDINGc_def)
  5532     apply(simp (no_asm))
  5532     apply(simp (no_asm))
  5533     apply(rule_tac x="a" in exI)
  5533     apply(rule_tac x="a" in exI)
  5534     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5534     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5535     apply(simp (no_asm))
  5535     apply(simp (no_asm))
  5536     apply(rule allI)+
  5536     apply(rule allI)+
  5537     apply(rule impI)    
  5537     apply(rule impI)    
  5538     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5538     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5539     apply(drule_tac x="\<theta>n" in meta_spec)
  5539     apply(drule_tac x="\<theta>_n" in meta_spec)
  5540     apply(drule_tac x="(a,xa,Pa)#\<theta>c" in meta_spec)
  5540     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5541     apply(drule meta_mp)
  5541     apply(drule meta_mp)
  5542     apply(assumption)
  5542     apply(assumption)
  5543     apply(drule meta_mp)
  5543     apply(drule meta_mp)
  5544     apply(rule ccloses_extend)
  5544     apply(rule ccloses_extend)
  5545     apply(rule ccloses_subset)
  5545     apply(rule ccloses_subset)
  5551     apply(assumption)
  5551     apply(assumption)
  5552     apply(simp)
  5552     apply(simp)
  5553     apply(blast)
  5553     apply(blast)
  5554     done
  5554     done
  5555 next
  5555 next
  5556   case (TOrR2 a \<Delta> b \<Gamma> M B2 \<Delta>' B1 \<theta>n \<theta>c)
  5556   case (TOrR2 a \<Delta> b \<Gamma> M B2 \<Delta>' B1 \<theta>_n \<theta>_c)
  5557   then show ?case 
  5557   then show ?case 
  5558     apply(simp)
  5558     apply(simp)
  5559     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5559     apply(subgoal_tac "(b,B1 OR B2) \<in> set \<Delta>'")
  5560     apply(drule ccloses_elim)
  5560     apply(drule ccloses_elim)
  5561     apply(assumption)
  5561     apply(assumption)
  5568     apply(rule disjI2)
  5568     apply(rule disjI2)
  5569     apply(rule disjI2)
  5569     apply(rule disjI2)
  5570     apply(rule disjI2)
  5570     apply(rule disjI2)
  5571     apply(rule_tac x="a" in exI)
  5571     apply(rule_tac x="a" in exI)
  5572     apply(rule_tac x="c" in exI)
  5572     apply(rule_tac x="c" in exI)
  5573     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5573     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5574     apply(simp)
  5574     apply(simp)
  5575     apply(rule conjI)
  5575     apply(rule conjI)
  5576     apply(rule fic.intros)
  5576     apply(rule fic.intros)
  5577     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5577     apply(simp del: NEGc.simps add: abs_fresh fresh_prod fresh_atm)
  5578     apply(rule psubst_fresh_coname)
  5578     apply(rule psubst_fresh_coname)
  5581     apply(simp)
  5581     apply(simp)
  5582     apply(rule BINDING_implies_CAND)
  5582     apply(rule BINDING_implies_CAND)
  5583     apply(unfold BINDINGc_def)
  5583     apply(unfold BINDINGc_def)
  5584     apply(simp (no_asm))
  5584     apply(simp (no_asm))
  5585     apply(rule_tac x="a" in exI)
  5585     apply(rule_tac x="a" in exI)
  5586     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5586     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5587     apply(simp (no_asm))
  5587     apply(simp (no_asm))
  5588     apply(rule allI)+
  5588     apply(rule allI)+
  5589     apply(rule impI)    
  5589     apply(rule impI)    
  5590     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5590     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5591     apply(drule_tac x="\<theta>n" in meta_spec)
  5591     apply(drule_tac x="\<theta>_n" in meta_spec)
  5592     apply(drule_tac x="(a,xa,Pa)#\<theta>c" in meta_spec)
  5592     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5593     apply(drule meta_mp)
  5593     apply(drule meta_mp)
  5594     apply(assumption)
  5594     apply(assumption)
  5595     apply(drule meta_mp)
  5595     apply(drule meta_mp)
  5596     apply(rule ccloses_extend)
  5596     apply(rule ccloses_extend)
  5597     apply(rule ccloses_subset)
  5597     apply(rule ccloses_subset)
  5603     apply(assumption)
  5603     apply(assumption)
  5604     apply(simp)
  5604     apply(simp)
  5605     apply(blast)
  5605     apply(blast)
  5606     done
  5606     done
  5607 next
  5607 next
  5608   case (TImpL a \<Delta> N x \<Gamma> M y B C \<Gamma>' \<theta>n \<theta>c)
  5608   case (TImpL a \<Delta> N x \<Gamma> M y B C \<Gamma>' \<theta>_n \<theta>_c)
  5609   then show ?case
  5609   then show ?case
  5610     apply(simp)
  5610     apply(simp)
  5611     apply(subgoal_tac "(y,B IMP C) \<in> set \<Gamma>'")
  5611     apply(subgoal_tac "(y,B IMP C) \<in> set \<Gamma>'")
  5612     apply(drule ncloses_elim)
  5612     apply(drule ncloses_elim)
  5613     apply(assumption)
  5613     apply(assumption)
  5622     apply(rule disjI2)
  5622     apply(rule disjI2)
  5623     apply(rule disjI2)
  5623     apply(rule disjI2)
  5624     apply(rule_tac x="x" in exI)
  5624     apply(rule_tac x="x" in exI)
  5625     apply(rule_tac x="a" in exI)
  5625     apply(rule_tac x="a" in exI)
  5626     apply(rule_tac x="ca" in exI)
  5626     apply(rule_tac x="ca" in exI)
  5627     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5627     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5628     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5628     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5629     apply(simp del: NEGc.simps)
  5629     apply(simp del: NEGc.simps)
  5630     apply(rule conjI)
  5630     apply(rule conjI)
  5631     apply(rule fin.intros)
  5631     apply(rule fin.intros)
  5632     apply(rule psubst_fresh_name)
  5632     apply(rule psubst_fresh_name)
  5633     apply(simp)
  5633     apply(simp)
  5641     apply(rule conjI)
  5641     apply(rule conjI)
  5642     apply(rule BINDING_implies_CAND)
  5642     apply(rule BINDING_implies_CAND)
  5643     apply(unfold BINDINGc_def)
  5643     apply(unfold BINDINGc_def)
  5644     apply(simp del: NEGc.simps)
  5644     apply(simp del: NEGc.simps)
  5645     apply(rule_tac x="a" in exI)
  5645     apply(rule_tac x="a" in exI)
  5646     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5646     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5647     apply(simp del: NEGc.simps)
  5647     apply(simp del: NEGc.simps)
  5648     apply(rule allI)+
  5648     apply(rule allI)+
  5649     apply(rule impI)
  5649     apply(rule impI)
  5650     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5650     apply(simp del: NEGc.simps add: psubst_csubst[symmetric])
  5651     apply(drule_tac x="\<theta>n" in meta_spec)
  5651     apply(drule_tac x="\<theta>_n" in meta_spec)
  5652     apply(drule_tac x="(a,xa,Pa)#\<theta>c" in meta_spec)
  5652     apply(drule_tac x="(a,xa,Pa)#\<theta>_c" in meta_spec)
  5653     apply(drule meta_mp)
  5653     apply(drule meta_mp)
  5654     apply(rule ncloses_subset)
  5654     apply(rule ncloses_subset)
  5655     apply(assumption)
  5655     apply(assumption)
  5656     apply(blast)
  5656     apply(blast)
  5657     apply(drule meta_mp)
  5657     apply(drule meta_mp)
  5663     apply(assumption)
  5663     apply(assumption)
  5664     apply(rule BINDING_implies_CAND)
  5664     apply(rule BINDING_implies_CAND)
  5665     apply(unfold BINDINGn_def)
  5665     apply(unfold BINDINGn_def)
  5666     apply(simp del: NEGc.simps)
  5666     apply(simp del: NEGc.simps)
  5667     apply(rule_tac x="x" in exI)
  5667     apply(rule_tac x="x" in exI)
  5668     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5668     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5669     apply(simp del: NEGc.simps)
  5669     apply(simp del: NEGc.simps)
  5670     apply(rule allI)+
  5670     apply(rule allI)+
  5671     apply(rule impI)
  5671     apply(rule impI)
  5672     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5672     apply(simp del: NEGc.simps add: psubst_nsubst[symmetric])
  5673     apply(rotate_tac 12)
  5673     apply(rotate_tac 12)
  5674     apply(drule_tac x="(x,aa,Pa)#\<theta>n" in meta_spec)
  5674     apply(drule_tac x="(x,aa,Pa)#\<theta>_n" in meta_spec)
  5675     apply(drule_tac x="\<theta>c" in meta_spec)
  5675     apply(drule_tac x="\<theta>_c" in meta_spec)
  5676     apply(drule meta_mp)
  5676     apply(drule meta_mp)
  5677     apply(rule ncloses_extend)
  5677     apply(rule ncloses_extend)
  5678     apply(rule ncloses_subset)
  5678     apply(rule ncloses_subset)
  5679     apply(assumption)
  5679     apply(assumption)
  5680     apply(blast)
  5680     apply(blast)
  5685     apply(assumption)
  5685     apply(assumption)
  5686     apply(assumption)
  5686     apply(assumption)
  5687     apply(blast)
  5687     apply(blast)
  5688     done
  5688     done
  5689 next
  5689 next
  5690   case (TImpR a \<Delta> b x \<Gamma> B M C \<Delta>' \<theta>n \<theta>c)
  5690   case (TImpR a \<Delta> b x \<Gamma> B M C \<Delta>' \<theta>_n \<theta>_c)
  5691   then show ?case
  5691   then show ?case
  5692     apply(simp)
  5692     apply(simp)
  5693     apply(subgoal_tac "(b,B IMP C) \<in> set \<Delta>'")
  5693     apply(subgoal_tac "(b,B IMP C) \<in> set \<Delta>'")
  5694     apply(drule ccloses_elim)
  5694     apply(drule ccloses_elim)
  5695     apply(assumption)
  5695     apply(assumption)
  5702     apply(rule disjI2)
  5702     apply(rule disjI2)
  5703     apply(rule disjI2)
  5703     apply(rule disjI2)
  5704     apply(rule_tac x="x" in exI)
  5704     apply(rule_tac x="x" in exI)
  5705     apply(rule_tac x="a" in exI)
  5705     apply(rule_tac x="a" in exI)
  5706     apply(rule_tac x="c" in exI)
  5706     apply(rule_tac x="c" in exI)
  5707     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5707     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5708     apply(simp)
  5708     apply(simp)
  5709     apply(rule conjI)
  5709     apply(rule conjI)
  5710     apply(rule fic.intros)
  5710     apply(rule fic.intros)
  5711     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5711     apply(simp add: abs_fresh fresh_prod fresh_atm)
  5712     apply(rule psubst_fresh_coname)
  5712     apply(rule psubst_fresh_coname)
  5719     apply(simp add: psubst_csubst[symmetric])
  5719     apply(simp add: psubst_csubst[symmetric])
  5720     apply(rule BINDING_implies_CAND)
  5720     apply(rule BINDING_implies_CAND)
  5721     apply(unfold BINDINGn_def)
  5721     apply(unfold BINDINGn_def)
  5722     apply(simp)
  5722     apply(simp)
  5723     apply(rule_tac x="x" in exI)
  5723     apply(rule_tac x="x" in exI)
  5724     apply(rule_tac x="\<theta>n,((a,z,Pa)#\<theta>c)<M>" in exI)
  5724     apply(rule_tac x="\<theta>_n,((a,z,Pa)#\<theta>_c)<M>" in exI)
  5725     apply(simp)
  5725     apply(simp)
  5726     apply(rule allI)+
  5726     apply(rule allI)+
  5727     apply(rule impI)
  5727     apply(rule impI)
  5728     apply(rule_tac t="\<theta>n,((a,z,Pa)#\<theta>c)<M>{x:=<aa>.Pb}" and 
  5728     apply(rule_tac t="\<theta>_n,((a,z,Pa)#\<theta>_c)<M>{x:=<aa>.Pb}" and 
  5729                    s="((x,aa,Pb)#\<theta>n),((a,z,Pa)#\<theta>c)<M>" in subst)
  5729                    s="((x,aa,Pb)#\<theta>_n),((a,z,Pa)#\<theta>_c)<M>" in subst)
  5730     apply(rule psubst_nsubst)
  5730     apply(rule psubst_nsubst)
  5731     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5731     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5732     apply(drule_tac x="(x,aa,Pb)#\<theta>n" in meta_spec)
  5732     apply(drule_tac x="(x,aa,Pb)#\<theta>_n" in meta_spec)
  5733     apply(drule_tac x="(a,z,Pa)#\<theta>c" in meta_spec)
  5733     apply(drule_tac x="(a,z,Pa)#\<theta>_c" in meta_spec)
  5734     apply(drule meta_mp)
  5734     apply(drule meta_mp)
  5735     apply(rule ncloses_extend)
  5735     apply(rule ncloses_extend)
  5736     apply(assumption)
  5736     apply(assumption)
  5737     apply(simp)
  5737     apply(simp)
  5738     apply(simp)
  5738     apply(simp)
  5751     apply(simp add: psubst_nsubst[symmetric])
  5751     apply(simp add: psubst_nsubst[symmetric])
  5752     apply(rule BINDING_implies_CAND)
  5752     apply(rule BINDING_implies_CAND)
  5753     apply(unfold BINDINGc_def)
  5753     apply(unfold BINDINGc_def)
  5754     apply(simp)
  5754     apply(simp)
  5755     apply(rule_tac x="a" in exI)
  5755     apply(rule_tac x="a" in exI)
  5756     apply(rule_tac x="((x,ca,Q)#\<theta>n),\<theta>c<M>" in exI)
  5756     apply(rule_tac x="((x,ca,Q)#\<theta>_n),\<theta>_c<M>" in exI)
  5757     apply(simp)
  5757     apply(simp)
  5758     apply(rule allI)+
  5758     apply(rule allI)+
  5759     apply(rule impI)
  5759     apply(rule impI)
  5760     apply(rule_tac t="((x,ca,Q)#\<theta>n),\<theta>c<M>{a:=(xaa).Pa}" and 
  5760     apply(rule_tac t="((x,ca,Q)#\<theta>_n),\<theta>_c<M>{a:=(xaa).Pa}" and 
  5761                    s="((x,ca,Q)#\<theta>n),((a,xaa,Pa)#\<theta>c)<M>" in subst)
  5761                    s="((x,ca,Q)#\<theta>_n),((a,xaa,Pa)#\<theta>_c)<M>" in subst)
  5762     apply(rule psubst_csubst)
  5762     apply(rule psubst_csubst)
  5763     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5763     apply(simp add: fresh_prod fresh_atm fresh_list_cons)
  5764     apply(drule_tac x="(x,ca,Q)#\<theta>n" in meta_spec)
  5764     apply(drule_tac x="(x,ca,Q)#\<theta>_n" in meta_spec)
  5765     apply(drule_tac x="(a,xaa,Pa)#\<theta>c" in meta_spec)
  5765     apply(drule_tac x="(a,xaa,Pa)#\<theta>_c" in meta_spec)
  5766     apply(drule meta_mp)
  5766     apply(drule meta_mp)
  5767     apply(rule ncloses_extend)
  5767     apply(rule ncloses_extend)
  5768     apply(assumption)
  5768     apply(assumption)
  5769     apply(simp)
  5769     apply(simp)
  5770     apply(simp)
  5770     apply(simp)
  5780     apply(assumption)
  5780     apply(assumption)
  5781     apply(simp)
  5781     apply(simp)
  5782     apply(blast)
  5782     apply(blast)
  5783     done
  5783     done
  5784 next
  5784 next
  5785   case (TCut a \<Delta> N x \<Gamma> M B \<theta>n \<theta>c)
  5785   case (TCut a \<Delta> N x \<Gamma> M B \<theta>_n \<theta>_c)
  5786   then show ?case 
  5786   then show ?case 
  5787     apply -
  5787     apply -
  5788     apply(case_tac "\<forall>y. M\<noteq>Ax y a")
  5788     apply(case_tac "\<forall>y. M\<noteq>Ax y a")
  5789     apply(case_tac "\<forall>c. N\<noteq>Ax x c")
  5789     apply(case_tac "\<forall>c. N\<noteq>Ax x c")
  5790     apply(simp)
  5790     apply(simp)
  5791     apply(rule_tac B="B" in CUT_SNa)
  5791     apply(rule_tac B="B" in CUT_SNa)
  5792     apply(rule BINDING_implies_CAND)
  5792     apply(rule BINDING_implies_CAND)
  5793     apply(unfold BINDINGc_def)
  5793     apply(unfold BINDINGc_def)
  5794     apply(simp)
  5794     apply(simp)
  5795     apply(rule_tac x="a" in exI)
  5795     apply(rule_tac x="a" in exI)
  5796     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5796     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5797     apply(simp)
  5797     apply(simp)
  5798     apply(rule allI)
  5798     apply(rule allI)
  5799     apply(rule allI)
  5799     apply(rule allI)
  5800     apply(rule impI)
  5800     apply(rule impI)
  5801     apply(simp add: psubst_csubst[symmetric]) (*?*)
  5801     apply(simp add: psubst_csubst[symmetric]) (*?*)
  5802     apply(drule_tac x="\<theta>n" in meta_spec)
  5802     apply(drule_tac x="\<theta>_n" in meta_spec)
  5803     apply(drule_tac x="(a,xa,P)#\<theta>c" in meta_spec)
  5803     apply(drule_tac x="(a,xa,P)#\<theta>_c" in meta_spec)
  5804     apply(drule meta_mp)
  5804     apply(drule meta_mp)
  5805     apply(assumption)
  5805     apply(assumption)
  5806     apply(drule meta_mp)
  5806     apply(drule meta_mp)
  5807     apply(rule ccloses_extend) 
  5807     apply(rule ccloses_extend) 
  5808     apply(assumption)
  5808     apply(assumption)
  5812     apply(assumption)
  5812     apply(assumption)
  5813     apply(rule BINDING_implies_CAND)
  5813     apply(rule BINDING_implies_CAND)
  5814     apply(unfold BINDINGn_def)
  5814     apply(unfold BINDINGn_def)
  5815     apply(simp)
  5815     apply(simp)
  5816     apply(rule_tac x="x" in exI)
  5816     apply(rule_tac x="x" in exI)
  5817     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5817     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5818     apply(simp)
  5818     apply(simp)
  5819     apply(rule allI)
  5819     apply(rule allI)
  5820     apply(rule allI)
  5820     apply(rule allI)
  5821     apply(rule impI)
  5821     apply(rule impI)
  5822     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5822     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5823     apply(rotate_tac 11)
  5823     apply(rotate_tac 11)
  5824     apply(drule_tac x="(x,aa,P)#\<theta>n" in meta_spec)
  5824     apply(drule_tac x="(x,aa,P)#\<theta>_n" in meta_spec)
  5825     apply(drule_tac x="\<theta>c" in meta_spec)
  5825     apply(drule_tac x="\<theta>_c" in meta_spec)
  5826     apply(drule meta_mp)
  5826     apply(drule meta_mp)
  5827     apply(rule ncloses_extend)
  5827     apply(rule ncloses_extend)
  5828     apply(assumption)
  5828     apply(assumption)
  5829     apply(assumption)
  5829     apply(assumption)
  5830     apply(assumption)
  5830     apply(assumption)
  5842     (* left term *)
  5842     (* left term *)
  5843     apply(rule BINDING_implies_CAND)
  5843     apply(rule BINDING_implies_CAND)
  5844     apply(unfold BINDINGc_def)
  5844     apply(unfold BINDINGc_def)
  5845     apply(simp)
  5845     apply(simp)
  5846     apply(rule_tac x="a" in exI)
  5846     apply(rule_tac x="a" in exI)
  5847     apply(rule_tac x="\<theta>n,\<theta>c<M>" in exI)
  5847     apply(rule_tac x="\<theta>_n,\<theta>_c<M>" in exI)
  5848     apply(simp)
  5848     apply(simp)
  5849     apply(rule allI)+
  5849     apply(rule allI)+
  5850     apply(rule impI)
  5850     apply(rule impI)
  5851     apply(drule_tac x="\<theta>n" in meta_spec)
  5851     apply(drule_tac x="\<theta>_n" in meta_spec)
  5852     apply(drule_tac x="(a,xa,P)#\<theta>c" in meta_spec)
  5852     apply(drule_tac x="(a,xa,P)#\<theta>_c" in meta_spec)
  5853     apply(drule meta_mp)
  5853     apply(drule meta_mp)
  5854     apply(assumption)
  5854     apply(assumption)
  5855     apply(drule meta_mp)
  5855     apply(drule meta_mp)
  5856     apply(rule ccloses_extend) 
  5856     apply(rule ccloses_extend) 
  5857     apply(assumption)
  5857     apply(assumption)
  5933     apply(simp)
  5933     apply(simp)
  5934     apply(rule BINDING_implies_CAND)
  5934     apply(rule BINDING_implies_CAND)
  5935     apply(unfold BINDINGn_def)
  5935     apply(unfold BINDINGn_def)
  5936     apply(simp)
  5936     apply(simp)
  5937     apply(rule_tac x="x" in exI)
  5937     apply(rule_tac x="x" in exI)
  5938     apply(rule_tac x="\<theta>n,\<theta>c<N>" in exI)
  5938     apply(rule_tac x="\<theta>_n,\<theta>_c<N>" in exI)
  5939     apply(simp)
  5939     apply(simp)
  5940     apply(rule allI)
  5940     apply(rule allI)
  5941     apply(rule allI)
  5941     apply(rule allI)
  5942     apply(rule impI)
  5942     apply(rule impI)
  5943     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5943     apply(simp add: psubst_nsubst[symmetric]) (*?*)
  5944     apply(rotate_tac 10)
  5944     apply(rotate_tac 10)
  5945     apply(drule_tac x="(x,aa,P)#\<theta>n" in meta_spec)
  5945     apply(drule_tac x="(x,aa,P)#\<theta>_n" in meta_spec)
  5946     apply(drule_tac x="\<theta>c" in meta_spec)
  5946     apply(drule_tac x="\<theta>_c" in meta_spec)
  5947     apply(drule meta_mp)
  5947     apply(drule meta_mp)
  5948     apply(rule ncloses_extend)
  5948     apply(rule ncloses_extend)
  5949     apply(assumption)
  5949     apply(assumption)
  5950     apply(assumption)
  5950     apply(assumption)
  5951     apply(assumption)
  5951     apply(assumption)
  6036 apply(auto)
  6036 apply(auto)
  6037 done
  6037 done
  6038 
  6038 
  6039 lemma lookup1:
  6039 lemma lookup1:
  6040   assumes a: "x\<sharp>(idn \<Gamma> b)"
  6040   assumes a: "x\<sharp>(idn \<Gamma> b)"
  6041   shows "lookup x a (idn \<Gamma> b) \<theta>c = lookupa x a \<theta>c"
  6041   shows "lookup x a (idn \<Gamma> b) \<theta>_c = lookupa x a \<theta>_c"
  6042 using a
  6042 using a
  6043 apply(induct \<Gamma>)
  6043 apply(induct \<Gamma>)
  6044 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  6044 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm)
  6045 done
  6045 done
  6046 
  6046 
  6047 lemma lookup2:
  6047 lemma lookup2:
  6048   assumes a: "\<not>(x\<sharp>(idn \<Gamma> b))"
  6048   assumes a: "\<not>(x\<sharp>(idn \<Gamma> b))"
  6049   shows "lookup x a (idn \<Gamma> b) \<theta>c = lookupb x a \<theta>c b (Ax x b)"
  6049   shows "lookup x a (idn \<Gamma> b) \<theta>_c = lookupb x a \<theta>_c b (Ax x b)"
  6050 using a
  6050 using a
  6051 apply(induct \<Gamma>)
  6051 apply(induct \<Gamma>)
  6052 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6052 apply(auto simp add: fresh_list_cons fresh_prod fresh_atm fresh_list_nil)
  6053 done
  6053 done
  6054 
  6054