Nominal/Abs.thy
changeset 1686 7b3dd407f6b3
parent 1673 e8cf0520c820
child 1688 0b2535a72fd0
equal deleted inserted replaced
1673:e8cf0520c820 1686:7b3dd407f6b3
   118   unfolding Diff_eqvt[symmetric]
   118   unfolding Diff_eqvt[symmetric]
   119   apply(erule_tac [!] exE)
   119   apply(erule_tac [!] exE)
   120   apply(rule_tac [!] x="p \<bullet> pa" in exI)
   120   apply(rule_tac [!] x="p \<bullet> pa" in exI)
   121   by (auto simp add: fresh_star_permute_iff permute_eqvt[symmetric])
   121   by (auto simp add: fresh_star_permute_iff permute_eqvt[symmetric])
   122 
   122 
   123 fun
       
   124   aux_set 
       
   125 where
       
   126   "aux_set (bs, x) = (supp x) - bs"
       
   127 
       
   128 fun
       
   129   aux_list
       
   130 where
       
   131   "aux_list (cs, x) = (supp x) - (set cs)"
       
   132 
       
   133 lemma aux_abs_lemma:
       
   134   assumes a: "(bs, x) \<approx>abs (cs, y)" 
       
   135   shows "aux_set (bs, x) = aux_set (cs, y)"
       
   136   using a
       
   137   by (induct rule: alpha_abs.induct)
       
   138      (simp add: alphas_abs alphas)
       
   139 
       
   140 lemma aux_abs_res_lemma:
       
   141   assumes a: "(bs, x) \<approx>abs_res (cs, y)" 
       
   142   shows "aux_set (bs, x) = aux_set (cs, y)"
       
   143   using a
       
   144   by (induct rule: alpha_abs_res.induct)
       
   145      (simp add: alphas_abs alphas)
       
   146  
       
   147 lemma aux_abs_list_lemma:
       
   148   assumes a: "(bs, x) \<approx>abs_lst (cs, y)" 
       
   149   shows "aux_list (bs, x) = aux_list (cs, y)"
       
   150   using a
       
   151   by (induct rule: alpha_abs_lst.induct)
       
   152      (simp add: alphas_abs alphas)
       
   153 
       
   154 quotient_type 
   123 quotient_type 
   155     'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs"
   124     'a abs_gen = "(atom set \<times> 'a::pt)" / "alpha_abs"
   156 and 'b abs_res = "(atom set \<times> 'b::pt)" / "alpha_abs_res"
   125 and 'b abs_res = "(atom set \<times> 'b::pt)" / "alpha_abs_res"
   157 and 'c abs_lst = "(atom list \<times> 'c::pt)" / "alpha_abs_lst"
   126 and 'c abs_lst = "(atom list \<times> 'c::pt)" / "alpha_abs_lst"
   158   apply(rule_tac [!] equivpI)
   127   apply(rule_tac [!] equivpI)
   186   and   "(op= ===> alpha_abs_res ===> alpha_abs_res) permute permute"
   155   and   "(op= ===> alpha_abs_res ===> alpha_abs_res) permute permute"
   187   and   "(op= ===> alpha_abs_lst ===> alpha_abs_lst) permute permute"
   156   and   "(op= ===> alpha_abs_lst ===> alpha_abs_lst) permute permute"
   188   unfolding fun_rel_def
   157   unfolding fun_rel_def
   189   by (auto intro: alphas_abs_eqvt simp only: Pair_eqvt)
   158   by (auto intro: alphas_abs_eqvt simp only: Pair_eqvt)
   190 
   159 
   191 lemma [quot_respect]:
   160 lemma abs_exhausts:
   192   shows "(alpha_abs ===> op=) aux_set aux_set"
   161   shows "(\<And>as (x::'a::pt). y1 = Abs as x \<Longrightarrow> P1) \<Longrightarrow> P1"
   193   and   "(alpha_abs_res ===> op=) aux_set aux_set"
   162   and   "(\<And>as (x::'a::pt). y2 = Abs_res as x \<Longrightarrow> P2) \<Longrightarrow> P2"
   194   and   "(alpha_abs_lst ===> op=) aux_list aux_list"
   163   and   "(\<And>as (x::'a::pt). y3 = Abs_lst as x \<Longrightarrow> P3) \<Longrightarrow> P3"
   195   unfolding fun_rel_def
   164   by (lifting prod.exhaust[where 'a="atom set" and 'b="'a"]
   196   apply(rule_tac [!] allI)
   165               prod.exhaust[where 'a="atom set" and 'b="'a"]
   197   apply(rule_tac [!] allI)
   166               prod.exhaust[where 'a="atom list" and 'b="'a"])
   198   apply(case_tac [!] x, case_tac [!] y)
       
   199   apply(rule_tac [!] impI)
       
   200   by (simp_all only: aux_abs_lemma aux_abs_res_lemma aux_abs_list_lemma)
       
   201 
       
   202 lemma abs_inducts:
       
   203   shows "(\<And>as (x::'a::pt). P1 (Abs as x)) \<Longrightarrow> P1 x1"
       
   204   and   "(\<And>as (x::'a::pt). P2 (Abs_res as x)) \<Longrightarrow> P2 x2"
       
   205   and   "(\<And>as (x::'a::pt). P3 (Abs_lst as x)) \<Longrightarrow> P3 x3"
       
   206   by (lifting prod.induct[where 'a="atom set" and 'b="'a"]
       
   207               prod.induct[where 'a="atom set" and 'b="'a"]
       
   208               prod.induct[where 'a="atom list" and 'b="'a"])
       
   209 
   167 
   210 lemma abs_eq_iff:
   168 lemma abs_eq_iff:
   211   shows "Abs bs x = Abs cs y \<longleftrightarrow> (bs, x) \<approx>abs (cs, y)"
   169   shows "Abs bs x = Abs cs y \<longleftrightarrow> (bs, x) \<approx>abs (cs, y)"
   212   and   "Abs_res bs x = Abs_res cs y \<longleftrightarrow> (bs, x) \<approx>abs_res (cs, y)"
   170   and   "Abs_res bs x = Abs_res cs y \<longleftrightarrow> (bs, x) \<approx>abs_res (cs, y)"
   213   and   "Abs_lst ds x = Abs_lst hs y \<longleftrightarrow> (ds, x) \<approx>abs_lst (hs, y)"
   171   and   "Abs_lst ds x = Abs_lst hs y \<longleftrightarrow> (ds, x) \<approx>abs_lst (hs, y)"
   228   shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)"
   186   shows "(p \<bullet> (Abs as x)) = Abs (p \<bullet> as) (p \<bullet> x)"
   229   by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
   187   by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
   230 
   188 
   231 instance
   189 instance
   232   apply(default)
   190   apply(default)
   233   apply(induct_tac [!] x rule: abs_inducts(1))
   191   apply(case_tac [!] x rule: abs_exhausts(1))
   234   apply(simp_all)
   192   apply(simp_all)
   235   done
   193   done
   236 
   194 
   237 end
   195 end
   238 
   196 
   249   shows "(p \<bullet> (Abs_res as x)) = Abs_res (p \<bullet> as) (p \<bullet> x)"
   207   shows "(p \<bullet> (Abs_res as x)) = Abs_res (p \<bullet> as) (p \<bullet> x)"
   250   by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
   208   by (lifting permute_prod.simps[where 'a="atom set" and 'b="'a"])
   251 
   209 
   252 instance
   210 instance
   253   apply(default)
   211   apply(default)
   254   apply(induct_tac [!] x rule: abs_inducts(2))
   212   apply(case_tac [!] x rule: abs_exhausts(2))
   255   apply(simp_all)
   213   apply(simp_all)
   256   done
   214   done
   257 
   215 
   258 end
   216 end
   259 
   217 
   270   shows "(p \<bullet> (Abs_lst as x)) = Abs_lst (p \<bullet> as) (p \<bullet> x)"
   228   shows "(p \<bullet> (Abs_lst as x)) = Abs_lst (p \<bullet> as) (p \<bullet> x)"
   271   by (lifting permute_prod.simps[where 'a="atom list" and 'b="'a"])
   229   by (lifting permute_prod.simps[where 'a="atom list" and 'b="'a"])
   272 
   230 
   273 instance
   231 instance
   274   apply(default)
   232   apply(default)
   275   apply(induct_tac [!] x rule: abs_inducts(3))
   233   apply(case_tac [!] x rule: abs_exhausts(3))
   276   apply(simp_all)
   234   apply(simp_all)
   277   done
   235   done
   278 
   236 
   279 end
   237 end
   280 
   238 
   315   and   "((supp x) - (set bs)) supports (Abs_lst bs x)"
   273   and   "((supp x) - (set bs)) supports (Abs_lst bs x)"
   316   unfolding supports_def
   274   unfolding supports_def
   317   unfolding permute_abs
   275   unfolding permute_abs
   318   by (simp_all add: abs_swap1[symmetric] abs_swap2[symmetric])
   276   by (simp_all add: abs_swap1[symmetric] abs_swap2[symmetric])
   319 
   277 
   320 quotient_definition
   278 function
   321   "supp_gen :: ('a::pt) abs_gen \<Rightarrow> atom set"
   279   supp_gen  :: "('a::pt) abs_gen \<Rightarrow> atom set"
   322 is
   280 where
   323   "aux_set"
   281   "supp_gen (Abs as x) = supp x - as"
   324 
   282 apply(case_tac x rule: abs_exhausts(1))
   325 quotient_definition
   283 apply(simp)
   326   "supp_res :: ('a::pt) abs_res \<Rightarrow> atom set"
   284 apply(simp add: abs_eq_iff alphas_abs alphas)
   327 is
   285 done
   328   "aux_set"
   286 
   329 
   287 termination supp_gen 
   330 quotient_definition
   288   by (auto intro!: local.termination)
   331   "supp_lst :: ('a::pt) abs_lst \<Rightarrow> atom set"
   289 
   332 is
   290 function
   333   "aux_list"
   291   supp_res :: "('a::pt) abs_res \<Rightarrow> atom set"
   334 
   292 where
   335 lemma aux_supps:
   293   "supp_res (Abs_res as x) = supp x - as"
   336   shows "supp_gen (Abs bs x) = (supp x) - bs"
   294 apply(case_tac x rule: abs_exhausts(2))
   337   and   "supp_res (Abs_res bs x) = (supp x) - bs"
   295 apply(simp)
   338   and   "supp_lst (Abs_lst cs x) = (supp x) - (set cs)"
   296 apply(simp add: abs_eq_iff alphas_abs alphas)
   339   by (lifting aux_set.simps aux_set.simps aux_list.simps)
   297 done
   340 
   298 
   341 lemma aux_supp_eqvt[eqvt]:
   299 termination supp_res 
       
   300   by (auto intro!: local.termination)
       
   301 
       
   302 function
       
   303   supp_lst :: "('a::pt) abs_lst \<Rightarrow> atom set"
       
   304 where
       
   305   "supp_lst (Abs_lst cs x) = (supp x) - (set cs)"
       
   306 apply(case_tac x rule: abs_exhausts(3))
       
   307 apply(simp)
       
   308 apply(simp add: abs_eq_iff alphas_abs alphas)
       
   309 done
       
   310 
       
   311 termination supp_lst 
       
   312   by (auto intro!: local.termination)
       
   313 
       
   314 lemma [eqvt]:
   342   shows "(p \<bullet> supp_gen x) = supp_gen (p \<bullet> x)"
   315   shows "(p \<bullet> supp_gen x) = supp_gen (p \<bullet> x)"
   343   and   "(p \<bullet> supp_res y) = supp_res (p \<bullet> y)"
   316   and   "(p \<bullet> supp_res y) = supp_res (p \<bullet> y)"
   344   and   "(p \<bullet> supp_lst z) = supp_lst (p \<bullet> z)"
   317   and   "(p \<bullet> supp_lst z) = supp_lst (p \<bullet> z)"
   345   apply(induct_tac x rule: abs_inducts(1))
   318   apply(case_tac x rule: abs_exhausts(1))
   346   apply(simp add: aux_supps supp_eqvt Diff_eqvt)
   319   apply(simp add: supp_eqvt Diff_eqvt)
   347   apply(induct_tac y rule: abs_inducts(2))
   320   apply(case_tac y rule: abs_exhausts(2))
   348   apply(simp add: aux_supps supp_eqvt Diff_eqvt)
   321   apply(simp add: supp_eqvt Diff_eqvt)
   349   apply(induct_tac z rule: abs_inducts(3))
   322   apply(case_tac z rule: abs_exhausts(3))
   350   apply(simp add: aux_supps supp_eqvt Diff_eqvt set_eqvt)
   323   apply(simp add: supp_eqvt Diff_eqvt set_eqvt)
   351   done
   324   done
   352 
   325 
   353 lemma aux_fresh:
   326 lemma aux_fresh:
   354   shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_gen (Abs bs x)"
   327   shows "a \<sharp> Abs bs x \<Longrightarrow> a \<sharp> supp_gen (Abs bs x)"
   355   and   "a \<sharp> Abs_res bs x \<Longrightarrow> a \<sharp> supp_res (Abs_res bs x)"
   328   and   "a \<sharp> Abs_res bs x \<Longrightarrow> a \<sharp> supp_res (Abs_res bs x)"
   362   assumes a: "finite (supp x)"
   335   assumes a: "finite (supp x)"
   363   shows "(supp x) - as \<subseteq> supp (Abs as x)"
   336   shows "(supp x) - as \<subseteq> supp (Abs as x)"
   364   and   "(supp x) - as \<subseteq> supp (Abs_res as x)"
   337   and   "(supp x) - as \<subseteq> supp (Abs_res as x)"
   365   and   "(supp x) - (set bs) \<subseteq> supp (Abs_lst bs x)"
   338   and   "(supp x) - (set bs) \<subseteq> supp (Abs_lst bs x)"
   366   unfolding supp_conv_fresh
   339   unfolding supp_conv_fresh
   367   apply(auto dest!: aux_fresh simp add: aux_supps)
   340   apply(auto dest!: aux_fresh)
   368   apply(simp_all add: fresh_def supp_finite_atom_set a)
   341   apply(simp_all add: fresh_def supp_finite_atom_set a)
   369   done
   342   done
   370 
   343 
   371 lemma supp_abs_subset2:
   344 lemma supp_abs_subset2:
   372   assumes a: "finite (supp x)"
   345   assumes a: "finite (supp x)"
   395   apply(simp_all add: finite_supp)
   368   apply(simp_all add: finite_supp)
   396   done
   369   done
   397 
   370 
   398 instance abs_gen :: (fs) fs
   371 instance abs_gen :: (fs) fs
   399   apply(default)
   372   apply(default)
   400   apply(induct_tac x rule: abs_inducts(1))
   373   apply(case_tac x rule: abs_exhausts(1))
   401   apply(simp add: supp_abs finite_supp)
   374   apply(simp add: supp_abs finite_supp)
   402   done
   375   done
   403 
   376 
   404 instance abs_res :: (fs) fs
   377 instance abs_res :: (fs) fs
   405   apply(default)
   378   apply(default)
   406   apply(induct_tac x rule: abs_inducts(2))
   379   apply(case_tac x rule: abs_exhausts(2))
   407   apply(simp add: supp_abs finite_supp)
   380   apply(simp add: supp_abs finite_supp)
   408   done
   381   done
   409 
   382 
   410 instance abs_lst :: (fs) fs
   383 instance abs_lst :: (fs) fs
   411   apply(default)
   384   apply(default)
   412   apply(induct_tac x rule: abs_inducts(3))
   385   apply(case_tac x rule: abs_exhausts(3))
   413   apply(simp add: supp_abs finite_supp)
   386   apply(simp add: supp_abs finite_supp)
   414   done
   387   done
   415 
   388 
   416 lemma abs_fresh_iff:
   389 lemma abs_fresh_iff:
   417   fixes x::"'a::fs"
   390   fixes x::"'a::fs"
   419   and   "a \<sharp> Abs_res bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)"
   392   and   "a \<sharp> Abs_res bs x \<longleftrightarrow> a \<in> bs \<or> (a \<notin> bs \<and> a \<sharp> x)"
   420   and   "a \<sharp> Abs_lst cs x \<longleftrightarrow> a \<in> (set cs) \<or> (a \<notin> (set cs) \<and> a \<sharp> x)"
   393   and   "a \<sharp> Abs_lst cs x \<longleftrightarrow> a \<in> (set cs) \<or> (a \<notin> (set cs) \<and> a \<sharp> x)"
   421   unfolding fresh_def
   394   unfolding fresh_def
   422   unfolding supp_abs
   395   unfolding supp_abs
   423   by auto
   396   by auto
   424 
       
   425 
   397 
   426 section {* BELOW is stuff that may or may not be needed *}
   398 section {* BELOW is stuff that may or may not be needed *}
   427 
   399 
   428 (* support of concrete atom sets *)
   400 (* support of concrete atom sets *)
   429 
   401