Nominal-General/Nominal2_Supp.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 21 Apr 2010 10:09:07 +0200
changeset 1913 39951d71bfce
parent 1879 869d1183e082
child 1918 e2e963f4e90d
permissions -rw-r--r--
merged
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
1861
226b797868dc some tuning of eqvt-infrastructure
Christian Urban <urbanc@in.tum.de>
parents: 1778
diff changeset
    71
lemma fresh_star_eqvt[eqvt]:
1436
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
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   144
lemma at_set_avoiding2:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   145
  assumes "finite xs"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   146
  and     "finite (supp c)" "finite (supp x)"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   147
  and     "xs \<sharp>* x"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   148
  shows "\<exists>p. (p \<bullet> xs) \<sharp>* c \<and> supp x \<sharp>* p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   149
using assms
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   150
apply(erule_tac c="(c, x)" in at_set_avoiding)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   151
apply(simp add: supp_Pair)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   152
apply(rule_tac x="p" in exI)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   153
apply(simp add: fresh_star_prod)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   154
apply(subgoal_tac "\<forall>a \<in> supp p. a \<sharp> x")
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   155
apply(auto simp add: fresh_star_def fresh_def supp_perm)[1]
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   156
apply(auto simp add: fresh_star_def fresh_def)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   157
done
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   158
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   159
lemma at_set_avoiding2_atom:
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   160
  assumes "finite (supp c)" "finite (supp x)"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   161
  and     b: "xa \<sharp> x"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   162
  shows "\<exists>p. (p \<bullet> xa) \<sharp> c \<and> supp x \<sharp>* p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   163
