src/HOL/SetInterval.thy
author kleing
Mon, 01 Mar 2004 05:21:43 +0100
changeset 14418 b62323c85134
parent 14398 c5c47703f763
child 14478 bdf6b7adc3ec
permissions -rw-r--r--
union/intersection over intervals
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
     1
(*  Title:      HOL/SetInterval.thy
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
     2
    ID:         $Id$
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
     3
    Author:     Tobias Nipkow and Clemens Ballarin
8957
26b6e8f43305 added parent
paulson
parents: 8924
diff changeset
     4
    Copyright   2000  TU Muenchen
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
     5
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
     6
lessThan, greaterThan, atLeast, atMost and two-sided intervals
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
     7
*)
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
     8
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
     9
theory SetInterval = NatArith:
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    10
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    11
constdefs
11609
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    12
  lessThan    :: "('a::ord) => 'a set"	("(1{.._'(})")
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    13
  "{..u(} == {x. x<u}"
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    14
11609
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    15
  atMost      :: "('a::ord) => 'a set"	("(1{.._})")
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    16
  "{..u} == {x. x<=u}"
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    17
11609
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    18
  greaterThan :: "('a::ord) => 'a set"	("(1{')_..})")
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    19
  "{)l..} == {x. l<x}"
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    20
11609
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    21
  atLeast     :: "('a::ord) => 'a set"	("(1{_..})")
