src/HOL/Library/SetsAndFunctions.thy
author huffman
Thu, 04 Dec 2008 16:28:09 -0800
changeset 28988 13d6f120992b
parent 27368 9f90ac19e32b
child 29233 ce6d35a0bed6
permissions -rw-r--r--
revert to using eq_number_of_eq for simplification (Groebner_Examples.thy was broken)
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
16932
0bca871f5a21 proper header;
wenzelm
parents: 16908
diff changeset
     1
(*  Title:      HOL/Library/SetsAndFunctions.thy
19736
wenzelm
parents: 19656
diff changeset
     2
    ID:         $Id$
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     3
    Author:     Jeremy Avigad and Kevin Donnelly
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     4
*)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     5
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     6
header {* Operations on sets and functions *}
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     7
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
     8
theory SetsAndFunctions
27368
9f90ac19e32b established Plain theory and image
haftmann
parents: 26814
diff changeset
     9
imports Plain
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    10
begin
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    11
19736
wenzelm
parents: 19656
diff changeset
    12
text {*
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    13
This library lifts operations like addition and muliplication to sets and
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    14
functions of appropriate types. It was designed to support asymptotic
17161
57c69627d71a tuned some proofs;
wenzelm
parents: 16932
diff changeset
    15
calculations. See the comments at the top of theory @{text BigO}.
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    16
*}
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    17
19736
wenzelm
parents: 19656
diff changeset
    18
subsection {* Basic definitions *}
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    19
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    20
definition
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    21
  set_plus :: "('a::plus) set => 'a set => 'a set"  (infixl "\<oplus>" 65) where
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    22
  "A \<oplus> B == {c. EX a:A. EX b:B. c = a + b}"
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    23
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    24
instantiation "fun" :: (type, plus) plus
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    25
begin
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    26
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    27
definition
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    28
  func_plus: "f + g == (%x. f x + g x)"
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    29
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    30
instance ..
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    31
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    32
end
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    33
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    34
definition
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    35
  set_times :: "('a::times) set => 'a set => 'a set"  (infixl "\<otimes>" 70) where
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    36
  "A \<otimes> B == {c. EX a:A. EX b:B. c = a * b}"
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    37
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    38
instantiation "fun" :: (type, times) times
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    39
begin
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    40
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    41
definition
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    42
  func_times: "f * g == (%x. f x * g x)"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    43
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    44
instance ..
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    45
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    46
end
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    47
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    48
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    49
instantiation "fun" :: (type, zero) zero
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    50
begin
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    51
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    52
definition
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    53
  func_zero: "0::(('a::type) => ('b::zero)) == %x. 0"
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    54
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    55
instance ..
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    56
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    57
end
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    58
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    59
instantiation "fun" :: (type, one) one
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    60
begin
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    61
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    62
definition
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    63
  func_one: "1::(('a::type) => ('b::one)) == %x. 1"
25594
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    64
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    65
instance ..
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    66
43c718438f9f switched import from Main to PreList
haftmann
parents: 23477
diff changeset
    67
end
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    68
19736
wenzelm
parents: 19656
diff changeset
    69
definition
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 20523
diff changeset
    70
  elt_set_plus :: "'a::plus => 'a set => 'a set"  (infixl "+o" 70) where
19736
wenzelm
parents: 19656
diff changeset
    71
  "a +o B = {c. EX b:B. c = a + b}"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    72
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 20523
diff changeset
    73
definition
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 20523
diff changeset
    74
  elt_set_times :: "'a::times => 'a set => 'a set"  (infixl "*o" 80) where
19736
wenzelm
parents: 19656
diff changeset
    75
  "a *o B = {c. EX b:B. c = a * b}"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    76
19656
09be06943252 tuned concrete syntax -- abbreviation/const_syntax;
wenzelm
parents: 19380
diff changeset
    77
abbreviation (input)
21404
eb85850d3eb7 more robust syntax for definition/abbreviation/notation;
wenzelm
parents: 20523
diff changeset
    78
  elt_set_eq :: "'a => 'a set => bool"  (infix "=o" 50) where