proof -
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   164
  have a: "{xa} \<sharp>* x" unfolding fresh_star_def by (simp add: b)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   165
  obtain p where p1: "(p \<bullet> {xa}) \<sharp>* c" and p2: "supp x \<sharp>* p"
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   166
    using at_set_avoiding2[of "{xa}" "c" "x"] assms a by blast
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   167
  have c: "(p \<bullet> xa) \<sharp> c" using p1
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   168
    unfolding fresh_star_def Ball_def 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   169
    by (erule_tac x="p \<bullet> xa" in allE) (simp add: eqvts)
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   170
  hence "p \<bullet> xa \<sharp> c \<and> supp x \<sharp>* p" using p2 by blast
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   171
  then show ?thesis by blast
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   172
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   173
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   174
section {* The freshness lemma according to Andrew Pitts *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   175
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   176
lemma freshness_lemma:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   177
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   178
  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
   179
  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
   180
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   181
  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
   182
    by (auto simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   183
  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
   184
  proof (intro exI allI impI)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   185
    fix a :: 'a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   186
    assume a3: "atom a \<sharp> h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   187
    show "h a = h b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   188
    proof (cases "a = b")
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   189
      assume "a = b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   190
      thus "h a = h b" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   191
    next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   192
      assume "a \<noteq> b"
1080
2f1377bb4e1f fixed lemma name
Christian Urban <urbanc@in.tum.de>
parents: 1062
diff changeset
   193
      hence "atom a \<sharp> b" by (simp add: fresh_at_base)
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   194
      with a3 have "atom a \<sharp> h b" 
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   195
	by (rule fresh_fun_app)
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   196
      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
   197
        by (rule swap_fresh_fresh)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   198
      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
   199
        by (rule swap_fresh_fresh)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   200
      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
   201
      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
   202
        by (rule permute_fun_app_eq)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   203
      also have "\<dots> = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   204
        using d2 by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   205
      finally show "h a = h b"  by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   206
    qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   207
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   208
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   209
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   210
lemma freshness_lemma_unique:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   211
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   212
  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
   213
  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
   214
proof (rule ex_ex1I)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   215
  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
   216
    by (rule freshness_lemma)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   217
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   218
  fix x y
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   219
  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
   220
  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
   221
  from a x y show "x = y"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   222
    by (auto simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   223
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   224
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   225
text {* packaging the freshness lemma into a function *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   226
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   227
definition
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   228
  fresh_fun :: "('a::at \<Rightarrow> 'b::pt) \<Rightarrow> 'b"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   229
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   230
  "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
   231
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   232
lemma fresh_fun_app:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   233
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   234
  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
   235
  assumes b: "atom a \<sharp> h"
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
unfolding fresh_fun_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   238
proof (rule the_equality)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   239
  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
   240
  proof (intro strip)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   241
    fix a':: 'a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   242
    assume c: "atom a' \<sharp> h"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   243
    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
   244
    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
   245
  qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   246
next
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   247
  fix fr :: 'b
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   248
  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
   249
  with b show "fr = h a" by auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   250
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   251
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   252
lemma fresh_fun_app':
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   253
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   254
  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
   255
  shows "fresh_fun h = h a"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   256
  apply (rule fresh_fun_app)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   257
  apply (auto simp add: fresh_Pair intro: a)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   258
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   259
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   260
lemma fresh_fun_eqvt:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   261
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   262
  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
   263
  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
   264
  using a
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   265
  apply (clarsimp simp add: fresh_Pair)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   266
  apply (subst fresh_fun_app', assumption+)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   267
  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
   268
  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
   269
  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
   270
  apply (erule (1) fresh_fun_app' [symmetric])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   271
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   272
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   273
lemma fresh_fun_supports:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   274
  fixes h :: "'a::at \<Rightarrow> 'b::pt"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   275
  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
   276
  shows "(supp h) supports (fresh_fun h)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   277
  apply (simp add: supports_def fresh_def [symmetric])
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   278
  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
   279
  done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   280
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   281
notation fresh_fun (binder "FRESH " 10)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   282
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   283
lemma FRESH_f_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   284
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   285
  fixes f :: "'b \<Rightarrow> 'c::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   286
  assumes P: "finite (supp P)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   287
  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
   288
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   289
  obtain a::'a where "atom a \<notin> supp P"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   290
    using P by (rule obtain_at_base)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   291
  hence "atom a \<sharp> P"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   292
    by (simp add: fresh_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   293
  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
   294
    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
   295
    apply (cut_tac `atom a \<sharp> P`)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   296
    apply (simp add: fresh_conv_MOST)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   297
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   298
    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
   299
    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
   300
    apply (rule refl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   301
    done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   302
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   303
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   304
lemma FRESH_binop_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   305
  fixes P :: "'a::at \<Rightarrow> 'b::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   306
  fixes Q :: "'a::at \<Rightarrow> 'c::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   307
  fixes binop :: "'b \<Rightarrow> 'c \<Rightarrow> 'd::pure"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   308
  assumes P: "finite (supp P)" 
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   309
  and     Q: "finite (supp Q)"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   310
  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
   311
proof -
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   312
  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
   313
  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
   314
    by (rule obtain_at_base)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   315
  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
   316
    by (simp_all add: fresh_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   317
  show ?thesis
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   318
    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
   319
    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
   320
    apply (simp add: fresh_conv_MOST)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   321
    apply (elim MOST_rev_mp, rule MOST_I, clarify)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   322
    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
   323
    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
   324
    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
   325
    apply (rule refl)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   326
    done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   327
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   328
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   329
lemma FRESH_conj_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   330
  fixes P Q :: "'a::at \<Rightarrow> bool"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   331
  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
   332
  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
   333
using P Q by (rule FRESH_binop_iff)
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 FRESH_disj_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   336
  fixes P Q :: "'a::at \<Rightarrow> bool"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   337
  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
   338
  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
   339
using P Q by (rule FRESH_binop_iff)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   340
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   341
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   342
section {* An example of a function without finite support *}
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   343
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   344
primrec
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   345
  nat_of :: "atom \<Rightarrow> nat"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   346
where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   347
  "nat_of (Atom s n) = n"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   348
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   349
lemma atom_eq_iff:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   350
  fixes a b :: atom
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   351
  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
   352
  by (induct a, induct b, simp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   353
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   354
lemma not_fresh_nat_of:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   355
  shows "\<not> a \<sharp> nat_of"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   356
unfolding fresh_def supp_def
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   357
proof (clarsimp)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   358
  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
   359
  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
   360
    by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   361
  then obtain b where
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   362
    b1: "b \<noteq> a" and
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   363
    b2: "sort_of b = sort_of a" and
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   364
    b3: "(a \<rightleftharpoons> b) \<bullet> nat_of = nat_of"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   365
    by (rule obtain_atom) auto
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   366
  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
   367
  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
   368
  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
   369
  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
   370
  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
   371
  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
   372
  with b1 show "False" by simp
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   373
qed
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   374
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   375
lemma supp_nat_of:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   376
  shows "supp nat_of = UNIV"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   377
  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
   378
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   379
1879
869d1183e082 tuned proofs
Christian Urban <urbanc@in.tum.de>
parents: 1861
diff changeset
   380
section {* Support for finite sets of atoms *}
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   381
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   382
lemma supp_finite_atom_set:
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   383
  fixes S::"atom set"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   384
  assumes "finite S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   385
  shows "supp S = S"
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   386
  apply(rule finite_supp_unique)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   387
  apply(simp add: supports_def)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   388
  apply(simp add: swap_set_not_in)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   389
  apply(rule assms)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   390
  apply(simp add: swap_set_in)
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   391
done
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   392
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   393
text {* Induction principle for permutations *}
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   394
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   395
lemma perm_subset_induct_aux [consumes 1, case_names zero swap plus]:
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   396
  assumes S: "supp p \<subseteq> S"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   397
  assumes zero: "P 0"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   398
  assumes swap: "\<And>a b. supp (a \<rightleftharpoons> b) \<subseteq> S \<Longrightarrow> P (a \<rightleftharpoons> b)"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   399
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   400
  shows "P p"
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   401
proof -
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   402
  have "finite (supp p)" by (simp add: finite_supp)
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   403
  then show ?thesis using S
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   404
  proof(induct A\<equiv>"supp p" arbitrary: p rule: finite_psubset_induct)
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   405
    case (psubset p)
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   406
    then have ih: "\<And>q. supp q \<subset> supp p \<Longrightarrow> P q" by auto
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   407
    have as: "supp p \<subseteq> S" by fact
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   408
    { assume "supp p = {}"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   409
      then have "p = 0" by (simp add: supp_perm expand_perm_eq)
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   410
      then have "P p" using zero by simp
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   411
    }
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   412
    moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   413
    { assume "supp p \<noteq> {}"
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   414
      then obtain a where a0: "a \<in> supp p" by blast
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   415
      then have a1: "supp (- p \<bullet> a \<rightleftharpoons> a) \<subseteq> S" using as
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   416
	by (auto simp add: supp_atom supp_perm swap_atom)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   417
      let ?q = "p + (- p \<bullet> a \<rightleftharpoons> a)"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   418
      have a2: "supp ?q \<subseteq> supp p" unfolding supp_perm by (auto simp add: swap_atom)
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   419
      moreover
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   420
      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
   421
      then have "supp ?q \<noteq> supp p" using a0 by auto
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   422
      ultimately have "supp ?q \<subset> supp p" using as by auto
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   423
      then have "P ?q" using ih by simp
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   424
      moreover
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   425
      have "supp ?q \<subseteq> S" using as a2 by simp
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   426
      moreover
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   427
      have "P (- p \<bullet> a \<rightleftharpoons> a)" using a1 swap by simp
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   428
      ultimately 
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   429
      have "P (?q + (- p \<bullet> a \<rightleftharpoons> a))" using a1 plus by simp
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   430
      moreover 
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   431
      have "p = ?q + (- p \<bullet> a \<rightleftharpoons> a)" by (simp add: expand_perm_eq)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   432
      ultimately have "P p" by simp
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   433
    }
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   434
    ultimately show "P p" by blast
1777
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   435
  qed
4f41a0884b22 isarfied proof about existence of a permutation list
Christian Urban <urbanc@in.tum.de>
parents: 1774
diff changeset
   436
qed
1062
dfea9e739231 rollback of the test
Christian Urban <urbanc@in.tum.de>
parents: 1061
diff changeset
   437
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   438
lemma perm_subset_induct [consumes 1, case_names zero swap plus]:
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   439
  assumes S: "supp p \<subseteq> S"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   440
  assumes zero: "P 0"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   441
  assumes swap: "\<And>a b. \<lbrakk>sort_of a = sort_of b; a \<noteq> b; a \<in> S; b \<in> S\<rbrakk> \<Longrightarrow> P (a \<rightleftharpoons> b)"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   442
  assumes plus: "\<And>p1 p2. \<lbrakk>P p1; P p2; supp p1 \<subseteq> S; supp p2 \<subseteq> S\<rbrakk> \<Longrightarrow> P (p1 + p2)"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   443
  shows "P p"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   444
apply(rule perm_subset_induct_aux[OF S])
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   445
apply(auto simp add: zero swap plus supp_swap split: if_splits)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   446
done
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   447
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   448
lemma supp_perm_eq:
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   449
  assumes "(supp x) \<sharp>* p"
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   450
  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
   451
proof -
1778
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   452
  from assms have "supp p \<subseteq> {a. a \<sharp> x}"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   453
    unfolding supp_perm fresh_star_def fresh_def by auto
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   454
  then show "p \<bullet> x = x"
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   455
  proof (induct p rule: perm_subset_induct)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   456
    case zero
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   457
    show "0 \<bullet> x = x" by simp
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   458
  next
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   459
    case (swap a b)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   460
    then have "a \<sharp> x" "b \<sharp> x" by simp_all
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   461
    then show "(a \<rightleftharpoons> b) \<bullet> x = x" by (simp add: swap_fresh_fresh)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   462
  next
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   463
    case (plus p1 p2)
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   464
    have "p1 \<bullet> x = x" "p2 \<bullet> x = x" by fact+
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   465
    then show "(p1 + p2) \<bullet> x = x" by simp
88ec05a09772 added an induction principle for permutations; removed add_perm construction
Christian Urban <urbanc@in.tum.de>
parents: 1777
diff changeset
   466
  qed
1563
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   467
qed
eb60f360a200 moved lemmas supp_perm_eq and exists_perm to Nominal2_Supp
Christian Urban <urbanc@in.tum.de>
parents: 1506
diff changeset
   468
1567
8f28e749d92b Fixed missing colon.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1564
diff changeset
   469
end