3f3d1add4d94 eliminated theories "equalities" and "mono" (made part of "Typedef",
wenzelm
parents: 10214
diff changeset
    22
  "{l..} == {x. l<=x}"
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
    23
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    24
  greaterThanLessThan :: "['a::ord, 'a] => 'a set"  ("(1{')_.._'(})")
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    25
  "{)l..u(} == {)l..} Int {..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    26
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    27
  atLeastLessThan :: "['a::ord, 'a] => 'a set"      ("(1{_.._'(})")
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    28
  "{l..u(} == {l..} Int {..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    29
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    30
  greaterThanAtMost :: "['a::ord, 'a] => 'a set"    ("(1{')_.._})")
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    31
  "{)l..u} == {)l..} Int {..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    32
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    33
  atLeastAtMost :: "['a::ord, 'a] => 'a set"        ("(1{_.._})")
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    34
  "{l..u} == {l..} Int {..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    35
14418
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    36
syntax
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    37
  "@UNION_le"   :: "nat => nat => 'b set => 'b set"       ("(3UN _<=_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    38
  "@UNION_less" :: "nat => nat => 'b set => 'b set"       ("(3UN _<_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    39
  "@INTER_le"   :: "nat => nat => 'b set => 'b set"       ("(3INT _<=_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    40
  "@INTER_less" :: "nat => nat => 'b set => 'b set"       ("(3INT _<_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    41
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    42
syntax (input)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    43
  "@UNION_le"   :: "nat => nat => 'b set => 'b set"       ("(3\<Union> _\<le>_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    44
  "@UNION_less" :: "nat => nat => 'b set => 'b set"       ("(3\<Union> _<_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    45
  "@INTER_le"   :: "nat => nat => 'b set => 'b set"       ("(3\<Inter> _\<le>_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    46
  "@INTER_less" :: "nat => nat => 'b set => 'b set"       ("(3\<Inter> _<_./ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    47
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    48
syntax (xsymbols)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    49
  "@UNION_le"   :: "nat \<Rightarrow> nat => 'b set => 'b set"       ("(3\<Union>\<^bsub>_ \<le> _\<^esub>/ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    50
  "@UNION_less" :: "nat \<Rightarrow> nat => 'b set => 'b set"       ("(3\<Union>\<^bsub>_ < _\<^esub>/ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    51
  "@INTER_le"   :: "nat \<Rightarrow> nat => 'b set => 'b set"       ("(3\<Inter>\<^bsub>_ \<le> _\<^esub>/ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    52
  "@INTER_less" :: "nat \<Rightarrow> nat => 'b set => 'b set"       ("(3\<Inter>\<^bsub>_ < _\<^esub>/ _)" 10)
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    53
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    54
translations
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    55
  "UN i<=n. A"  == "UN i:{..n}. A"
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    56
  "UN i<n. A"   == "UN i:{..n(}. A"
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    57
  "INT i<=n. A" == "INT i:{..n}. A"
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    58
  "INT i<n. A"  == "INT i:{..n(}. A"
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    59
b62323c85134 union/intersection over intervals
kleing
parents: 14398
diff changeset
    60
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    61
subsection {*lessThan*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    62
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    63
lemma lessThan_iff [iff]: "(i: lessThan k) = (i<k)"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    64
by (simp add: lessThan_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    65
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    66
lemma lessThan_0 [simp]: "lessThan (0::nat) = {}"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    67
by (simp add: lessThan_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    68
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    69
lemma lessThan_Suc: "lessThan (Suc k) = insert k (lessThan k)"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    70
by (simp add: lessThan_def less_Suc_eq, blast)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    71
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    72
lemma lessThan_Suc_atMost: "lessThan (Suc k) = atMost k"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    73
by (simp add: lessThan_def atMost_def less_Suc_eq_le)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    74
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    75
lemma UN_lessThan_UNIV: "(UN m::nat. lessThan m) = UNIV"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    76
by blast
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    77
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    78
lemma Compl_lessThan [simp]: 
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    79
    "!!k:: 'a::linorder. -lessThan k = atLeast k"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    80
apply (auto simp add: lessThan_def atLeast_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    81
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    82
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    83
lemma single_Diff_lessThan [simp]: "!!k:: 'a::order. {k} - lessThan k = {k}"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    84
by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    85
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    86
subsection {*greaterThan*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    87
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    88
lemma greaterThan_iff [iff]: "(i: greaterThan k) = (k<i)"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    89
by (simp add: greaterThan_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    90
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    91
lemma greaterThan_0 [simp]: "greaterThan 0 = range Suc"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    92
apply (simp add: greaterThan_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    93
apply (blast dest: gr0_conv_Suc [THEN iffD1])
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    94
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    95
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    96
lemma greaterThan_Suc: "greaterThan (Suc k) = greaterThan k - {Suc k}"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
    97
apply (simp add: greaterThan_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    98
apply (auto elim: linorder_neqE)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
    99
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   100
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   101
lemma INT_greaterThan_UNIV: "(INT m::nat. greaterThan m) = {}"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   102
by blast
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   103
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   104
lemma Compl_greaterThan [simp]: 
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   105
    "!!k:: 'a::linorder. -greaterThan k = atMost k"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   106
apply (simp add: greaterThan_def atMost_def le_def, auto)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   107
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   108
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   109
lemma Compl_atMost [simp]: "!!k:: 'a::linorder. -atMost k = greaterThan k"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   110
apply (subst Compl_greaterThan [symmetric])
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   111
apply (rule double_complement) 
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   112
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   113
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   114
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   115
subsection {*atLeast*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   116
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   117
lemma atLeast_iff [iff]: "(i: atLeast k) = (k<=i)"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   118
by (simp add: atLeast_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   119
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   120
lemma atLeast_0 [simp]: "atLeast (0::nat) = UNIV"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   121
by (unfold atLeast_def UNIV_def, simp)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   122
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   123
lemma atLeast_Suc: "atLeast (Suc k) = atLeast k - {k}"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   124
apply (simp add: atLeast_def)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   125
apply (simp add: Suc_le_eq)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   126
apply (simp add: order_le_less, blast)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   127
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   128
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   129
lemma UN_atLeast_UNIV: "(UN m::nat. atLeast m) = UNIV"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   130
by blast
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   131
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   132
lemma Compl_atLeast [simp]: 
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   133
    "!!k:: 'a::linorder. -atLeast k = lessThan k"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   134
apply (simp add: lessThan_def atLeast_def le_def, auto)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   135
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   136
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   137
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   138
subsection {*atMost*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   139
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   140
lemma atMost_iff [iff]: "(i: atMost k) = (i<=k)"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   141
by (simp add: atMost_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   142
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   143
lemma atMost_0 [simp]: "atMost (0::nat) = {0}"
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   144
by (simp add: atMost_def)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   145
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   146
lemma atMost_Suc: "atMost (Suc k) = insert (Suc k) (atMost k)"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   147
apply (simp add: atMost_def)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   148
apply (simp add: less_Suc_eq order_le_less, blast)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   149
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   150
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   151
lemma UN_atMost_UNIV: "(UN m::nat. atMost m) = UNIV"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   152
by blast
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   153
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   154
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   155
subsection {*Logical Equivalences for Set Inclusion and Equality*}
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   156
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   157
lemma atLeast_subset_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   158
     "(atLeast x \<subseteq> atLeast y) = (y \<le> (x::'a::order))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   159
by (blast intro: order_trans) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   160
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   161
lemma atLeast_eq_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   162
     "(atLeast x = atLeast y) = (x = (y::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   163
by (blast intro: order_antisym order_trans)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   164
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   165
lemma greaterThan_subset_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   166
     "(greaterThan x \<subseteq> greaterThan y) = (y \<le> (x::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   167
apply (auto simp add: greaterThan_def) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   168
 apply (subst linorder_not_less [symmetric], blast) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   169
done
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   170
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   171
lemma greaterThan_eq_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   172
     "(greaterThan x = greaterThan y) = (x = (y::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   173
apply (rule iffI) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   174
 apply (erule equalityE) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   175
 apply (simp add: greaterThan_subset_iff order_antisym, simp) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   176
done
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   177
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   178
lemma atMost_subset_iff [iff]: "(atMost x \<subseteq> atMost y) = (x \<le> (y::'a::order))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   179
by (blast intro: order_trans)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   180
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   181
lemma atMost_eq_iff [iff]: "(atMost x = atMost y) = (x = (y::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   182
by (blast intro: order_antisym order_trans)
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   183
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   184
lemma lessThan_subset_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   185
     "(lessThan x \<subseteq> lessThan y) = (x \<le> (y::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   186
apply (auto simp add: lessThan_def) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   187
 apply (subst linorder_not_less [symmetric], blast) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   188
done
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   189
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   190
lemma lessThan_eq_iff [iff]:
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   191
     "(lessThan x = lessThan y) = (x = (y::'a::linorder))" 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   192
apply (rule iffI) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   193
 apply (erule equalityE) 
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   194
 apply (simp add: lessThan_subset_iff order_antisym, simp) 
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   195
done
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   196
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   197
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   198
subsection {*Combined properties*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   199
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   200
lemma atMost_Int_atLeast: "!!n:: 'a::order. atMost n Int atLeast n = {n}"
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   201
by (blast intro: order_antisym)
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   202
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   203
subsection {*Two-sided intervals*}
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   204
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   205
(* greaterThanLessThan *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   206
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   207
lemma greaterThanLessThan_iff [simp]:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   208
  "(i : {)l..u(}) = (l < i & i < u)"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   209
by (simp add: greaterThanLessThan_def)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   210
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   211
(* atLeastLessThan *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   212
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   213
lemma atLeastLessThan_iff [simp]:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   214
  "(i : {l..u(}) = (l <= i & i < u)"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   215
by (simp add: atLeastLessThan_def)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   216
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   217
(* greaterThanAtMost *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   218
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   219
lemma greaterThanAtMost_iff [simp]:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   220
  "(i : {)l..u}) = (l < i & i <= u)"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   221
by (simp add: greaterThanAtMost_def)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   222
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   223
(* atLeastAtMost *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   224
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   225
lemma atLeastAtMost_iff [simp]:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   226
  "(i : {l..u}) = (l <= i & i <= u)"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   227
by (simp add: atLeastAtMost_def)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   228
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   229
(* The above four lemmas could be declared as iffs.
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   230
   If we do so, a call to blast in Hyperreal/Star.ML, lemma STAR_Int
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   231
   seems to take forever (more than one hour). *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   232
13850
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   233
subsection {*Lemmas useful with the summation operator setsum*}
6d1bb3059818 new logical equivalences
paulson
parents: 13735
diff changeset
   234
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   235
(* For examples, see Algebra/poly/UnivPoly.thy *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   236
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   237
(** Disjoint Unions **)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   238
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   239
(* Singletons and open intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   240
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   241
lemma ivl_disj_un_singleton:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   242
  "{l::'a::linorder} Un {)l..} = {l..}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   243
  "{..u(} Un {u::'a::linorder} = {..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   244
  "(l::'a::linorder) < u ==> {l} Un {)l..u(} = {l..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   245
  "(l::'a::linorder) < u ==> {)l..u(} Un {u} = {)l..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   246
  "(l::'a::linorder) <= u ==> {l} Un {)l..u} = {l..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   247
  "(l::'a::linorder) <= u ==> {l..u(} Un {u} = {l..u}"
14398
c5c47703f763 Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents: 13850
diff changeset
   248
by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   249
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   250
(* One- and two-sided intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   251
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   252
lemma ivl_disj_un_one:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   253
  "(l::'a::linorder) < u ==> {..l} Un {)l..u(} = {..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   254
  "(l::'a::linorder) <= u ==> {..l(} Un {l..u(} = {..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   255
  "(l::'a::linorder) <= u ==> {..l} Un {)l..u} = {..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   256
  "(l::'a::linorder) <= u ==> {..l(} Un {l..u} = {..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   257
  "(l::'a::linorder) <= u ==> {)l..u} Un {)u..} = {)l..}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   258
  "(l::'a::linorder) < u ==> {)l..u(} Un {u..} = {)l..}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   259
  "(l::'a::linorder) <= u ==> {l..u} Un {)u..} = {l..}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   260
  "(l::'a::linorder) <= u ==> {l..u(} Un {u..} = {l..}"
14398
c5c47703f763 Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents: 13850
diff changeset
   261
by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   262
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   263
(* Two- and two-sided intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   264
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   265
lemma ivl_disj_un_two:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   266
  "[| (l::'a::linorder) < m; m <= u |] ==> {)l..m(} Un {m..u(} = {)l..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   267
  "[| (l::'a::linorder) <= m; m < u |] ==> {)l..m} Un {)m..u(} = {)l..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   268
  "[| (l::'a::linorder) <= m; m <= u |] ==> {l..m(} Un {m..u(} = {l..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   269
  "[| (l::'a::linorder) <= m; m < u |] ==> {l..m} Un {)m..u(} = {l..u(}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   270
  "[| (l::'a::linorder) < m; m <= u |] ==> {)l..m(} Un {m..u} = {)l..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   271
  "[| (l::'a::linorder) <= m; m <= u |] ==> {)l..m} Un {)m..u} = {)l..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   272
  "[| (l::'a::linorder) <= m; m <= u |] ==> {l..m(} Un {m..u} = {l..u}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   273
  "[| (l::'a::linorder) <= m; m <= u |] ==> {l..m} Un {)m..u} = {l..u}"
14398
c5c47703f763 Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents: 13850
diff changeset
   274
by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   275
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   276
lemmas ivl_disj_un = ivl_disj_un_singleton ivl_disj_un_one ivl_disj_un_two
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   277
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   278
(** Disjoint Intersections **)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   279
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   280
(* Singletons and open intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   281
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   282
lemma ivl_disj_int_singleton:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   283
  "{l::'a::order} Int {)l..} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   284
  "{..u(} Int {u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   285
  "{l} Int {)l..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   286
  "{)l..u(} Int {u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   287
  "{l} Int {)l..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   288
  "{l..u(} Int {u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   289
  by simp+
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   290
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   291
(* One- and two-sided intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   292
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   293
lemma ivl_disj_int_one:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   294
  "{..l::'a::order} Int {)l..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   295
  "{..l(} Int {l..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   296
  "{..l} Int {)l..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   297
  "{..l(} Int {l..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   298
  "{)l..u} Int {)u..} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   299
  "{)l..u(} Int {u..} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   300
  "{l..u} Int {)u..} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   301
  "{l..u(} Int {u..} = {}"
14398
c5c47703f763 Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents: 13850
diff changeset
   302
  by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   303
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   304
(* Two- and two-sided intervals *)
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   305
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   306
lemma ivl_disj_int_two:
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   307
  "{)l::'a::order..m(} Int {m..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   308
  "{)l..m} Int {)m..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   309
  "{l..m(} Int {m..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   310
  "{l..m} Int {)m..u(} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   311
  "{)l..m(} Int {m..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   312
  "{)l..m} Int {)m..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   313
  "{l..m(} Int {m..u} = {}"
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   314
  "{l..m} Int {)m..u} = {}"
14398
c5c47703f763 Efficient, graph-based reasoner for linear and partial orders.
ballarin
parents: 13850
diff changeset
   315
  by auto
13735
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   316
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   317
lemmas ivl_disj_int = ivl_disj_int_singleton ivl_disj_int_one ivl_disj_int_two
7de9342aca7a HOL-Algebra partially ported to Isar.
ballarin
parents: 11609
diff changeset
   318
8924
c434283b4cfa Added SetInterval
nipkow
parents:
diff changeset
   319
end