19380
b808efaa5828 tuned syntax/abbreviations;
wenzelm
parents: 17161
diff changeset
    79
  "x =o A == x : A"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    80
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
    81
instance "fun" :: (type,semigroup_add)semigroup_add
19380
b808efaa5828 tuned syntax/abbreviations;
wenzelm
parents: 17161
diff changeset
    82
  by default (auto simp add: func_plus add_assoc)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    83
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
    84
instance "fun" :: (type,comm_monoid_add)comm_monoid_add
19380
b808efaa5828 tuned syntax/abbreviations;
wenzelm
parents: 17161
diff changeset
    85
  by default (auto simp add: func_zero func_plus add_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    86
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
    87
instance "fun" :: (type,ab_group_add)ab_group_add
19736
wenzelm
parents: 19656
diff changeset
    88
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    89
   apply (simp add: fun_Compl_def func_plus func_zero)
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
    90
  apply (simp add: fun_Compl_def func_plus fun_diff_def diff_minus)
19736
wenzelm
parents: 19656
diff changeset
    91
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    92
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
    93
instance "fun" :: (type,semigroup_mult)semigroup_mult
19736
wenzelm
parents: 19656
diff changeset
    94
  apply default
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    95
  apply (auto simp add: func_times mult_assoc)
19736
wenzelm
parents: 19656
diff changeset
    96
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
    97
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
    98
instance "fun" :: (type,comm_monoid_mult)comm_monoid_mult
19736
wenzelm
parents: 19656
diff changeset
    99
  apply default
wenzelm
parents: 19656
diff changeset
   100
   apply (auto simp add: func_one func_times mult_ac)
wenzelm
parents: 19656
diff changeset
   101
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   102
20523
36a59e5d0039 Major update to function package, including new syntax and the (only theoretical)
krauss
parents: 19736
diff changeset
   103
instance "fun" :: (type,comm_ring_1)comm_ring_1
19736
wenzelm
parents: 19656
diff changeset
   104
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   105
   apply (auto simp add: func_plus func_times fun_Compl_def fun_diff_def ext
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 21404
diff changeset
   106
     func_one func_zero ring_simps)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   107
  apply (drule fun_cong)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   108
  apply simp
19736
wenzelm
parents: 19656
diff changeset
   109
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   110
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   111
interpretation set_semigroup_add: semigroup_add ["op \<oplus> :: ('a::semigroup_add) set => 'a set => 'a set"]
19736
wenzelm
parents: 19656
diff changeset
   112
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   113
  apply (unfold set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   114
  apply (force simp add: add_assoc)
19736
wenzelm
parents: 19656
diff changeset
   115
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   116
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   117
interpretation set_semigroup_mult: semigroup_mult ["op \<otimes> :: ('a::semigroup_mult) set => 'a set => 'a set"]
19736
wenzelm
parents: 19656
diff changeset
   118
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   119
  apply (unfold set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   120
  apply (force simp add: mult_assoc)
19736
wenzelm
parents: 19656
diff changeset
   121
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   122
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   123
interpretation set_comm_monoid_add: comm_monoid_add ["{0}" "op \<oplus> :: ('a::comm_monoid_add) set => 'a set => 'a set"]
19736
wenzelm
parents: 19656
diff changeset
   124
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   125
   apply (unfold set_plus_def)
19736
wenzelm
parents: 19656
diff changeset
   126
   apply (force simp add: add_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   127
  apply force
19736
wenzelm
parents: 19656
diff changeset
   128
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   129
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   130
interpretation set_comm_monoid_mult: comm_monoid_mult ["{1}" "op \<otimes> :: ('a::comm_monoid_mult) set => 'a set => 'a set"]
19736
wenzelm
parents: 19656
diff changeset
   131
  apply default
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   132
   apply (unfold set_times_def)
19736
wenzelm
parents: 19656
diff changeset
   133
   apply (force simp add: mult_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   134
  apply force
19736
wenzelm
parents: 19656
diff changeset
   135
  done
wenzelm
parents: 19656
diff changeset
   136
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   137
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   138
subsection {* Basic properties *}
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   139
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   140
lemma set_plus_intro [intro]: "a : C ==> b : D ==> a + b : C \<oplus> D"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   141
  by (auto simp add: set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   142
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   143
lemma set_plus_intro2 [intro]: "b : C ==> a + b : a +o C"
19736
wenzelm
parents: 19656
diff changeset
   144
  by (auto simp add: elt_set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   145
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   146
lemma set_plus_rearrange: "((a::'a::comm_monoid_add) +o C) \<oplus>
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   147
    (b +o D) = (a + b) +o (C \<oplus> D)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   148
  apply (auto simp add: elt_set_plus_def set_plus_def add_ac)
19736
wenzelm
parents: 19656
diff changeset
   149
   apply (rule_tac x = "ba + bb" in exI)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   150
  apply (auto simp add: add_ac)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   151
  apply (rule_tac x = "aa + a" in exI)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   152
  apply (auto simp add: add_ac)
19736
wenzelm
parents: 19656
diff changeset
   153
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   154
19736
wenzelm
parents: 19656
diff changeset
   155
lemma set_plus_rearrange2: "(a::'a::semigroup_add) +o (b +o C) =
wenzelm
parents: 19656
diff changeset
   156
    (a + b) +o C"
wenzelm
parents: 19656
diff changeset
   157
  by (auto simp add: elt_set_plus_def add_assoc)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   158
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   159
lemma set_plus_rearrange3: "((a::'a::semigroup_add) +o B) \<oplus> C =
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   160
    a +o (B \<oplus> C)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   161
  apply (auto simp add: elt_set_plus_def set_plus_def)
19736
wenzelm
parents: 19656
diff changeset
   162
   apply (blast intro: add_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   163
  apply (rule_tac x = "a + aa" in exI)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   164
  apply (rule conjI)
19736
wenzelm
parents: 19656
diff changeset
   165
   apply (rule_tac x = "aa" in bexI)
wenzelm
parents: 19656
diff changeset
   166
    apply auto
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   167
  apply (rule_tac x = "ba" in bexI)
19736
wenzelm
parents: 19656
diff changeset
   168
   apply (auto simp add: add_ac)
wenzelm
parents: 19656
diff changeset
   169
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   170
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   171
theorem set_plus_rearrange4: "C \<oplus> ((a::'a::comm_monoid_add) +o D) =
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   172
    a +o (C \<oplus> D)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   173
  apply (auto intro!: subsetI simp add: elt_set_plus_def set_plus_def add_ac)
19736
wenzelm
parents: 19656
diff changeset
   174
   apply (rule_tac x = "aa + ba" in exI)
wenzelm
parents: 19656
diff changeset
   175
   apply (auto simp add: add_ac)
wenzelm
parents: 19656
diff changeset
   176
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   177
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   178
theorems set_plus_rearranges = set_plus_rearrange set_plus_rearrange2
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   179
  set_plus_rearrange3 set_plus_rearrange4
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   180
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   181
lemma set_plus_mono [intro!]: "C <= D ==> a +o C <= a +o D"
19736
wenzelm
parents: 19656
diff changeset
   182
  by (auto simp add: elt_set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   183
19736
wenzelm
parents: 19656
diff changeset
   184
lemma set_plus_mono2 [intro]: "(C::('a::plus) set) <= D ==> E <= F ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   185
    C \<oplus> E <= D \<oplus> F"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   186
  by (auto simp add: set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   187
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   188
lemma set_plus_mono3 [intro]: "a : C ==> a +o D <= C \<oplus> D"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   189
  by (auto simp add: elt_set_plus_def set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   190
19736
wenzelm
parents: 19656
diff changeset
   191
lemma set_plus_mono4 [intro]: "(a::'a::comm_monoid_add) : C ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   192
    a +o D <= D \<oplus> C"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   193
  by (auto simp add: elt_set_plus_def set_plus_def add_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   194
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   195
lemma set_plus_mono5: "a:C ==> B <= D ==> a +o B <= C \<oplus> D"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   196
  apply (subgoal_tac "a +o B <= a +o D")
19736
wenzelm
parents: 19656
diff changeset
   197
   apply (erule order_trans)
wenzelm
parents: 19656
diff changeset
   198
   apply (erule set_plus_mono3)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   199
  apply (erule set_plus_mono)
19736
wenzelm
parents: 19656
diff changeset
   200
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   201
19736
wenzelm
parents: 19656
diff changeset
   202
lemma set_plus_mono_b: "C <= D ==> x : a +o C
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   203
    ==> x : a +o D"
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   204
  apply (frule set_plus_mono)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   205
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   206
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   207
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   208
lemma set_plus_mono2_b: "C <= D ==> E <= F ==> x : C \<oplus> E ==>
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   209
    x : D \<oplus> F"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   210
  apply (frule set_plus_mono2)
19736
wenzelm
parents: 19656
diff changeset
   211
   prefer 2
wenzelm
parents: 19656
diff changeset
   212
   apply force
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   213
  apply assumption
19736
wenzelm
parents: 19656
diff changeset
   214
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   215
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   216
lemma set_plus_mono3_b: "a : C ==> x : a +o D ==> x : C \<oplus> D"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   217
  apply (frule set_plus_mono3)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   218
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   219
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   220
19736
wenzelm
parents: 19656
diff changeset
   221
lemma set_plus_mono4_b: "(a::'a::comm_monoid_add) : C ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   222
    x : a +o D ==> x : D \<oplus> C"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   223
  apply (frule set_plus_mono4)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   224
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   225
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   226
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   227
lemma set_zero_plus [simp]: "(0::'a::comm_monoid_add) +o C = C"
19736
wenzelm
parents: 19656
diff changeset
   228
  by (auto simp add: elt_set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   229
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   230
lemma set_zero_plus2: "(0::'a::comm_monoid_add) : A ==> B <= A \<oplus> B"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   231
  apply (auto intro!: subsetI simp add: set_plus_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   232
  apply (rule_tac x = 0 in bexI)
19736
wenzelm
parents: 19656
diff changeset
   233
   apply (rule_tac x = x in bexI)
wenzelm
parents: 19656
diff changeset
   234
    apply (auto simp add: add_ac)
wenzelm
parents: 19656
diff changeset
   235
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   236
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   237
lemma set_plus_imp_minus: "(a::'a::ab_group_add) : b +o C ==> (a - b) : C"
19736
wenzelm
parents: 19656
diff changeset
   238
  by (auto simp add: elt_set_plus_def add_ac diff_minus)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   239
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   240
lemma set_minus_imp_plus: "(a::'a::ab_group_add) - b : C ==> a : b +o C"
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   241
  apply (auto simp add: elt_set_plus_def add_ac diff_minus)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   242
  apply (subgoal_tac "a = (a + - b) + b")
19736
wenzelm
parents: 19656
diff changeset
   243
   apply (rule bexI, assumption, assumption)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   244
  apply (auto simp add: add_ac)
19736
wenzelm
parents: 19656
diff changeset
   245
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   246
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   247
lemma set_minus_plus: "((a::'a::ab_group_add) - b : C) = (a : b +o C)"
19736
wenzelm
parents: 19656
diff changeset
   248
  by (rule iffI, rule set_minus_imp_plus, assumption, rule set_plus_imp_minus,
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   249
    assumption)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   250
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   251
lemma set_times_intro [intro]: "a : C ==> b : D ==> a * b : C \<otimes> D"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   252
  by (auto simp add: set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   253
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   254
lemma set_times_intro2 [intro!]: "b : C ==> a * b : a *o C"
19736
wenzelm
parents: 19656
diff changeset
   255
  by (auto simp add: elt_set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   256
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   257
lemma set_times_rearrange: "((a::'a::comm_monoid_mult) *o C) \<otimes>
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   258
    (b *o D) = (a * b) *o (C \<otimes> D)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   259
  apply (auto simp add: elt_set_times_def set_times_def)
19736
wenzelm
parents: 19656
diff changeset
   260
   apply (rule_tac x = "ba * bb" in exI)
wenzelm
parents: 19656
diff changeset
   261
   apply (auto simp add: mult_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   262
  apply (rule_tac x = "aa * a" in exI)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   263
  apply (auto simp add: mult_ac)
19736
wenzelm
parents: 19656
diff changeset
   264
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   265
19736
wenzelm
parents: 19656
diff changeset
   266
lemma set_times_rearrange2: "(a::'a::semigroup_mult) *o (b *o C) =
wenzelm
parents: 19656
diff changeset
   267
    (a * b) *o C"
wenzelm
parents: 19656
diff changeset
   268
  by (auto simp add: elt_set_times_def mult_assoc)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   269
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   270
lemma set_times_rearrange3: "((a::'a::semigroup_mult) *o B) \<otimes> C =
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   271
    a *o (B \<otimes> C)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   272
  apply (auto simp add: elt_set_times_def set_times_def)
19736
wenzelm
parents: 19656
diff changeset
   273
   apply (blast intro: mult_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   274
  apply (rule_tac x = "a * aa" in exI)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   275
  apply (rule conjI)
19736
wenzelm
parents: 19656
diff changeset
   276
   apply (rule_tac x = "aa" in bexI)
wenzelm
parents: 19656
diff changeset
   277
    apply auto
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   278
  apply (rule_tac x = "ba" in bexI)
19736
wenzelm
parents: 19656
diff changeset
   279
   apply (auto simp add: mult_ac)
wenzelm
parents: 19656
diff changeset
   280
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   281
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   282
theorem set_times_rearrange4: "C \<otimes> ((a::'a::comm_monoid_mult) *o D) =
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   283
    a *o (C \<otimes> D)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   284
  apply (auto intro!: subsetI simp add: elt_set_times_def set_times_def
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   285
    mult_ac)
19736
wenzelm
parents: 19656
diff changeset
   286
   apply (rule_tac x = "aa * ba" in exI)
wenzelm
parents: 19656
diff changeset
   287
   apply (auto simp add: mult_ac)
wenzelm
parents: 19656
diff changeset
   288
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   289
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   290
theorems set_times_rearranges = set_times_rearrange set_times_rearrange2
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   291
  set_times_rearrange3 set_times_rearrange4
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   292
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   293
lemma set_times_mono [intro]: "C <= D ==> a *o C <= a *o D"
19736
wenzelm
parents: 19656
diff changeset
   294
  by (auto simp add: elt_set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   295
19736
wenzelm
parents: 19656
diff changeset
   296
lemma set_times_mono2 [intro]: "(C::('a::times) set) <= D ==> E <= F ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   297
    C \<otimes> E <= D \<otimes> F"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   298
  by (auto simp add: set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   299
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   300
lemma set_times_mono3 [intro]: "a : C ==> a *o D <= C \<otimes> D"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   301
  by (auto simp add: elt_set_times_def set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   302
19736
wenzelm
parents: 19656
diff changeset
   303
lemma set_times_mono4 [intro]: "(a::'a::comm_monoid_mult) : C ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   304
    a *o D <= D \<otimes> C"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   305
  by (auto simp add: elt_set_times_def set_times_def mult_ac)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   306
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   307
lemma set_times_mono5: "a:C ==> B <= D ==> a *o B <= C \<otimes> D"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   308
  apply (subgoal_tac "a *o B <= a *o D")
19736
wenzelm
parents: 19656
diff changeset
   309
   apply (erule order_trans)
wenzelm
parents: 19656
diff changeset
   310
   apply (erule set_times_mono3)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   311
  apply (erule set_times_mono)
19736
wenzelm
parents: 19656
diff changeset
   312
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   313
19736
wenzelm
parents: 19656
diff changeset
   314
lemma set_times_mono_b: "C <= D ==> x : a *o C
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   315
    ==> x : a *o D"
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   316
  apply (frule set_times_mono)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   317
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   318
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   319
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   320
lemma set_times_mono2_b: "C <= D ==> E <= F ==> x : C \<otimes> E ==>
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   321
    x : D \<otimes> F"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   322
  apply (frule set_times_mono2)
19736
wenzelm
parents: 19656
diff changeset
   323
   prefer 2
wenzelm
parents: 19656
diff changeset
   324
   apply force
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   325
  apply assumption
19736
wenzelm
parents: 19656
diff changeset
   326
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   327
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   328
lemma set_times_mono3_b: "a : C ==> x : a *o D ==> x : C \<otimes> D"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   329
  apply (frule set_times_mono3)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   330
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   331
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   332
19736
wenzelm
parents: 19656
diff changeset
   333
lemma set_times_mono4_b: "(a::'a::comm_monoid_mult) : C ==>
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   334
    x : a *o D ==> x : D \<otimes> C"
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   335
  apply (frule set_times_mono4)
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   336
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   337
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   338
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   339
lemma set_one_times [simp]: "(1::'a::comm_monoid_mult) *o C = C"
19736
wenzelm
parents: 19656
diff changeset
   340
  by (auto simp add: elt_set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   341
19736
wenzelm
parents: 19656
diff changeset
   342
lemma set_times_plus_distrib: "(a::'a::semiring) *o (b +o C)=
wenzelm
parents: 19656
diff changeset
   343
    (a * b) +o (a *o C)"
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 21404
diff changeset
   344
  by (auto simp add: elt_set_plus_def elt_set_times_def ring_distribs)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   345
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   346
lemma set_times_plus_distrib2: "(a::'a::semiring) *o (B \<oplus> C) =
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   347
    (a *o B) \<oplus> (a *o C)"
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   348
  apply (auto simp add: set_plus_def elt_set_times_def ring_distribs)
19736
wenzelm
parents: 19656
diff changeset
   349
   apply blast
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   350
  apply (rule_tac x = "b + bb" in exI)
23477
f4b83f03cac9 tuned and renamed group_eq_simps and ring_eq_simps
nipkow
parents: 21404
diff changeset
   351
  apply (auto simp add: ring_distribs)
19736
wenzelm
parents: 19656
diff changeset
   352
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   353
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   354
lemma set_times_plus_distrib3: "((a::'a::semiring) +o C) \<otimes> D <=
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   355
    a *o D \<oplus> C \<otimes> D"
19736
wenzelm
parents: 19656
diff changeset
   356
  apply (auto intro!: subsetI simp add:
26814
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   357
    elt_set_plus_def elt_set_times_def set_times_def
b3e8d5ec721d Replaced + and * on sets by \<oplus> and \<otimes>, to avoid clash with
berghofe
parents: 25764
diff changeset
   358
    set_plus_def ring_distribs)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   359
  apply auto
19736
wenzelm
parents: 19656
diff changeset
   360
  done
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   361
19380
b808efaa5828 tuned syntax/abbreviations;
wenzelm
parents: 17161
diff changeset
   362
theorems set_times_plus_distribs =
b808efaa5828 tuned syntax/abbreviations;
wenzelm
parents: 17161
diff changeset
   363
  set_times_plus_distrib
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   364
  set_times_plus_distrib2
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   365
19736
wenzelm
parents: 19656
diff changeset
   366
lemma set_neg_intro: "(a::'a::ring_1) : (- 1) *o C ==>
wenzelm
parents: 19656
diff changeset
   367
    - a : C"
wenzelm
parents: 19656
diff changeset
   368
  by (auto simp add: elt_set_times_def)
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   369
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   370
lemma set_neg_intro2: "(a::'a::ring_1) : C ==>
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   371
    - a : (- 1) *o C"
19736
wenzelm
parents: 19656
diff changeset
   372
  by (auto simp add: elt_set_times_def)
wenzelm
parents: 19656
diff changeset
   373
16908
d374530bfaaa Added two new theories to HOL/Library: SetsAndFunctions.thy and BigO.thy
avigad
parents:
diff changeset
   374
end