src/HOL/SetInterval.thy
 author paulson Fri Dec 17 10:15:46 2004 +0100 (2004-12-17) changeset 15418 e28853da5df5 parent 15402 97204f3b4705 child 15539 333a88244569 permissions -rw-r--r--
removed two looping simplifications in SetInterval.thy; deleted the .ML file
 nipkow@8924  1 (* Title: HOL/SetInterval.thy  nipkow@8924  2  ID: $Id$  ballarin@13735  3  Author: Tobias Nipkow and Clemens Ballarin  paulson@14485  4  Additions by Jeremy Avigad in March 2004  paulson@8957  5  Copyright 2000 TU Muenchen  nipkow@8924  6 ballarin@13735  7 lessThan, greaterThan, atLeast, atMost and two-sided intervals  nipkow@8924  8 *)  nipkow@8924  9 wenzelm@14577  10 header {* Set intervals *}  wenzelm@14577  11 nipkow@15131  12 theory SetInterval  nipkow@15140  13 imports IntArith  nipkow@15131  14 begin  nipkow@8924  15 nipkow@8924  16 constdefs  nipkow@15045  17  lessThan :: "('a::ord) => 'a set" ("(1{..<_})")  nipkow@15045  18  "{.. 'a set" ("(1{.._})")  wenzelm@11609  21  "{..u} == {x. x<=u}"  nipkow@8924  22 nipkow@15045  23  greaterThan :: "('a::ord) => 'a set" ("(1{_<..})")  nipkow@15045  24  "{l<..} == {x. l 'a set" ("(1{_..})")  wenzelm@11609  27  "{l..} == {x. l<=x}"  nipkow@8924  28 nipkow@15045  29  greaterThanLessThan :: "['a::ord, 'a] => 'a set" ("(1{_<..<_})")  nipkow@15045  30  "{l<.. 'a set" ("(1{_..<_})")  nipkow@15045  33  "{l.. 'a set" ("(1{_<.._})")  nipkow@15045  36  "{l<..u} == {l<..} Int {..u}"  ballarin@13735  37 ballarin@13735  38  atLeastAtMost :: "['a::ord, 'a] => 'a set" ("(1{_.._})")  ballarin@13735  39  "{l..u} == {l..} Int {..u}"  ballarin@13735  40 nipkow@15045  41 (* Old syntax, will disappear! *)  nipkow@15045  42 syntax  nipkow@15045  43  "_lessThan" :: "('a::ord) => 'a set" ("(1{.._'(})")  nipkow@15045  44  "_greaterThan" :: "('a::ord) => 'a set" ("(1{')_..})")  nipkow@15045  45  "_greaterThanLessThan" :: "['a::ord, 'a] => 'a set" ("(1{')_.._'(})")  nipkow@15045  46  "_atLeastLessThan" :: "['a::ord, 'a] => 'a set" ("(1{_.._'(})")  nipkow@15045  47  "_greaterThanAtMost" :: "['a::ord, 'a] => 'a set" ("(1{')_.._})")  nipkow@15045  48 translations  nipkow@15045  49  "{..m(}" => "{.. "{m<..}"  nipkow@15045  51  "{)m..n(}" => "{m<.. "{m.. "{m<..n}"  nipkow@15045  54 nipkow@15048  55 nipkow@15048  56 text{* A note of warning when using @{term"{.. nat => 'b set => 'b set" ("(3UN _<=_./ _)" 10)  kleing@14418  62  "@UNION_less" :: "nat => nat => 'b set => 'b set" ("(3UN _<_./ _)" 10)  kleing@14418  63  "@INTER_le" :: "nat => nat => 'b set => 'b set" ("(3INT _<=_./ _)" 10)  kleing@14418  64  "@INTER_less" :: "nat => nat => 'b set => 'b set" ("(3INT _<_./ _)" 10)  kleing@14418  65 kleing@14418  66 syntax (input)  kleing@14418  67  "@UNION_le" :: "nat => nat => 'b set => 'b set" ("(3\ _\_./ _)" 10)  kleing@14418  68  "@UNION_less" :: "nat => nat => 'b set => 'b set" ("(3\ _<_./ _)" 10)  kleing@14418  69  "@INTER_le" :: "nat => nat => 'b set => 'b set" ("(3\ _\_./ _)" 10)  kleing@14418  70  "@INTER_less" :: "nat => nat => 'b set => 'b set" ("(3\ _<_./ _)" 10)  kleing@14418  71 kleing@14418  72 syntax (xsymbols)  wenzelm@14846  73  "@UNION_le" :: "nat \ nat => 'b set => 'b set" ("(3\(00\<^bsub>_ \ _\<^esub>)/ _)" 10)  wenzelm@14846  74  "@UNION_less" :: "nat \ nat => 'b set => 'b set" ("(3\(00\<^bsub>_ < _\<^esub>)/ _)" 10)  wenzelm@14846  75  "@INTER_le" :: "nat \ nat => 'b set => 'b set" ("(3\(00\<^bsub>_ \ _\<^esub>)/ _)" 10)  wenzelm@14846  76  "@INTER_less" :: "nat \ nat => 'b set => 'b set" ("(3\(00\<^bsub>_ < _\<^esub>)/ _)" 10)  kleing@14418  77 kleing@14418  78 translations  kleing@14418  79  "UN i<=n. A" == "UN i:{..n}. A"  nipkow@15045  80  "UN i atLeast y) = (y \ (x::'a::order))"  paulson@15418  130 by (blast intro: order_trans)  paulson@13850  131 paulson@13850  132 lemma atLeast_eq_iff [iff]:  paulson@15418  133  "(atLeast x = atLeast y) = (x = (y::'a::linorder))"  paulson@13850  134 by (blast intro: order_antisym order_trans)  paulson@13850  135 paulson@13850  136 lemma greaterThan_subset_iff [iff]:  paulson@15418  137  "(greaterThan x \ greaterThan y) = (y \ (x::'a::linorder))"  paulson@15418  138 apply (auto simp add: greaterThan_def)  paulson@15418  139  apply (subst linorder_not_less [symmetric], blast)  paulson@13850  140 done  paulson@13850  141 paulson@13850  142 lemma greaterThan_eq_iff [iff]:  paulson@15418  143  "(greaterThan x = greaterThan y) = (x = (y::'a::linorder))"  paulson@15418  144 apply (rule iffI)  paulson@15418  145  apply (erule equalityE)  paulson@15418  146  apply (simp_all add: greaterThan_subset_iff)  paulson@13850  147 done  paulson@13850  148 paulson@15418  149 lemma atMost_subset_iff [iff]: "(atMost x \ atMost y) = (x \ (y::'a::order))"  paulson@13850  150 by (blast intro: order_trans)  paulson@13850  151 paulson@15418  152 lemma atMost_eq_iff [iff]: "(atMost x = atMost y) = (x = (y::'a::linorder))"  paulson@13850  153 by (blast intro: order_antisym order_trans)  paulson@13850  154 paulson@13850  155 lemma lessThan_subset_iff [iff]:  paulson@15418  156  "(lessThan x \ lessThan y) = (x \ (y::'a::linorder))"  paulson@15418  157 apply (auto simp add: lessThan_def)  paulson@15418  158  apply (subst linorder_not_less [symmetric], blast)  paulson@13850  159 done  paulson@13850  160 paulson@13850  161 lemma lessThan_eq_iff [iff]:  paulson@15418  162  "(lessThan x = lessThan y) = (x = (y::'a::linorder))"  paulson@15418  163 apply (rule iffI)  paulson@15418  164  apply (erule equalityE)  paulson@15418  165  apply (simp_all add: lessThan_subset_iff)  ballarin@13735  166 done  ballarin@13735  167 ballarin@13735  168 paulson@13850  169 subsection {*Two-sided intervals*}  ballarin@13735  170 wenzelm@14577  171 text {* @{text greaterThanLessThan} *}  ballarin@13735  172 ballarin@13735  173 lemma greaterThanLessThan_iff [simp]:  nipkow@15045  174  "(i : {l<.. m ==> {m.. n then insert n {m.. finite N"  paulson@14485  330  -- {* A bounded set of natural numbers is finite. *}  paulson@14485  331  apply (rule finite_subset)  paulson@14485  332  apply (rule_tac [2] finite_lessThan, auto)  paulson@14485  333  done  paulson@14485  334 paulson@14485  335 subsubsection {* Cardinality *}  paulson@14485  336 nipkow@15045  337 lemma card_lessThan [simp]: "card {.. u ==>  nipkow@15045  380  {(0::int).. u")  paulson@14485  389  apply (subst image_atLeastZeroLessThan_int, assumption)  paulson@14485  390  apply (rule finite_imageI)  paulson@14485  391  apply auto  nipkow@15045  392  apply (subgoal_tac "{0.. u")  paulson@14485  424  apply (subst image_atLeastZeroLessThan_int, assumption)  paulson@14485  425  apply (subst card_image)  paulson@14485  426  apply (auto simp add: inj_on_def)  paulson@14485  427  done  paulson@14485  428 nipkow@15045  429 lemma card_atLeastLessThan_int [simp]: "card {l.. {l} Un {l<.. {l<.. {l} Un {l<..u} = {l..u}"  nipkow@15045  465  "(l::'a::linorder) <= u ==> {l.. {..l} Un {l<.. {.. {..l} Un {l<..u} = {..u}"  nipkow@15045  474  "(l::'a::linorder) <= u ==> {.. {l<..u} Un {u<..} = {l<..}"  nipkow@15045  476  "(l::'a::linorder) < u ==> {l<.. {l..u} Un {u<..} = {l..}"  nipkow@15045  478  "(l::'a::linorder) <= u ==> {l.. {l<.. {l<..m} Un {m<.. {l.. {l..m} Un {m<.. {l<.. {l<..m} Un {m<..u} = {l<..u}"  nipkow@15045  490  "[| (l::'a::linorder) <= m; m <= u |] ==> {l.. {l..m} Un {m<..u} = {l..u}"  ballarin@14398  492 by auto  ballarin@13735  493 ballarin@13735  494 lemmas ivl_disj_un = ivl_disj_un_singleton ivl_disj_un_one ivl_disj_un_two  ballarin@13735  495 wenzelm@14577  496 subsubsection {* Disjoint Intersections *}  ballarin@13735  497 wenzelm@14577  498 text {* Singletons and open intervals *}  ballarin@13735  499 ballarin@13735  500 lemma ivl_disj_int_singleton:  nipkow@15045  501  "{l::'a::order} Int {l<..} = {}"  nipkow@15045  502  "{.. 'a \ 'a \ 'b \ 'b" ("(SUM _ = _.._./ _)" [0,0,0,10] 10)  nipkow@15048  542  "_from_upto_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b" ("(SUM _ = _..<_./ _)" [0,0,0,10] 10)  nipkow@15048  543  "_upto_setsum" :: "idt \ 'a \ 'b \ 'b" ("(SUM _<_./ _)" [0,0,10] 10)  nipkow@15042  544 syntax (xsymbols)  nipkow@15042  545  "_from_to_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b" ("(3\_ = _.._./ _)" [0,0,0,10] 10)  nipkow@15048  546  "_from_upto_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b" ("(3\_ = _..<_./ _)" [0,0,0,10] 10)  nipkow@15048  547  "_upto_setsum" :: "idt \ 'a \ 'b \ 'b" ("(3\_<_./ _)" [0,0,10] 10)  nipkow@15042  548 syntax (HTML output)  nipkow@15042  549  "_from_to_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b" ("(3\_ = _.._./ _)" [0,0,0,10] 10)  nipkow@15048  550  "_from_upto_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b" ("(3\_ = _..<_./ _)" [0,0,0,10] 10)  nipkow@15048  551  "_upto_setsum" :: "idt \ 'a \ 'b \ 'b" ("(3\_<_./ _)" [0,0,10] 10)  nipkow@15056  552 syntax (latex_sum output)  nipkow@15052  553  "_from_to_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b"  nipkow@15052  554  ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{>_\<^raw:}$> _)" [0,0,0,10] 10)  nipkow@15052  555  "_from_upto_setsum" :: "idt \ 'a \ 'a \ 'b \ 'b"  nipkow@15052  556  ("(3\<^raw:$\sum_{>_ = _\<^raw:}^{<>_\<^raw:}$> _)" [0,0,0,10] 10)  nipkow@15052  557  "_upto_setsum" :: "idt \ 'a \ 'b \ 'b"  nipkow@15052  558  ("(3\<^raw:$\sum_{>_ < _\<^raw:}$> _)" [0,0,10] 10)  nipkow@15041  559 nipkow@15048  560 translations  nipkow@15048  561  "\x=a..b. t" == "setsum (%x. t) {a..b}"  nipkow@15048  562  "\x=a..ii. t) {..x\{a..b}. e"} & @{term"\x=a..b. e"} & @{term[mode=latex_sum]"\x=a..b. e"}\\  nipkow@15056  571 @{term[source]"\x\{a..x=a..x=a..x\{..xxx::nat=0..xi < Suc n. b i) = b n + (\i < n. b i)"  nipkow@15041  590 by (simp add:lessThan_Suc)  nipkow@15041  591 paulson@15418  592 paulson@15418  593 ML  paulson@15418  594 {*  paulson@15418  595 val Compl_atLeast = thm "Compl_atLeast";  paulson@15418  596 val Compl_atMost = thm "Compl_atMost";  paulson@15418  597 val Compl_greaterThan = thm "Compl_greaterThan";  paulson@15418  598 val Compl_lessThan = thm "Compl_lessThan";  paulson@15418  599 val INT_greaterThan_UNIV = thm "INT_greaterThan_UNIV";  paulson@15418  600 val UN_atLeast_UNIV = thm "UN_atLeast_UNIV";  paulson@15418  601 val UN_atMost_UNIV = thm "UN_atMost_UNIV";  paulson@15418  602 val UN_lessThan_UNIV = thm "UN_lessThan_UNIV";  paulson@15418  603 val atLeastAtMost_def = thm "atLeastAtMost_def";  paulson@15418  604 val atLeastAtMost_iff = thm "atLeastAtMost_iff";  paulson@15418  605 val atLeastLessThan_def = thm "atLeastLessThan_def";  paulson@15418  606 val atLeastLessThan_iff = thm "atLeastLessThan_iff";  paulson@15418  607 val atLeast_0 = thm "atLeast_0";  paulson@15418  608 val atLeast_Suc = thm "atLeast_Suc";  paulson@15418  609 val atLeast_def = thm "atLeast_def";  paulson@15418  610 val atLeast_iff = thm "atLeast_iff";  paulson@15418  611 val atMost_0 = thm "atMost_0";  paulson@15418  612 val atMost_Int_atLeast = thm "atMost_Int_atLeast";  paulson@15418  613 val atMost_Suc = thm "atMost_Suc";  paulson@15418  614 val atMost_def = thm "atMost_def";  paulson@15418  615 val atMost_iff = thm "atMost_iff";  paulson@15418  616 val greaterThanAtMost_def = thm "greaterThanAtMost_def";  paulson@15418  617 val greaterThanAtMost_iff = thm "greaterThanAtMost_iff";  paulson@15418  618 val greaterThanLessThan_def = thm "greaterThanLessThan_def";  paulson@15418  619 val greaterThanLessThan_iff = thm "greaterThanLessThan_iff";  paulson@15418  620 val greaterThan_0 = thm "greaterThan_0";  paulson@15418  621 val greaterThan_Suc = thm "greaterThan_Suc";  paulson@15418  622 val greaterThan_def = thm "greaterThan_def";  paulson@15418  623 val greaterThan_iff = thm "greaterThan_iff";  paulson@15418  624 val ivl_disj_int = thms "ivl_disj_int";  paulson@15418  625 val ivl_disj_int_one = thms "ivl_disj_int_one";  paulson@15418  626 val ivl_disj_int_singleton = thms "ivl_disj_int_singleton";  paulson@15418  627 val ivl_disj_int_two = thms "ivl_disj_int_two";  paulson@15418  628 val ivl_disj_un = thms "ivl_disj_un";  paulson@15418  629 val ivl_disj_un_one = thms "ivl_disj_un_one";  paulson@15418  630 val ivl_disj_un_singleton = thms "ivl_disj_un_singleton";  paulson@15418  631 val ivl_disj_un_two = thms "ivl_disj_un_two";  paulson@15418  632 val lessThan_0 = thm "lessThan_0";  paulson@15418  633 val lessThan_Suc = thm "lessThan_Suc";  paulson@15418  634 val lessThan_Suc_atMost = thm "lessThan_Suc_atMost";  paulson@15418  635 val lessThan_def = thm "lessThan_def";  paulson@15418  636 val lessThan_iff = thm "lessThan_iff";  paulson@15418  637 val single_Diff_lessThan = thm "single_Diff_lessThan";  paulson@15418  638 paulson@15418  639 val bounded_nat_set_is_finite = thm "bounded_nat_set_is_finite";  paulson@15418  640 val finite_atMost = thm "finite_atMost";  paulson@15418  641 val finite_lessThan = thm "finite_lessThan";  paulson@15418  642 *}  paulson@15418  643 nipkow@8924  644 end