Nominal-General/Nominal2_Supp.thy
author Christian Urban <urbanc@in.tum.de>
Tue, 06 Apr 2010 23:33:40 +0200
changeset 1777 4f41a0884b22
parent 1774 c34347ec7ab3
child 1778 88ec05a09772
permissions -rw-r--r--
isarfied proof about existence of a permutation list
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     1
(*  Title:      Nominal2_Supp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     2
    Authors:    Brian Huffman, Christian Urban
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     3
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     4
    Supplementary Lemmas and Definitions for 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     5
    Nominal Isabelle. 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     6
*)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     7
theory Nominal2_Supp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     8
imports Nominal2_Base Nominal2_Eqvt Nominal2_Atoms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
     9
begin
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    10
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    11
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    12
section {* Fresh-Star *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    13
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    14
text {* The fresh-star generalisation of fresh is used in strong
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    15
  induction principles. *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    16
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    17
definition 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    18
  fresh_star :: "atom set \<Rightarrow> 'a::pt \<Rightarrow> bool" ("_ \<sharp>* _" [80,80] 80)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    19
where 
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    20
  "as \<sharp>* x \<equiv> \<forall>a \<in> as. a \<sharp> x"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    21
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    22
lemma fresh_star_prod:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    23
  fixes as::"atom set"
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    24
  shows "as \<sharp>* (x, y) = (as \<sharp>* x \<and> as \<sharp>* y)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    25
  by (auto simp add: fresh_star_def fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    26
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    27
lemma fresh_star_union:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    28
  shows "(as \<union> bs) \<sharp>* x = (as \<sharp>* x \<and> bs \<sharp>* x)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    29
  by (auto simp add: fresh_star_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    30
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    31
lemma fresh_star_insert:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    32
  shows "(insert a as) \<sharp>* x = (a \<sharp> x \<and> as \<sharp>* x)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    33
  by (auto simp add: fresh_star_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    34
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    35
lemma fresh_star_Un_elim:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    36
  "((as \<union> bs) \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (as \<sharp>* x \<Longrightarrow> bs \<sharp>* x \<Longrightarrow> PROP C)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    37
  unfolding fresh_star_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    38
  apply(rule)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    39
  apply(erule meta_mp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    40
  apply(auto)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    41
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    42
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    43
lemma fresh_star_insert_elim:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    44
  "(insert a as \<sharp>* x \<Longrightarrow> PROP C) \<equiv> (a \<sharp> x \<Longrightarrow> as \<sharp>* x \<Longrightarrow> PROP C)"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    45
  unfolding fresh_star_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    46
  by rule (simp_all add: fresh_star_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    47
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    48
lemma fresh_star_empty_elim:
1506
7c607df46a0a slightly more in the paper
Christian Urban <urbanc@in.tum.de>
parents: 1436
diff changeset
    49
  "({} \<sharp>* x \<Longrightarrow> PROP C) \<equiv> PROP C"
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    50
  by (simp add: fresh_star_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    51
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    52
lemma fresh_star_unit_elim: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    53
  shows "(a \<sharp>* () \<Longrightarrow> PROP C) \<equiv> PROP C"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    54
  by (simp add: fresh_star_def fresh_unit) 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    55
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    56
lemma fresh_star_prod_elim: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    57
  shows "(a \<sharp>* (x, y) \<Longrightarrow> PROP C) \<equiv> (a \<sharp>* x \<Longrightarrow> a \<sharp>* y \<Longrightarrow> PROP C)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    58
  by (rule, simp_all add: fresh_star_prod)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    59
1436
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    60
lemma fresh_star_plus:
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    61
  fixes p q::perm
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    62
  shows "\<lbrakk>a \<sharp>* p;  a \<sharp>* q\<rbrakk> \<Longrightarrow> a \<sharp>* (p + q)"
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    63
  unfolding fresh_star_def
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    64
  by (simp add: fresh_plus_perm)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    65
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    66
lemma fresh_star_permute_iff:
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    67
  shows "(p \<bullet> a) \<sharp>* (p \<bullet> x) \<longleftrightarrow> a \<sharp>* x"
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    68
  unfolding fresh_star_def
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    69
  by (metis mem_permute_iff permute_minus_cancel fresh_permute_iff)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    70
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    71
lemma fresh_star_eqvt:
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    72
  shows "(p \<bullet> (as \<sharp>* x)) = (p \<bullet> as) \<sharp>* (p \<bullet> x)"
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    73
unfolding fresh_star_def
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    74
unfolding Ball_def
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    75
apply(simp add: all_eqvt)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    76
apply(subst permute_fun_def)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    77
apply(simp add: imp_eqvt fresh_eqvt mem_eqvt)
04dad9b0136d started supp-fv proofs (is going to work)
Christian Urban <urbanc@in.tum.de>
parents: 1258
diff changeset
    78
done
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    79
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    80
section {* Avoiding of atom sets *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    81
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    82
text {* 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    83
  For every set of atoms, there is another set of atoms
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    84
  avoiding a finitely supported c and there is a permutation
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    85
  which 'translates' between both sets.
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    86
*}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    87
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    88
lemma at_set_avoiding_aux:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    89
  fixes Xs::"atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    90
  and   As::"atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    91
  assumes b: "Xs \<subseteq> As"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    92
  and     c: "finite As"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    93
  shows "\<exists>p. (p \<bullet> Xs) \<inter> As = {} \<and> (supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    94
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    95
  from b c have "finite Xs" by (rule finite_subset)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    96
  then show ?thesis using b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    97
  proof (induct rule: finite_subset_induct)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    98
    case empty
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
    99
    have "0 \<bullet> {} \<inter> As = {}" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   100
    moreover
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   101
    have "supp (0::perm) \<subseteq> {} \<union> 0 \<bullet> {}" by (simp add: supp_zero_perm)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   102
    ultimately show ?case by blast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   103
  next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   104
    case (insert x Xs)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   105
    then obtain p where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   106
      p1: "(p \<bullet> Xs) \<inter> As = {}" and 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   107
      p2: "supp p \<subseteq> (Xs \<union> (p \<bullet> Xs))" by blast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   108
    from `x \<in> As` p1 have "x \<notin> p \<bullet> Xs" by fast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   109
    with `x \<notin> Xs` p2 have "x \<notin> supp p" by fast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   110
    hence px: "p \<bullet> x = x" unfolding supp_perm by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   111
    have "finite (As \<union> p \<bullet> Xs)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   112
      using `finite As` `finite Xs`
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   113
      by (simp add: permute_set_eq_image)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   114
    then obtain y where "y \<notin> (As \<union> p \<bullet> Xs)" "sort_of y = sort_of x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   115
      by (rule obtain_atom)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   116
    hence y: "y \<notin> As" "y \<notin> p \<bullet> Xs" "sort_of y = sort_of x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   117
      by simp_all
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   118
    let ?q = "(x \<rightleftharpoons> y) + p"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   119
    have q: "?q \<bullet> insert x Xs = insert y (p \<bullet> Xs)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   120
      unfolding insert_eqvt
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   121
      using `p \<bullet> x = x` `sort_of y = sort_of x`
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   122
      using `x \<notin> p \<bullet> Xs` `y \<notin> p \<bullet> Xs`
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   123
      by (simp add: swap_atom swap_set_not_in)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   124
    have "?q \<bullet> insert x Xs \<inter> As = {}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   125
      using `y \<notin> As` `p \<bullet> Xs \<inter> As = {}`
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   126
      unfolding q by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   127
    moreover
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   128
    have "supp ?q \<subseteq> insert x Xs \<union> ?q \<bullet> insert x Xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   129
      using p2 unfolding q
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   130
      apply (intro subset_trans [OF supp_plus_perm])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   131
      apply (auto simp add: supp_swap)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   132
      done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   133
    ultimately show ?case by blast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   134
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   135
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   136
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   137
lemma at_set_avoiding:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   138
  assumes a: "finite Xs"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   139
  and     b: "finite (supp c)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   140
  obtains p::"perm" where "(p \<bullet> Xs)\<sharp>*c" and "(supp p) \<subseteq> (Xs \<union> (p \<bullet> Xs))"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   141
  using a b at_set_avoiding_aux [where Xs="Xs" and As="Xs \<union> supp c"]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   142
  unfolding fresh_star_def fresh_def by blast
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   143
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   144
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   145
section {* The freshness lemma according to Andrew Pitts *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   146
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   147
lemma fresh_conv_MOST: 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   148
  shows "a \<sharp> x \<longleftrightarrow> (MOST b. (a \<rightleftharpoons> b) \<bullet> x = x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   149
  unfolding fresh_def supp_def MOST_iff_cofinite by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   150
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   151
lemma fresh_apply:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   152
  assumes "a \<sharp> f" and "a \<sharp> x" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   153
  shows "a \<sharp> f x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   154
  using assms unfolding fresh_conv_MOST
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   155
  unfolding permute_fun_app_eq [where f=f]
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   156
  by (elim MOST_rev_mp, simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   157
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   158
lemma freshness_lemma:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   159
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   160
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   161
  shows  "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   162
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   163
  from a obtain b where a1: "atom b \<sharp> h" and a2: "atom b \<sharp> h b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   164
    by (auto simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   165
  show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   166
  proof (intro exI allI impI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   167
    fix a :: 'a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   168
    assume a3: "atom a \<sharp> h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   169
    show "h a = h b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   170
    proof (cases "a = b")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   171
      assume "a = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   172
      thus "h a = h b" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
    next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
      assume "a \<noteq> b"
1080
2f1377bb4e1f fixed lemma name
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   175
      hence "atom a \<sharp> b" by (simp add: fresh_at_base)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
      with a3 have "atom a \<sharp> h b" by (rule fresh_apply)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
      with a2 have d1: "(atom b \<rightleftharpoons> atom a) \<bullet> (h b) = (h b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   178
        by (rule swap_fresh_fresh)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   179
      from a1 a3 have d2: "(atom b \<rightleftharpoons> atom a) \<bullet> h = h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   180
        by (rule swap_fresh_fresh)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   181
      from d1 have "h b = (atom b \<rightleftharpoons> atom a) \<bullet> (h b)" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   182
      also have "\<dots> = ((atom b \<rightleftharpoons> atom a) \<bullet> h) ((atom b \<rightleftharpoons> atom a) \<bullet> b)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   183
        by (rule permute_fun_app_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   184
      also have "\<dots> = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   185
        using d2 by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
      finally show "h a = h b"  by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
    qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   188
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
lemma freshness_lemma_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   193
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   194
  shows "\<exists>!x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   195
proof (rule ex_ex1I)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   196
  from a show "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   197
    by (rule freshness_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   198
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   199
  fix x y
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   200
  assume x: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = x"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   201
  assume y: "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   202
  from a x y show "x = y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
    by (auto simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   206
text {* packaging the freshness lemma into a function *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   207
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   208
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   209
  fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
  "fresh_fun h = (THE x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   212
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   213
lemma fresh_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   214
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   215
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   216
  assumes b: "atom a \<sharp> h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   217
  shows "fresh_fun h = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   218
unfolding fresh_fun_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   219
proof (rule the_equality)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   220
  show "\<forall>a'. atom a' \<sharp> h \<longrightarrow> h a' = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   221
  proof (intro strip)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   222
    fix a':: 'a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
    assume c: "atom a' \<sharp> h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
    from a have "\<exists>x. \<forall>a. atom a \<sharp> h \<longrightarrow> h a = x" by (rule freshness_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   225
    with b c show "h a' = h a" by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   226
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   228
  fix fr :: 'b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   229
  assume "\<forall>a. atom a \<sharp> h \<longrightarrow> h a = fr"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
  with b show "fr = h a" by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   231
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   232
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   233
lemma fresh_fun_app':
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   234
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   235
  assumes a: "atom a \<sharp> h" "atom a \<sharp> h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   236
  shows "fresh_fun h = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   237
  apply (rule fresh_fun_app)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   238
  apply (auto simp add: fresh_Pair intro: a)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   239
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   240
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   241
lemma fresh_fun_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   242
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   244
  shows "p \<bullet> (fresh_fun h) = fresh_fun (p \<bullet> h)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   245
  using a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
  apply (clarsimp simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
  apply (subst fresh_fun_app', assumption+)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   248
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   249
  apply (drule fresh_permute_iff [where p=p, THEN iffD2])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   250
  apply (simp add: atom_eqvt permute_fun_app_eq [where f=h])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   251
  apply (erule (1) fresh_fun_app' [symmetric])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   252
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   253
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
lemma fresh_fun_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   255
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   256
  assumes a: "\<exists>a. atom a \<sharp> (h, h a)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
  shows "(supp h) supports (fresh_fun h)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   258
  apply (simp add: supports_def fresh_def [symmetric])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   259
  apply (simp add: fresh_fun_eqvt [OF a] swap_fresh_fresh)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   261
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   262
notation fresh_fun (binder "FRESH " 10)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   263
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   264
lemma FRESH_f_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   265
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
  fixes f :: "'b \<Rightarrow> 'c::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
  assumes P: "finite (supp P)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   268
  shows "(FRESH x. f (P x)) = f (FRESH x. P x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   269
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   270
  obtain a::'a where "atom a \<notin> supp P"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
    using P by (rule obtain_at_base)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   272
  hence "atom a \<sharp> P"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   273
    by (simp add: fresh_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   274
  show "(FRESH x. f (P x)) = f (FRESH x. P x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   275
    apply (subst fresh_fun_app' [where a=a, OF _ pure_fresh])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   276
    apply (cut_tac `atom a \<sharp> P`)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   277
    apply (simp add: fresh_conv_MOST)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   279
    apply (simp add: permute_fun_def permute_pure expand_fun_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
    apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> P` pure_fresh])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
    apply (rule refl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
    done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   285
lemma FRESH_binop_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   288
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
  assumes P: "finite (supp P)" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   290
  and     Q: "finite (supp Q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   291
  shows "(FRESH x. binop (P x) (Q x)) = binop (FRESH x. P x) (FRESH x. Q x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   293
  from assms have "finite (supp P \<union> supp Q)" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   294
  then obtain a::'a where "atom a \<notin> (supp P \<union> supp Q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   295
    by (rule obtain_at_base)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
  hence "atom a \<sharp> P" and "atom a \<sharp> Q"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   297
    by (simp_all add: fresh_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   298
  show ?thesis
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   299
    apply (subst fresh_fun_app' [where a=a, OF _ pure_fresh])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   300
    apply (cut_tac `atom a \<sharp> P` `atom a \<sharp> Q`)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   301
    apply (simp add: fresh_conv_MOST)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   302
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
    apply (simp add: permute_fun_def permute_pure expand_fun_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
    apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> P` pure_fresh])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   305
    apply (subst fresh_fun_app' [where a=a, OF `atom a \<sharp> Q` pure_fresh])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   306
    apply (rule refl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
    done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   308
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   309
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   310
lemma FRESH_conj_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   311
  fixes P Q :: "'a::at \<Rightarrow> bool"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   313
  shows "(FRESH x. P x \<and> Q x) \<longleftrightarrow> (FRESH x. P x) \<and> (FRESH x. Q x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   314
using P Q by (rule FRESH_binop_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   315
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   316
lemma FRESH_disj_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   317
  fixes P Q :: "'a::at \<Rightarrow> bool"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   318
  assumes P: "finite (supp P)" and Q: "finite (supp Q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   319
  shows "(FRESH x. P x \<or> Q x) \<longleftrightarrow> (FRESH x. P x) \<or> (FRESH x. Q x)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   320
using P Q by (rule FRESH_binop_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   323
section {* An example of a function without finite support *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   324
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   325
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   326
  nat_of :: "atom \<Rightarrow> nat"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   327
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   328
  "nat_of (Atom s n) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   329
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
lemma atom_eq_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   331
  fixes a b :: atom
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   332
  shows "a = b \<longleftrightarrow> sort_of a = sort_of b \<and> nat_of a = nat_of b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   333
  by (induct a, induct b, simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   334
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   335
lemma not_fresh_nat_of:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
  shows "\<not> a \<sharp> nat_of"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   337
unfolding fresh_def supp_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   338
proof (clarsimp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   339
  assume "finite {b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of}"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
  hence "finite ({a} \<union> {b. (a \<rightleftharpoons> b) \<bullet> nat_of \<noteq> nat_of})"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   341
    by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
  then obtain b where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   343
    b1: "b \<noteq> a" and
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   344
    b2: "sort_of b = sort_of a" and
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
    b3: "(a \<rightleftharpoons> b) \<bullet> nat_of = nat_of"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   346
    by (rule obtain_atom) auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
  have "nat_of a = (a \<rightleftharpoons> b) \<bullet> (nat_of a)" by (simp add: permute_nat_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   348
  also have "\<dots> = ((a \<rightleftharpoons> b) \<bullet> nat_of) ((a \<rightleftharpoons> b) \<bullet> a)" by (simp add: permute_fun_app_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   349
  also have "\<dots> = nat_of ((a \<rightleftharpoons> b) \<bullet> a)" using b3 by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   350
  also have "\<dots> = nat_of b" using b2 by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   351
  finally have "nat_of a = nat_of b" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   352
  with b2 have "a = b" by (simp add: atom_eq_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   353
  with b1 show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   355
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
lemma supp_nat_of:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
  shows "supp nat_of = UNIV"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   358
  using not_fresh_nat_of [unfolded fresh_def] by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   359
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   360
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   361
section {* Support for sets of atoms *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   362
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   363
lemma supp_finite_atom_set:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   364
  fixes S::"atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   365
  assumes "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   366
  shows "supp S = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   367
  apply(rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   368
  apply(simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   369
  apply(simp add: swap_set_not_in)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   370
  apply(rule assms)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   371
  apply(simp add: swap_set_in)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   372
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   374
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   375
section {* transpositions of permutations *}
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   376
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   377
fun
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   378
  add_perm 
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   379
where
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   380
  "add_perm [] = 0"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   381
| "add_perm ((a, b) # xs) = (a \<rightleftharpoons> b) + add_perm xs"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   382
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   383
lemma add_perm_append:
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   384
  shows "add_perm (xs @ ys) = add_perm xs + add_perm ys"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   385
by (induct xs arbitrary: ys)
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   386
   (auto simp add: add_assoc)
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   387
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   388
(* this induction is the fixed version of the one in Finite_Set.thy *)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   389
lemma finite_psubset_induct2[consumes 1, case_names psubset]:
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   390
  assumes major: "finite A" 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   391
  and     minor: "\<And>A. finite A \<Longrightarrow> (\<And>B. B \<subset> A \<Longrightarrow> P B) \<Longrightarrow> P A" 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   392
  shows "P A"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   393
using major
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   394
proof (induct A taking: card rule: measure_induct_rule)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   395
  case (less A)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   396
  have fact: "finite A" by fact
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   397
  have ih: "\<And>B. \<lbrakk>card B < card A; finite B\<rbrakk> \<Longrightarrow> P B" by fact
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   398
  { fix B 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   399
    assume asm: "B \<subset> A"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   400
    from asm have "card B < card A" using psubset_card_mono fact by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   401
    moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   402
    from asm have "B \<subseteq> A" by auto
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   403
    then have "finite B" using fact finite_subset by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   404
    ultimately 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   405
    have "P B" using ih by simp
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   406
  }
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   407
  then show "P A" using minor fact by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   408
qed
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   409
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   410
lemma perm_list_exists:
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   411
  fixes p::perm
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   412
  shows "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p"
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   413
proof -
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   414
  have "finite (supp p)" by (simp add: finite_supp)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   415
  then show "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   416
  proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct2)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   417
    case (psubset p)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   418
    have ih: "\<And>q. (supp q) \<subset> (supp p) \<Longrightarrow> (\<exists>xs. q = add_perm xs \<and> supp xs \<subseteq> supp q)" by fact
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   419
    { assume "supp p = {}"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   420
      then have "p = 0" by (simp add: supp_perm expand_perm_eq)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   421
      then have "p = add_perm [] \<and> supp [] \<subseteq> supp p" by (simp add: supp_Nil)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   422
    }
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   423
    moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   424
    { assume "supp p \<noteq> {}"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   425
      then obtain a where a0: "a \<in> supp p" by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   426
      let ?q = "p + (((- p) \<bullet> a) \<rightleftharpoons> a)"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   427
      have a1: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   428
      moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   429
      have "a \<notin> supp ?q" by (simp add: supp_perm)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   430
      then have "supp ?q \<noteq> supp p" using a0 by auto
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   431
      ultimately have "(supp ?q) \<subset> (supp p)" by auto
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   432
      then obtain xs where a: "?q = add_perm xs" and b: "supp xs \<subseteq> supp ?q" using ih by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   433
      let ?xs' = "xs @ [((- p) \<bullet> a, a)]"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   434
      have "supp [(- p \<bullet> a, a)] \<subseteq> supp p" using a0
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   435
	by (simp add: supp_Cons supp_Nil supp_Pair supp_atom supp_perm) (metis permute_minus_cancel(1))
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   436
      moreover 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   437
      have "supp xs \<subseteq> supp p" using b a1 by blast 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   438
      ultimately  
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   439
      have"supp ?xs' \<subseteq> supp p" by (simp add: supp_append)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   440
      moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   441
      have "p = add_perm ?xs'" using a[symmetric]
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   442
	by (simp add: add_perm_append expand_perm_eq)
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   443
      ultimately 
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   444
      have "p = add_perm ?xs' \<and> supp ?xs' \<subseteq> supp p" by simp
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   445
      then have "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p" by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   446
    }
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   447
    ultimately show "\<exists>xs. p = add_perm xs \<and> supp xs \<subseteq> supp p" by blast
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   448
  qed
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   449
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   450
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   451
section {* Lemma about support and permutations *}
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   452
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   453
lemma supp_perm_eq:
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   454
  assumes a: "(supp x) \<sharp>* p"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   455
  shows "p \<bullet> x = x"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   456
proof -
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   457
  obtain xs where eq: "p = add_perm xs" and sub: "supp xs \<subseteq> supp p"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   458
    using perm_list_exists by blast
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   459
  from a have "\<forall>a \<in> supp p. a \<sharp> x"
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   460
    by (auto simp add: fresh_star_def fresh_def supp_perm)
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   461
  with eq sub have "\<forall>a \<in> supp xs. a \<sharp> x" by auto
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   462
  then have "add_perm xs \<bullet> x = x" 
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   463
    by (induct xs rule: add_perm.induct)
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   464
       (simp_all add: supp_Cons supp_Pair supp_atom swap_fresh_fresh)
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   465
  then show "p \<bullet> x = x" using eq by simp
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   466
qed
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   467
1564
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   468
section {* at_set_avoiding2 *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   469
1567
8f28e749d92b Fixed missing colon.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1564
diff changeset
   470
lemma at_set_avoiding2:
1564
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   471
  assumes "finite xs"
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   472
  and     "finite (supp c)" "finite (supp x)"
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   473
  and     "xs \<sharp>* x"
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   474
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   475
using assms
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   476
apply(erule_tac c="(c, x)" in at_set_avoiding)
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   477
apply(simp add: supp_Pair)
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   478
apply(rule_tac x="p" in exI)
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   479
apply(simp add: fresh_star_prod)
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   480
apply(subgoal_tac "\<forall>a \<in> supp p. a \<sharp> x")
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   481
apply(auto simp add: fresh_star_def fresh_def supp_perm)[1]
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   482
apply(auto simp add: fresh_star_def fresh_def)
a4743b7cd887 proved at_set_avoiding2 which is needed for strong induction principles
Christian Urban <urbanc@in.tum.de>
parents: 1563
diff changeset
   483
done
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   484
1633
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   485
lemma at_set_avoiding2_atom:
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   486
  assumes "finite (supp c)" "finite (supp x)"
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   487
  and     b: "xa \<sharp> x"
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   488
  shows "\<exists>p. (p \<bullet> xa) \<sharp> c \<and> supp x \<sharp>* p"
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   489
proof -
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   490
  have a: "{xa} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   491
  obtain p where p1: "(p \<bullet> {xa}) \<sharp>* c" and p2: "supp x \<sharp>* p"
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   492
    using at_set_avoiding2[of "{xa}" "c" "x"] assms a by blast
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   493
  have c: "(p \<bullet> xa) \<sharp> c" using p1
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   494
    unfolding fresh_star_def Ball_def 
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   495
    by (erule_tac x="p \<bullet> xa" in allE) (simp add: eqvts)
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   496
  hence "p \<bullet> xa \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   497
  then show ?thesis by blast
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   498
qed
9e31248a1b8c avoiding for atom.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1567
diff changeset
   499
1567
8f28e749d92b Fixed missing colon.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1564
diff changeset
   500
end