Nominal/Nominal2_FSet.thy
author Christian Urban <urbanc@in.tum.de>
Mon, 18 Oct 2010 09:42:51 +0100
changeset 2545 9746421224a3
parent 2542 1f5c8e85c41f
child 2550 551c5a8b6b2c
permissions -rw-r--r--
added missing style file
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     1
theory Nominal2_FSet
2467
67b3933c3190 got rid of Nominal_Atoms (folded into Nominal2_Base)
Christian Urban <urbanc@in.tum.de>
parents: 2466
diff changeset
     2
imports "../Nominal-General/Nominal2_Base"
2302
c6db12ddb60c intermediate state
Christian Urban <urbanc@in.tum.de>
parents: 2178
diff changeset
     3
        "../Nominal-General/Nominal2_Eqvt" 
1806
Christian Urban <urbanc@in.tum.de>
parents: 1782
diff changeset
     4
        FSet 
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     5
begin
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
     6
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
     7
lemma permute_fset_rsp[quot_respect]:
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
     8
  shows "(op = ===> list_eq ===> list_eq) permute permute"
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
     9
  by (simp add: set_eqvt[symmetric])
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    10
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    11
instantiation fset :: (pt) pt
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    12
begin
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    13
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
quotient_definition
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
  "permute_fset :: perm \<Rightarrow> 'a fset \<Rightarrow> 'a fset"
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
is
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    17
  "permute :: perm \<Rightarrow> 'a list \<Rightarrow> 'a list"
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
1815
4135198bbb8a moved equivariance of map into Nominal2_Eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1806
diff changeset
    19
instance 
4135198bbb8a moved equivariance of map into Nominal2_Eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1806
diff changeset
    20
proof
1782
27fec5fcfe67 simplify instance proof
Brian Huffman <brianh@cs.pdx.edu>
parents: 1774
diff changeset
    21
  fix x :: "'a fset" and p q :: "perm"
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    22
  show "0 \<bullet> x = x" by (descending) (simp)
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    23
  show "(p + q) \<bullet> x = p \<bullet> q \<bullet> x" by (descending) (simp)
1782
27fec5fcfe67 simplify instance proof
Brian Huffman <brianh@cs.pdx.edu>
parents: 1774
diff changeset
    24
qed
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    25
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
end
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2447
diff changeset
    28
lemma permute_fset[simp, eqvt]:
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    29
  fixes S::"('a::pt) fset"
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    30
  shows "(p \<bullet> {||}) = ({||} ::('a::pt) fset)"
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    31
  and   "(p \<bullet> insert_fset x S) = insert_fset (p \<bullet> x) (p \<bullet> S)"
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    32
  by (lifting permute_list.simps)
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    33
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    34
lemma map_fset_eqvt[eqvt]: 
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    35
  shows "p \<bullet> (map_fset f S) = map_fset (p \<bullet> f) (p \<bullet> S)"
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    36
  by (lifting map_eqvt)
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    37
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    38
lemma fset_eqvt[eqvt]: 
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    39
  shows "p \<bullet> (fset S) = fset (p \<bullet> S)"
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    40
  by (lifting set_eqvt)
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    41
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    42
lemma supp_fset [simp]:
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    43
  shows "supp (fset S) = supp S"
2340
b1549d391ea7 removed an "eqvt"-warning
Christian Urban <urbanc@in.tum.de>
parents: 2302
diff changeset
    44
  unfolding supp_def
b1549d391ea7 removed an "eqvt"-warning
Christian Urban <urbanc@in.tum.de>
parents: 2302
diff changeset
    45
  by (perm_simp) (simp add: fset_cong)
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    46
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    47
lemma supp_empty_fset [simp]:
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    48
  shows "supp {||} = {}"
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    49
  unfolding supp_def
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    50
  by simp
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    51
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    52
lemma supp_insert_fset [simp]:
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    53
  fixes x::"'a::fs"
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    54
  and   S::"'a fset"
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    55
  shows "supp (insert_fset x S) = supp x \<union> supp S"
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    56
  apply(subst supp_fset[symmetric])
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    57
  apply(simp add: supp_fset supp_of_fin_insert)
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    58
  done
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    59
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    60
lemma fset_finite_supp:
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    61
  fixes S::"('a::fs) fset"
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    62
  shows "finite (supp S)"
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    63
  by (induct S) (simp_all add: finite_supp)
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    64
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    65
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    66
subsection {* finite sets are fs-types *}
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    67
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    68
instance fset :: (fs) fs
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    69
  apply (default)
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    70
  apply (rule fset_finite_supp)
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    71
  done
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    72
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    73
lemma atom_map_fset_cong:
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    74
  shows "map_fset atom x = map_fset atom y \<longleftrightarrow> x = y"
2542
1f5c8e85c41f all tests work again
Christian Urban <urbanc@in.tum.de>
parents: 2540
diff changeset
    75
  apply(rule inj_map_fset_cong)
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    76
  apply(simp add: inj_on_def)
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    77
  done
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    78
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    79
lemma supp_map_fset_atom:
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    80
  shows "supp (map_fset atom S) = supp S"
1818
37480540c1af made everything to compile
Christian Urban <urbanc@in.tum.de>
parents: 1815
diff changeset
    81
  unfolding supp_def
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
    82
  apply(perm_simp)
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    83
  apply(simp add: atom_map_fset_cong)
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    84
  done
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    85
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    86
lemma supp_at_fset:
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
    87
  fixes S::"('a::at_base) fset"
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    88
  shows "supp S = fset (map_fset atom S)"
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
    89
  apply (induct S)
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    90
  apply (simp add: supp_empty_fset)
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    91
  apply (simp add: supp_insert_fset)
1542
63e327e95abd Showed the instance: fset::(at) fs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    92
  apply (simp add: supp_at_base)
63e327e95abd Showed the instance: fset::(at) fs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    93
  done
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    94
2178
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
    95
lemma fresh_star_atom:
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    96
  fixes a::"'a::at_base"
2524
693562f03eee major reorganisation of fset (renamed fset_to_set to fset, changed the definition of list_eq and fcard_raw)
Christian Urban <urbanc@in.tum.de>
parents: 2471
diff changeset
    97
  shows "fset S \<sharp>* a \<Longrightarrow> atom a \<sharp> fset S"
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    98
  apply (induct S)
2178
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
    99
  apply (simp add: fresh_set_empty)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   100
  apply simp
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   101
  apply (unfold fresh_def)
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2447
diff changeset
   102
  apply (simp add: supp_of_fin_insert)
2178
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   103
  apply (rule conjI)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   104
  apply (unfold fresh_star_def)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   105
  apply simp
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   106
  apply (unfold fresh_def)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   107
  apply (simp add: supp_at_base supp_atom)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   108
  apply clarify
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   109
  apply auto
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   110
  done
2004
b96e8cf86891 generalised the fs-instance lemma (not just fsets of atoms are finitely supported, but also fsets of finitely supported elements)
Christian Urban <urbanc@in.tum.de>
parents: 1973
diff changeset
   111
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   112
end