src/CCL/Set.thy
author wenzelm
Sat, 21 Nov 2009 17:01:44 +0100
changeset 33834 7c06e19f717c
parent 32153 a0e57fb1b930
child 35054 a5db9779b026
permissions -rw-r--r--
adapted local theory operations -- eliminated odd kind;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
17456
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     1
header {* Extending FOL by a modified version of HOL set theory *}
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     2
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     3
theory Set
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     4
imports FOL
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     5
begin
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
     6
3935
52c14fe8f16b adapted to qualified names;
wenzelm
parents: 3837
diff changeset
     7
global
52c14fe8f16b adapted to qualified names;
wenzelm
parents: 3837
diff changeset
     8
17456
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
     9
typedecl 'a set
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    10
arities set :: ("term") "term"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    11
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    12
consts
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    13
  Collect       :: "['a => o] => 'a set"                    (*comprehension*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    14
  Compl         :: "('a set) => 'a set"                     (*complement*)
24825
c4f13ab78f9d avoid unnamed infixes;
wenzelm
parents: 20140
diff changeset
    15
  Int           :: "['a set, 'a set] => 'a set"         (infixl "Int" 70)
c4f13ab78f9d avoid unnamed infixes;
wenzelm
parents: 20140
diff changeset
    16
  Un            :: "['a set, 'a set] => 'a set"         (infixl "Un" 65)
17456
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    17
  Union         :: "(('a set)set) => 'a set"                (*...of a set*)
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    18
  Inter         :: "(('a set)set) => 'a set"                (*...of a set*)
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    19
  UNION         :: "['a set, 'a => 'b set] => 'b set"       (*general*)
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    20
  INTER         :: "['a set, 'a => 'b set] => 'b set"       (*general*)
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    21
  Ball          :: "['a set, 'a => o] => o"                 (*bounded quants*)
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    22
  Bex           :: "['a set, 'a => o] => o"                 (*bounded quants*)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    23
  mono          :: "['a set => 'b set] => o"                (*monotonicity*)
24825
c4f13ab78f9d avoid unnamed infixes;
wenzelm
parents: 20140
diff changeset
    24
  mem           :: "['a, 'a set] => o"                  (infixl ":" 50) (*membership*)
c4f13ab78f9d avoid unnamed infixes;
wenzelm
parents: 20140
diff changeset
    25
  subset        :: "['a set, 'a set] => o"              (infixl "<=" 50)
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    26
  singleton     :: "'a => 'a set"                       ("{_}")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    27
  empty         :: "'a set"                             ("{}")
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    28
3935
52c14fe8f16b adapted to qualified names;
wenzelm
parents: 3837
diff changeset
    29
syntax
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    30
  "@Coll"       :: "[idt, o] => 'a set"                 ("(1{_./ _})") (*collection*)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    31
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    32
  (* Big Intersection / Union *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    33
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    34
  "@INTER"      :: "[idt, 'a set, 'b set] => 'b set"    ("(INT _:_./ _)" [0, 0, 0] 10)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    35
  "@UNION"      :: "[idt, 'a set, 'b set] => 'b set"    ("(UN _:_./ _)" [0, 0, 0] 10)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    36
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    37
  (* Bounded Quantifiers *)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    38
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    39
  "@Ball"       :: "[idt, 'a set, o] => o"              ("(ALL _:_./ _)" [0, 0, 0] 10)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    40
  "@Bex"        :: "[idt, 'a set, o] => o"              ("(EX _:_./ _)" [0, 0, 0] 10)
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    41
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    42
translations
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    43
  "{x. P}"      == "Collect(%x. P)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    44
  "INT x:A. B"  == "INTER(A, %x. B)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    45
  "UN x:A. B"   == "UNION(A, %x. B)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    46
  "ALL x:A. P"  == "Ball(A, %x. P)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    47
  "EX x:A. P"   == "Bex(A, %x. P)"
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    48
3935
52c14fe8f16b adapted to qualified names;
wenzelm
parents: 3837
diff changeset
    49
local
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    50
17456
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    51
axioms
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    52
  mem_Collect_iff:       "(a : {x. P(x)}) <-> P(a)"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    53
  set_extension:         "A=B <-> (ALL x. x:A <-> x:B)"
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
    54
17456
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    55
defs
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    56
  Ball_def:      "Ball(A, P)  == ALL x. x:A --> P(x)"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    57
  Bex_def:       "Bex(A, P)   == EX x. x:A & P(x)"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    58
  mono_def:      "mono(f)     == (ALL A B. A <= B --> f(A) <= f(B))"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    59
  subset_def:    "A <= B      == ALL x:A. x:B"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    60
  singleton_def: "{a}         == {x. x=a}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    61
  empty_def:     "{}          == {x. False}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    62
  Un_def:        "A Un B      == {x. x:A | x:B}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    63
  Int_def:       "A Int B     == {x. x:A & x:B}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    64
  Compl_def:     "Compl(A)    == {x. ~x:A}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    65
  INTER_def:     "INTER(A, B) == {y. ALL x:A. y: B(x)}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    66
  UNION_def:     "UNION(A, B) == {y. EX x:A. y: B(x)}"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    67
  Inter_def:     "Inter(S)    == (INT x:S. x)"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    68
  Union_def:     "Union(S)    == (UN x:S. x)"
bcf7544875b2 converted to Isar theory format;
wenzelm
parents: 3935
diff changeset
    69
20140
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    70
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    71
lemma CollectI: "[| P(a) |] ==> a : {x. P(x)}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    72
  apply (rule mem_Collect_iff [THEN iffD2])
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    73
  apply assumption
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    74
  done
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    75
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    76
lemma CollectD: "[| a : {x. P(x)} |] ==> P(a)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    77
  apply (erule mem_Collect_iff [THEN iffD1])
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    78
  done
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    79
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    80
lemmas CollectE = CollectD [elim_format]
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    81
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    82
lemma set_ext: "[| !!x. x:A <-> x:B |] ==> A = B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    83
  apply (rule set_extension [THEN iffD2])
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    84
  apply simp
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    85
  done
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    86
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    87
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    88
subsection {* Bounded quantifiers *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    89
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    90
lemma ballI: "[| !!x. x:A ==> P(x) |] ==> ALL x:A. P(x)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    91
  by (simp add: Ball_def)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    92
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    93
lemma bspec: "[| ALL x:A. P(x);  x:A |] ==> P(x)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    94
  by (simp add: Ball_def)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    95
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    96
lemma ballE: "[| ALL x:A. P(x);  P(x) ==> Q;  ~ x:A ==> Q |] ==> Q"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    97
  unfolding Ball_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    98
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
    99
lemma bexI: "[| P(x);  x:A |] ==> EX x:A. P(x)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   100
  unfolding Bex_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   101
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   102
lemma bexCI: "[| EX x:A. ~P(x) ==> P(a);  a:A |] ==> EX x:A. P(x)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   103
  unfolding Bex_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   104
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   105
lemma bexE: "[| EX x:A. P(x);  !!x. [| x:A; P(x) |] ==> Q  |] ==> Q"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   106
  unfolding Bex_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   107
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   108
(*Trival rewrite rule;   (! x:A.P)=P holds only if A is nonempty!*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   109
lemma ball_rew: "(ALL x:A. True) <-> True"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   110
  by (blast intro: ballI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   111
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   112
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   113
subsection {* Congruence rules *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   114
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   115
lemma ball_cong:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   116
  "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==>
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   117
    (ALL x:A. P(x)) <-> (ALL x:A'. P'(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   118
  by (blast intro: ballI elim: ballE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   119
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   120
lemma bex_cong:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   121
  "[| A=A';  !!x. x:A' ==> P(x) <-> P'(x) |] ==>
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   122
    (EX x:A. P(x)) <-> (EX x:A'. P'(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   123
  by (blast intro: bexI elim: bexE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   124
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   125
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   126
subsection {* Rules for subsets *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   127
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   128
lemma subsetI: "(!!x. x:A ==> x:B) ==> A <= B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   129
  unfolding subset_def by (blast intro: ballI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   130
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   131
(*Rule in Modus Ponens style*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   132
lemma subsetD: "[| A <= B;  c:A |] ==> c:B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   133
  unfolding subset_def by (blast elim: ballE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   134
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   135
(*Classical elimination rule*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   136
lemma subsetCE: "[| A <= B;  ~(c:A) ==> P;  c:B ==> P |] ==> P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   137
  by (blast dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   138
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   139
lemma subset_refl: "A <= A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   140
  by (blast intro: subsetI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   141
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   142
lemma subset_trans: "[| A<=B;  B<=C |] ==> A<=C"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   143
  by (blast intro: subsetI dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   144
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   145
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   146
subsection {* Rules for equality *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   147
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   148
(*Anti-symmetry of the subset relation*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   149
lemma subset_antisym: "[| A <= B;  B <= A |] ==> A = B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   150
  by (blast intro: set_ext dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   151
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   152
lemmas equalityI = subset_antisym
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   153
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   154
(* Equality rules from ZF set theory -- are they appropriate here? *)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   155
lemma equalityD1: "A = B ==> A<=B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   156
  and equalityD2: "A = B ==> B<=A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   157
  by (simp_all add: subset_refl)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   158
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   159
lemma equalityE: "[| A = B;  [| A<=B; B<=A |] ==> P |]  ==>  P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   160
  by (simp add: subset_refl)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   161
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   162
lemma equalityCE:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   163
    "[| A = B;  [| c:A; c:B |] ==> P;  [| ~ c:A; ~ c:B |] ==> P |]  ==>  P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   164
  by (blast elim: equalityE subsetCE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   165
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   166
lemma trivial_set: "{x. x:A} = A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   167
  by (blast intro: equalityI subsetI CollectI dest: CollectD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   168
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   169
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   170
subsection {* Rules for binary union *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   171
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   172
lemma UnI1: "c:A ==> c : A Un B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   173
  and UnI2: "c:B ==> c : A Un B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   174
  unfolding Un_def by (blast intro: CollectI)+
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   175
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   176
(*Classical introduction rule: no commitment to A vs B*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   177
lemma UnCI: "(~c:B ==> c:A) ==> c : A Un B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   178
  by (blast intro: UnI1 UnI2)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   179
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   180
lemma UnE: "[| c : A Un B;  c:A ==> P;  c:B ==> P |] ==> P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   181
  unfolding Un_def by (blast dest: CollectD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   182
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   183
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   184
subsection {* Rules for small intersection *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   185
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   186
lemma IntI: "[| c:A;  c:B |] ==> c : A Int B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   187
  unfolding Int_def by (blast intro: CollectI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   188
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   189
lemma IntD1: "c : A Int B ==> c:A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   190
  and IntD2: "c : A Int B ==> c:B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   191
  unfolding Int_def by (blast dest: CollectD)+
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   192
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   193
lemma IntE: "[| c : A Int B;  [| c:A; c:B |] ==> P |] ==> P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   194
  by (blast dest: IntD1 IntD2)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   195
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   196
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   197
subsection {* Rules for set complement *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   198
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   199
lemma ComplI: "[| c:A ==> False |] ==> c : Compl(A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   200
  unfolding Compl_def by (blast intro: CollectI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   201
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   202
(*This form, with negated conclusion, works well with the Classical prover.
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   203
  Negated assumptions behave like formulae on the right side of the notional
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   204
  turnstile...*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   205
lemma ComplD: "[| c : Compl(A) |] ==> ~c:A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   206
  unfolding Compl_def by (blast dest: CollectD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   207
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   208
lemmas ComplE = ComplD [elim_format]
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   209
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   210
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   211
subsection {* Empty sets *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   212
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   213
lemma empty_eq: "{x. False} = {}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   214
  by (simp add: empty_def)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   215
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   216
lemma emptyD: "a : {} ==> P"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   217
  unfolding empty_def by (blast dest: CollectD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   218
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   219
lemmas emptyE = emptyD [elim_format]
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   220
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   221
lemma not_emptyD:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   222
  assumes "~ A={}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   223
  shows "EX x. x:A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   224
proof -
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   225
  have "\<not> (EX x. x:A) \<Longrightarrow> A = {}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   226
    by (rule equalityI) (blast intro!: subsetI elim!: emptyD)+
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   227
  with prems show ?thesis by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   228
qed
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   229
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   230
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   231
subsection {* Singleton sets *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   232
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   233
lemma singletonI: "a : {a}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   234
  unfolding singleton_def by (blast intro: CollectI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   235
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   236
lemma singletonD: "b : {a} ==> b=a"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   237
  unfolding singleton_def by (blast dest: CollectD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   238
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   239
lemmas singletonE = singletonD [elim_format]
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   240
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   241
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   242
subsection {* Unions of families *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   243
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   244
(*The order of the premises presupposes that A is rigid; b may be flexible*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   245
lemma UN_I: "[| a:A;  b: B(a) |] ==> b: (UN x:A. B(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   246
  unfolding UNION_def by (blast intro: bexI CollectI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   247
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   248
lemma UN_E: "[| b : (UN x:A. B(x));  !!x.[| x:A;  b: B(x) |] ==> R |] ==> R"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   249
  unfolding UNION_def by (blast dest: CollectD elim: bexE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   250
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   251
lemma UN_cong:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   252
  "[| A=B;  !!x. x:B ==> C(x) = D(x) |] ==>
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   253
    (UN x:A. C(x)) = (UN x:B. D(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   254
  by (simp add: UNION_def cong: bex_cong)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   255
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   256
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   257
subsection {* Intersections of families *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   258
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   259
lemma INT_I: "(!!x. x:A ==> b: B(x)) ==> b : (INT x:A. B(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   260
  unfolding INTER_def by (blast intro: CollectI ballI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   261
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   262
lemma INT_D: "[| b : (INT x:A. B(x));  a:A |] ==> b: B(a)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   263
  unfolding INTER_def by (blast dest: CollectD bspec)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   264
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   265
(*"Classical" elimination rule -- does not require proving X:C *)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   266
lemma INT_E: "[| b : (INT x:A. B(x));  b: B(a) ==> R;  ~ a:A ==> R |] ==> R"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   267
  unfolding INTER_def by (blast dest: CollectD bspec)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   268
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   269
lemma INT_cong:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   270
  "[| A=B;  !!x. x:B ==> C(x) = D(x) |] ==>
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   271
    (INT x:A. C(x)) = (INT x:B. D(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   272
  by (simp add: INTER_def cong: ball_cong)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   273
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   274
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   275
subsection {* Rules for Unions *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   276
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   277
(*The order of the premises presupposes that C is rigid; A may be flexible*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   278
lemma UnionI: "[| X:C;  A:X |] ==> A : Union(C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   279
  unfolding Union_def by (blast intro: UN_I)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   280
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   281
lemma UnionE: "[| A : Union(C);  !!X.[| A:X;  X:C |] ==> R |] ==> R"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   282
  unfolding Union_def by (blast elim: UN_E)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   283
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   284
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   285
subsection {* Rules for Inter *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   286
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   287
lemma InterI: "[| !!X. X:C ==> A:X |] ==> A : Inter(C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   288
  unfolding Inter_def by (blast intro: INT_I)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   289
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   290
(*A "destruct" rule -- every X in C contains A as an element, but
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   291
  A:X can hold when X:C does not!  This rule is analogous to "spec". *)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   292
lemma InterD: "[| A : Inter(C);  X:C |] ==> A:X"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   293
  unfolding Inter_def by (blast dest: INT_D)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   294
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   295
(*"Classical" elimination rule -- does not require proving X:C *)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   296
lemma InterE: "[| A : Inter(C);  A:X ==> R;  ~ X:C ==> R |] ==> R"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   297
  unfolding Inter_def by (blast elim: INT_E)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   298
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   299
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   300
section {* Derived rules involving subsets; Union and Intersection as lattice operations *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   301
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   302
subsection {* Big Union -- least upper bound of a set *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   303
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   304
lemma Union_upper: "B:A ==> B <= Union(A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   305
  by (blast intro: subsetI UnionI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   306
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   307
lemma Union_least: "[| !!X. X:A ==> X<=C |] ==> Union(A) <= C"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   308
  by (blast intro: subsetI dest: subsetD elim: UnionE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   309
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   310
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   311
subsection {* Big Intersection -- greatest lower bound of a set *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   312
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   313
lemma Inter_lower: "B:A ==> Inter(A) <= B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   314
  by (blast intro: subsetI dest: InterD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   315
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   316
lemma Inter_greatest: "[| !!X. X:A ==> C<=X |] ==> C <= Inter(A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   317
  by (blast intro: subsetI InterI dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   318
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   319
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   320
subsection {* Finite Union -- the least upper bound of 2 sets *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   321
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   322
lemma Un_upper1: "A <= A Un B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   323
  by (blast intro: subsetI UnI1)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   324
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   325
lemma Un_upper2: "B <= A Un B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   326
  by (blast intro: subsetI UnI2)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   327
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   328
lemma Un_least: "[| A<=C;  B<=C |] ==> A Un B <= C"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   329
  by (blast intro: subsetI elim: UnE dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   330
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   331
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   332
subsection {* Finite Intersection -- the greatest lower bound of 2 sets *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   333
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   334
lemma Int_lower1: "A Int B <= A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   335
  by (blast intro: subsetI elim: IntE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   336
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   337
lemma Int_lower2: "A Int B <= B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   338
  by (blast intro: subsetI elim: IntE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   339
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   340
lemma Int_greatest: "[| C<=A;  C<=B |] ==> C <= A Int B"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   341
  by (blast intro: subsetI IntI dest: subsetD)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   342
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   343
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   344
subsection {* Monotonicity *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   345
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   346
lemma monoI: "[| !!A B. A <= B ==> f(A) <= f(B) |] ==> mono(f)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   347
  unfolding mono_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   348
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   349
lemma monoD: "[| mono(f);  A <= B |] ==> f(A) <= f(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   350
  unfolding mono_def by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   351
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   352
lemma mono_Un: "mono(f) ==> f(A) Un f(B) <= f(A Un B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   353
  by (blast intro: Un_least dest: monoD intro: Un_upper1 Un_upper2)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   354
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   355
lemma mono_Int: "mono(f) ==> f(A Int B) <= f(A) Int f(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   356
  by (blast intro: Int_greatest dest: monoD intro: Int_lower1 Int_lower2)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   357
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   358
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   359
subsection {* Automated reasoning setup *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   360
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   361
lemmas [intro!] = ballI subsetI InterI INT_I CollectI ComplI IntI UnCI singletonI
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   362
  and [intro] = bexI UnionI UN_I
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   363
  and [elim!] = bexE UnionE UN_E CollectE ComplE IntE UnE emptyE singletonE
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   364
  and [elim] = ballE InterD InterE INT_D INT_E subsetD subsetCE
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   365
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   366
lemma mem_rews:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   367
  "(a : A Un B)   <->  (a:A | a:B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   368
  "(a : A Int B)  <->  (a:A & a:B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   369
  "(a : Compl(B)) <->  (~a:B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   370
  "(a : {b})      <->  (a=b)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   371
  "(a : {})       <->   False"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   372
  "(a : {x. P(x)}) <->  P(a)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   373
  by blast+
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   374
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   375
lemmas [simp] = trivial_set empty_eq mem_rews
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   376
  and [cong] = ball_cong bex_cong INT_cong UN_cong
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   377
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   378
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   379
section {* Equalities involving union, intersection, inclusion, etc. *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   380
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   381
subsection {* Binary Intersection *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   382
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   383
lemma Int_absorb: "A Int A = A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   384
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   385
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   386
lemma Int_commute: "A Int B  =  B Int A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   387
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   388
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   389
lemma Int_assoc: "(A Int B) Int C  =  A Int (B Int C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   390
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   391
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   392
lemma Int_Un_distrib: "(A Un B) Int C  =  (A Int C) Un (B Int C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   393
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   394
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   395
lemma subset_Int_eq: "(A<=B) <-> (A Int B = A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   396
  by (blast intro: equalityI elim: equalityE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   397
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   398
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   399
subsection {* Binary Union *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   400
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   401
lemma Un_absorb: "A Un A = A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   402
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   403
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   404
lemma Un_commute: "A Un B  =  B Un A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   405
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   406
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   407
lemma Un_assoc: "(A Un B) Un C  =  A Un (B Un C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   408
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   409
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   410
lemma Un_Int_distrib: "(A Int B) Un C  =  (A Un C) Int (B Un C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   411
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   412
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   413
lemma Un_Int_crazy:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   414
    "(A Int B) Un (B Int C) Un (C Int A) = (A Un B) Int (B Un C) Int (C Un A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   415
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   416
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   417
lemma subset_Un_eq: "(A<=B) <-> (A Un B = B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   418
  by (blast intro: equalityI elim: equalityE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   419
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   420
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   421
subsection {* Simple properties of @{text "Compl"} -- complement of a set *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   422
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   423
lemma Compl_disjoint: "A Int Compl(A) = {x. False}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   424
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   425
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   426
lemma Compl_partition: "A Un Compl(A) = {x. True}"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   427
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   428
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   429
lemma double_complement: "Compl(Compl(A)) = A"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   430
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   431
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   432
lemma Compl_Un: "Compl(A Un B) = Compl(A) Int Compl(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   433
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   434
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   435
lemma Compl_Int: "Compl(A Int B) = Compl(A) Un Compl(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   436
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   437
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   438
lemma Compl_UN: "Compl(UN x:A. B(x)) = (INT x:A. Compl(B(x)))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   439
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   440
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   441
lemma Compl_INT: "Compl(INT x:A. B(x)) = (UN x:A. Compl(B(x)))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   442
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   443
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   444
(*Halmos, Naive Set Theory, page 16.*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   445
lemma Un_Int_assoc_eq: "((A Int B) Un C = A Int (B Un C)) <-> (C<=A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   446
  by (blast intro: equalityI elim: equalityE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   447
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   448
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   449
subsection {* Big Union and Intersection *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   450
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   451
lemma Union_Un_distrib: "Union(A Un B) = Union(A) Un Union(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   452
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   453
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   454
lemma Union_disjoint:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   455
    "(Union(C) Int A = {x. False}) <-> (ALL B:C. B Int A = {x. False})"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   456
  by (blast intro: equalityI elim: equalityE)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   457
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   458
lemma Inter_Un_distrib: "Inter(A Un B) = Inter(A) Int Inter(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   459
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   460
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   461
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   462
subsection {* Unions and Intersections of Families *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   463
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   464
lemma UN_eq: "(UN x:A. B(x)) = Union({Y. EX x:A. Y=B(x)})"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   465
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   466
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   467
(*Look: it has an EXISTENTIAL quantifier*)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   468
lemma INT_eq: "(INT x:A. B(x)) = Inter({Y. EX x:A. Y=B(x)})"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   469
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   470
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   471
lemma Int_Union_image: "A Int Union(B) = (UN C:B. A Int C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   472
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   473
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   474
lemma Un_Inter_image: "A Un Inter(B) = (INT C:B. A Un C)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   475
  by (blast intro: equalityI)
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   476
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   477
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   478
section {* Monotonicity of various operations *}
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   479
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   480
lemma Union_mono: "A<=B ==> Union(A) <= Union(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   481
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   482
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   483
lemma Inter_anti_mono: "[| B<=A |] ==> Inter(A) <= Inter(B)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   484
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   485
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   486
lemma UN_mono:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   487
  "[| A<=B;  !!x. x:A ==> f(x)<=g(x) |] ==>  
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   488
    (UN x:A. f(x)) <= (UN x:B. g(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   489
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   490
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   491
lemma INT_anti_mono:
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   492
  "[| B<=A;  !!x. x:A ==> f(x)<=g(x) |] ==>  
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   493
    (INT x:A. f(x)) <= (INT x:A. g(x))"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   494
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   495
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   496
lemma Un_mono: "[| A<=C;  B<=D |] ==> A Un B <= C Un D"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   497
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   498
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   499
lemma Int_mono: "[| A<=C;  B<=D |] ==> A Int B <= C Int D"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   500
  by blast
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   501
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   502
lemma Compl_anti_mono: "[| A<=B |] ==> Compl(B) <= Compl(A)"
98acc6d0fab6 removed obsolete ML files;
wenzelm
parents: 17456
diff changeset
   503
  by blast
0
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   504
a5a9c433f639 Initial revision
clasohm
parents:
diff changeset
   505
end