X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=blobdiff_plain;f=helm%2Fsoftware%2Fmatita%2Fcontribs%2Fdama%2Fdama%2Fsupremum.ma;h=0de61b292fcaca3e40f5b7bddfa7ba0b88d27398;hb=7a9277a3775b7150a22b2039548508e85751f85a;hp=65d43ac18d3f62be9278426b008e4a2b08a5e2db;hpb=20c68603cc71aeb957d5e974558d908f2261fb6d;p=helm.git diff --git a/helm/software/matita/contribs/dama/dama/supremum.ma b/helm/software/matita/contribs/dama/dama/supremum.ma index 65d43ac18..0de61b292 100644 --- a/helm/software/matita/contribs/dama/dama/supremum.ma +++ b/helm/software/matita/contribs/dama/dama/supremum.ma @@ -12,92 +12,144 @@ (* *) (**************************************************************************) + +include "datatypes/constructors.ma". +include "nat/plus.ma". +include "nat_ordered_set.ma". include "sequence.ma". -include "ordered_set.ma". (* Definition 2.4 *) -definition upper_bound ≝ λO:ordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤ u. +definition upper_bound ≝ + λO:half_ordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤≤ u. definition supremum ≝ - λO:ordered_set.λs:sequence O.λx.upper_bound ? s x ∧ (∀y:O.x ≰ y → ∃n.s n ≰ y). + λO:half_ordered_set.λs:sequence O.λx. + upper_bound ? s x ∧ (∀y:O.x ≰≰ y → ∃n.s n ≰≰ y). -definition increasing ≝ λO:ordered_set.λa:sequence O.∀n:nat.a n ≤ a (S n). +definition increasing ≝ + λO:half_ordered_set.λa:sequence O.∀n:nat.a n ≤≤ a (S n). -notation < "x \nbsp 'is_upper_bound' \nbsp s" non associative with precedence 50 +notation < "x \nbsp 'is_upper_bound' \nbsp s" non associative with precedence 45 for @{'upper_bound $s $x}. -notation < "s \nbsp 'is_increasing'" non associative with precedence 50 +notation < "x \nbsp 'is_lower_bound' \nbsp s" non associative with precedence 45 + for @{'lower_bound $s $x}. +notation < "s \nbsp 'is_increasing'" non associative with precedence 45 for @{'increasing $s}. -notation < "x \nbsp 'is_supremum' \nbsp s" non associative with precedence 50 +notation < "s \nbsp 'is_decreasing'" non associative with precedence 45 + for @{'decreasing $s}. +notation < "x \nbsp 'is_supremum' \nbsp s" non associative with precedence 45 for @{'supremum $s $x}. - -notation > "x 'is_upper_bound' s" non associative with precedence 50 +notation < "x \nbsp 'is_infimum' \nbsp s" non associative with precedence 45 + for @{'infimum $s $x}. +notation > "x 'is_upper_bound' s" non associative with precedence 45 for @{'upper_bound $s $x}. -notation > "s 'is_increasing'" non associative with precedence 50 +notation > "x 'is_lower_bound' s" non associative with precedence 45 + for @{'lower_bound $s $x}. +notation > "s 'is_increasing'" non associative with precedence 45 for @{'increasing $s}. -notation > "x 'is_supremum' s" non associative with precedence 50 +notation > "s 'is_decreasing'" non associative with precedence 45 + for @{'decreasing $s}. +notation > "x 'is_supremum' s" non associative with precedence 45 for @{'supremum $s $x}. +notation > "x 'is_infimum' s" non associative with precedence 45 + for @{'infimum $s $x}. -interpretation "Ordered set upper bound" 'upper_bound s x = - (cic:/matita/dama/supremum/upper_bound.con _ s x). -interpretation "Ordered set increasing" 'increasing s = - (cic:/matita/dama/supremum/increasing.con _ s). -interpretation "Ordered set strong sup" 'supremum s x = - (cic:/matita/dama/supremum/supremum.con _ s x). - -include "bishop_set.ma". - -lemma uniq_supremum: - ∀O:ordered_set.∀s:sequence O.∀t1,t2:O. - t1 is_supremum s → t2 is_supremum s → t1 ≈ t2. -intros (O s t1 t2 Ht1 Ht2); cases Ht1 (U1 H1); cases Ht2 (U2 H2); -apply le_le_eq; intro X; -[1: cases (H1 ? X); apply (U2 w); assumption -|2: cases (H2 ? X); apply (U1 w); assumption] -qed. +interpretation "Ordered set upper bound" 'upper_bound s x = (upper_bound (os_l _) s x). +interpretation "Ordered set lower bound" 'lower_bound s x = (upper_bound (os_r _) s x). + +interpretation "Ordered set increasing" 'increasing s = (increasing (os_l _) s). +interpretation "Ordered set decreasing" 'decreasing s = (increasing (os_r _) s). +interpretation "Ordered set strong sup" 'supremum s x = (supremum (os_l _) s x). +interpretation "Ordered set strong inf" 'infimum s x = (supremum (os_r _) s x). + (* Fact 2.5 *) -lemma supremum_is_upper_bound: - ∀C:ordered_set.∀a:sequence C.∀u:C. - u is_supremum a → ∀v.v is_upper_bound a → u ≤ v. +lemma h_supremum_is_upper_bound: + ∀C:half_ordered_set.∀a:sequence C.∀u:C. + supremum ? a u → ∀v.upper_bound ? a v → u ≤≤ v. intros 7 (C s u Hu v Hv H); cases Hu (_ H1); clear Hu; -cases (H1 ? H) (w Hw); apply Hv; assumption; +cases (H1 ? H) (w Hw); apply Hv; [apply w] assumption; qed. +notation "'supremum_is_upper_bound'" non associative with precedence 90 for @{'supremum_is_upper_bound}. +notation "'infimum_is_lower_bound'" non associative with precedence 90 for @{'infimum_is_lower_bound}. + +interpretation "supremum_is_upper_bound" 'supremum_is_upper_bound = (h_supremum_is_upper_bound (os_l _)). +interpretation "infimum_is_lower_bound" 'infimum_is_lower_bound = (h_supremum_is_upper_bound (os_r _)). + (* Lemma 2.6 *) definition strictly_increasing ≝ - λC:ordered_set.λa:sequence C.∀n:nat.a (S n) ≰ a n. - -notation < "s \nbsp 'is_strictly_increasing'" non associative with precedence 50 + λC:half_ordered_set.λa:sequence C.∀n:nat.a (S n) ≰≰ a n. + +notation < "s \nbsp 'is_strictly_increasing'" non associative with precedence 45 for @{'strictly_increasing $s}. -notation > "s 'is_strictly_increasing'" non associative with precedence 50 +notation > "s 'is_strictly_increasing'" non associative with precedence 45 for @{'strictly_increasing $s}. -interpretation "Ordered set increasing" 'strictly_increasing s = - (cic:/matita/dama/supremum/strictly_increasing.con _ s). +interpretation "Ordered set strict increasing" 'strictly_increasing s = + (strictly_increasing (os_l _) s). -notation "a \uparrow u" non associative with precedence 50 for @{'sup_inc $a $u}. -interpretation "Ordered set supremum of increasing" 'sup_inc s u = - (cic:/matita/dama/cprop_connectives/And.ind#xpointer(1/1) - (cic:/matita/dama/supremum/increasing.con _ s) - (cic:/matita/dama/supremum/supremum.con _ s u)). +notation < "s \nbsp 'is_strictly_decreasing'" non associative with precedence 45 + for @{'strictly_decreasing $s}. +notation > "s 'is_strictly_decreasing'" non associative with precedence 45 + for @{'strictly_decreasing $s}. +interpretation "Ordered set strict decreasing" 'strictly_decreasing s = + (strictly_increasing (os_r _) s). -include "nat_ordered_set.ma". - -alias symbol "nleq" = "Ordered set excess". -alias symbol "leq" = "Ordered set less or equal than". -lemma trans_increasing: - ∀C:ordered_set.∀a:sequence C.a is_increasing → ∀n,m:nat_ordered_set. m ≰ n → a n ≤ a m. +definition uparrow ≝ + λC:half_ordered_set.λs:sequence C.λu:C. + increasing ? s ∧ supremum ? s u. + +interpretation "Ordered set uparrow" 'funion s u = (uparrow (os_l _) s u). +interpretation "Ordered set downarrow" 'fintersects s u = (uparrow (os_r _) s u). + +lemma h_trans_increasing: + ∀C:half_ordered_set.∀a:sequence C.increasing ? a → + ∀n,m:nat_ordered_set. n ≤ m → a n ≤≤ a m. +intros 5 (C a Hs n m); elim m; [ + rewrite > (le_n_O_to_eq n (not_lt_to_le O n H)); + intro X; cases (hos_coreflexive ? (a n) X);] +cases (le_to_or_lt_eq ?? (not_lt_to_le (S n1) n H1)); clear H1; +[2: rewrite > H2; intro; cases (hos_coreflexive ? (a (S n1)) H1); +|1: apply (hle_transitive ???? (H ?) (Hs ?)); + intro; whd in H1; apply (not_le_Sn_n n); apply (transitive_le ??? H2 H1);] +qed. + +notation "'trans_increasing'" non associative with precedence 90 for @{'trans_increasing}. +notation "'trans_decreasing'" non associative with precedence 90 for @{'trans_decreasing}. + +interpretation "trans_increasing" 'trans_increasing = (h_trans_increasing (os_l _)). +interpretation "trans_decreasing" 'trans_decreasing = (h_trans_increasing (os_r _)). + +lemma hint_nat : + Type_of_ordered_set nat_ordered_set → + hos_carr (os_l (nat_ordered_set)). +intros; assumption; +qed. + +coercion hint_nat nocomposites. + +lemma h_trans_increasing_exc: + ∀C:half_ordered_set.∀a:sequence C.increasing ? a → + ∀n,m:nat_ordered_set. m ≰≰ n → a n ≤≤ a m. intros 5 (C a Hs n m); elim m; [cases (not_le_Sn_O n H);] intro; apply H; -[1: change in n1 with (os_carr nat_ordered_set); (* canonical structures *) - change with (n "a 'order_converges' x" non associative with precedence 45 + for @{'order_converge $a $x}. +interpretation "Order convergence" 'order_converge s u = (order_converge _ s u). + +(* Definition 2.8 *) +record segment (O : Type) : Type ≝ { + seg_l_ : O; + seg_u_ : O +}. + +notation > "𝕦_term 90 s" non associative with precedence 90 for @{'upp $s}. +notation "𝕦 \sub term 90 s" non associative with precedence 90 for @{'upp $s}. +notation > "𝕝_term 90 s" non associative with precedence 90 for @{'low $s}. +notation "𝕝 \sub term 90 s" non associative with precedence 90 for @{'low $s}. + +definition seg_u ≝ + λO:half_ordered_set.λs:segment O. + wloss O ?? (λl,u.l) (seg_u_ ? s) (seg_l_ ? s). +definition seg_l ≝ + λO:half_ordered_set.λs:segment O. + wloss O ?? (λl,u.l) (seg_l_ ? s) (seg_u_ ? s). + +interpretation "uppper" 'upp s = (seg_u (os_l _) s). +interpretation "lower" 'low s = (seg_l (os_l _) s). +interpretation "uppper dual" 'upp s = (seg_l (os_r _) s). +interpretation "lower dual" 'low s = (seg_u (os_r _) s). + +definition in_segment ≝ + λO:half_ordered_set.λs:segment O.λx:O. + wloss O ?? (λp1,p2.p1 ∧ p2) (seg_l ? s ≤≤ x) (x ≤≤ seg_u ? s). + +notation "‡O" non associative with precedence 90 for @{'segment $O}. +interpretation "Ordered set sergment" 'segment x = (segment x). + +interpretation "Ordered set sergment in" 'mem x s = (in_segment _ s x). + +definition segment_ordered_set_carr ≝ + λO:half_ordered_set.λs:‡O.∃x.x ∈ s. +definition segment_ordered_set_exc ≝ + λO:half_ordered_set.λs:‡O. + λx,y:segment_ordered_set_carr O s.hos_excess_ O (\fst x) (\fst y). +lemma segment_ordered_set_corefl: + ∀O,s. coreflexive ? (wloss O ?? (segment_ordered_set_exc O s)). +intros 3; cases x; cases (wloss_prop O); +generalize in match (hos_coreflexive O w); +rewrite < (H1 ?? (segment_ordered_set_exc O s)); +rewrite < (H1 ?? (hos_excess_ O)); intros; assumption; +qed. +lemma segment_ordered_set_cotrans : + ∀O,s. cotransitive ? (wloss O ?? (segment_ordered_set_exc O s)). +intros 5 (O s x y z); cases x; cases y ; cases z; clear x y z; +generalize in match (hos_cotransitive O w w1 w2); +cases (wloss_prop O); +do 3 rewrite < (H3 ?? (segment_ordered_set_exc O s)); +do 3 rewrite < (H3 ?? (hos_excess_ O)); intros; apply H4; assumption; +qed. + +lemma half_segment_ordered_set: + ∀O:half_ordered_set.∀s:segment O.half_ordered_set. +intros (O a); constructor 1; +[ apply (segment_ordered_set_carr O a); +| apply (wloss O); +| apply (wloss_prop O); +| apply (segment_ordered_set_exc O a); +| apply (segment_ordered_set_corefl O a); +| apply (segment_ordered_set_cotrans ??); +] +qed. + +lemma segment_ordered_set: + ∀O:ordered_set.∀s:‡O.ordered_set. +intros (O s); +apply half2full; apply (half_segment_ordered_set (os_l O) s); +qed. + +notation "{[ term 19 s ]}" non associative with precedence 90 for @{'segset $s}. +interpretation "Ordered set segment" 'segset s = (segment_ordered_set _ s). + +(* test : + ∀O:ordered_set.∀s: segment (os_l O).∀x:O. + in_segment (os_l O) s x + = + in_segment (os_r O) s x. +intros; try reflexivity; +*) + +lemma prove_in_segment: + ∀O:half_ordered_set.∀s:segment O.∀x:O. + (seg_l O s) ≤≤ x → x ≤≤ (seg_u O s) → x ∈ s. +intros; unfold; cases (wloss_prop O); rewrite < H2; +split; assumption; +qed. + +lemma cases_in_segment: + ∀C:half_ordered_set.∀s:segment C.∀x. x ∈ s → (seg_l C s) ≤≤ x ∧ x ≤≤ (seg_u C s). +intros; unfold in H; cases (wloss_prop C) (W W); rewrite "s 'is_upper_located'" non associative with precedence 45 + for @{'upper_located $s}. +interpretation "Ordered set upper locatedness" 'upper_located s = + (upper_located (os_l _) s). + +notation < "s \nbsp 'is_lower_located'" non associative with precedence 45 + for @{'lower_located $s}. +notation > "s 'is_lower_located'" non associative with precedence 45 + for @{'lower_located $s}. +interpretation "Ordered set lower locatedness" 'lower_located s = + (upper_located (os_r _) s). + +(* Lemma 2.12 *) +lemma h_uparrow_upperlocated: + ∀C:half_ordered_set.∀a:sequence C.∀u:C.uparrow ? a u → upper_located ? a. +intros (C a u H); cases H (H2 H3); clear H; intros 3 (x y Hxy); +cases H3 (H4 H5); clear H3; cases (hos_cotransitive C y x u Hxy) (W W); +[2: cases (H5 x W) (w Hw); left; exists [apply w] assumption; +|1: right; exists [apply u]; split; [apply W|apply H4]] +qed. + +notation "'uparrow_upperlocated'" non associative with precedence 90 for @{'uparrow_upperlocated}. +notation "'downarrow_lowerlocated'" non associative with precedence 90 for @{'downarrow_lowerlocated}. + +interpretation "uparrow_upperlocated" 'uparrow_upperlocated = (h_uparrow_upperlocated (os_l _)). +interpretation "downarrow_lowerlocated" 'downarrow_lowerlocated = (h_uparrow_upperlocated (os_r _)).