Nominal/Nominal2_FSet.thy
author Christian Urban <urbanc@in.tum.de>
Wed, 10 Nov 2010 13:46:21 +0000
changeset 2559 add799cf0817
parent 2550 551c5a8b6b2c
child 2565 6bf332360510
permissions -rw-r--r--
adapted to changes by Florian on the quotient package and removed local fix for function package
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" 
2550
551c5a8b6b2c Remove FSet and use the one from Isabelle
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2542
diff changeset
     4
        "$ISABELLE_HOME/src/HOL/Quotient_Examples/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"
2559
add799cf0817 adapted to changes by Florian on the quotient package and removed local fix for function package
Christian Urban <urbanc@in.tum.de>
parents: 2550
diff changeset
     9
  unfolding fun_rel_def
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    10
  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
    11
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
    12
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
    13
begin
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    14
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    15
quotient_definition
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    16
  "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
    17
is
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    18
  "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
    19
1815
4135198bbb8a moved equivariance of map into Nominal2_Eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1806
diff changeset
    20
instance 
4135198bbb8a moved equivariance of map into Nominal2_Eqvt file
Christian Urban <urbanc@in.tum.de>
parents: 1806
diff changeset
    21
proof
1782
27fec5fcfe67 simplify instance proof
Brian Huffman <brianh@cs.pdx.edu>
parents: 1774
diff changeset
    22
  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
    23
  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
    24
  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
    25
qed
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    26
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    27
end
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    28
2466
47c840599a6b cleaned a bit various thy-files in Nominal-General
Christian Urban <urbanc@in.tum.de>
parents: 2447
diff changeset
    29
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
    30
  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
    31
  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
    32
  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
    33
  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
    34
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    35
lemma map_fset_eqvt[eqvt]: 
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    36
  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
    37
  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
    38
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
    39
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
    40
  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
    41
  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
    42
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    43
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
    44
  shows "supp (fset S) = supp S"
2340
b1549d391ea7 removed an "eqvt"-warning
Christian Urban <urbanc@in.tum.de>
parents: 2302
diff changeset
    45
  unfolding supp_def
b1549d391ea7 removed an "eqvt"-warning
Christian Urban <urbanc@in.tum.de>
parents: 2302
diff changeset
    46
  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
    47
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    48
lemma supp_empty_fset [simp]:
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    49
  shows "supp {||} = {}"
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    50
  unfolding supp_def
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    51
  by simp
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    52
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    53
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
    54
  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
    55
  and   S::"'a fset"
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    56
  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
    57
  apply(subst supp_fset[symmetric])
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    58
  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
    59
  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
    60
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    61
lemma fset_finite_supp:
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    62
  fixes S::"('a::fs) fset"
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    63
  shows "finite (supp S)"
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    64
  by (induct S) (simp_all add: finite_supp)
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
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    67
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
    68
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
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
    70
  apply (default)
2535
05f98e2ee48b slight update
Christian Urban <urbanc@in.tum.de>
parents: 2524
diff changeset
    71
  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
    72
  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
    73
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    74
lemma atom_map_fset_cong:
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    75
  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
    76
  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
    77
  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
    78
  done
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    79
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    80
lemma supp_map_fset_atom:
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    81
  shows "supp (map_fset atom S) = supp S"
1818
37480540c1af made everything to compile
Christian Urban <urbanc@in.tum.de>
parents: 1815
diff changeset
    82
  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
    83
  apply(perm_simp)
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    84
  apply(simp add: atom_map_fset_cong)
1568
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    85
  done
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    86
2311a9fc4624 Strong induction for Type Schemes.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1542
diff changeset
    87
lemma supp_at_fset:
1973
fc5ce7f22b74 use the more general type-class at_base
Christian Urban <urbanc@in.tum.de>
parents: 1933
diff changeset
    88
  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
    89
  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
    90
  apply (induct S)
2540
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    91
  apply (simp add: supp_empty_fset)
135ac0fb2686 naming scheme is now *_fset (not f*_)
Christian Urban <urbanc@in.tum.de>
parents: 2535
diff changeset
    92
  apply (simp add: supp_insert_fset)
1542
63e327e95abd Showed the instance: fset::(at) fs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    93
  apply (simp add: supp_at_base)
63e327e95abd Showed the instance: fset::(at) fs
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 1534
diff changeset
    94
  done
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
    95
2178
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
    96
lemma fresh_star_atom:
2447
76be909eaf04 slight cleaning
Christian Urban <urbanc@in.tum.de>
parents: 2340
diff changeset
    97
  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
    98
  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
    99
  apply (induct S)
2178
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   100
  apply (simp add: fresh_set_empty)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   101
  apply simp
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   102
  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
   103
  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
   104
  apply (rule conjI)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   105
  apply (unfold fresh_star_def)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   106
  apply simp
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   107
  apply (unfold fresh_def)
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   108
  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
   109
  apply clarify
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   110
  apply auto
e559513143e9 reversing the direction of fresh_star
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents: 2004
diff changeset
   111
  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
   112
1534
984ea1299cd7 The nominal infrastructure for fset. 'fs' missing, but not needed so far.
Cezary Kaliszyk <kaliszyk@in.tum.de>
parents:
diff changeset
   113
end