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=0a6d26112867da0461122b26ce3ce25c9cf1e411;hpb=f36588e673e67f0758fdbec52baa515a28fd9a7a;p=helm.git diff --git a/helm/software/matita/contribs/dama/dama/supremum.ma b/helm/software/matita/contribs/dama/dama/supremum.ma index 0a6d26112..0de61b292 100644 --- a/helm/software/matita/contribs/dama/dama/supremum.ma +++ b/helm/software/matita/contribs/dama/dama/supremum.ma @@ -63,16 +63,6 @@ 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). -(* se non faccio il bs_of_hos perdo dualità qui *) -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. - (* Fact 2.5 *) lemma h_supremum_is_upper_bound: ∀C:half_ordered_set.∀a:sequence C.∀u:C. @@ -87,14 +77,6 @@ notation "'infimum_is_lower_bound'" non associative with precedence 90 for @{'in 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 _)). -(* TEST DUALITY -lemma test_infimum_is_lower_bound_duality: - ∀C:ordered_set.∀a:sequence C.∀u:C. - u is_infimum a → ∀v.v is_lower_bound a → u ≥ v. -intros; lapply (infimum_is_lower_bound a u H v H1); assumption; -qed. -*) - (* Lemma 2.6 *) definition strictly_increasing ≝ λC:half_ordered_set.λa:sequence C.∀n:nat.a (S n) ≰≰ a n. @@ -116,16 +98,8 @@ interpretation "Ordered set strict decreasing" 'strictly_decreasing s = definition uparrow ≝ λC:half_ordered_set.λs:sequence C.λu:C. increasing ? s ∧ supremum ? s u. -(* -notation < "a \uparrow \nbsp u" non associative with precedence 45 for @{'sup_inc $a $u}. -notation > "a \uparrow u" non associative with precedence 45 for @{'sup_inc $a $u}. -*) -interpretation "Ordered set uparrow" 'funion s u = (uparrow (os_l _) s u). -(* -notation < "a \downarrow \nbsp u" non associative with precedence 45 for @{'inf_dec $a $u}. -notation > "a \downarrow u" non associative with precedence 45 for @{'inf_dec $a $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: @@ -133,9 +107,9 @@ lemma h_trans_increasing: ∀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 ?? X);] + 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 ?? 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. @@ -146,23 +120,24 @@ notation "'trans_decreasing'" non associative with precedence 90 for @{'trans_de interpretation "trans_increasing" 'trans_increasing = (h_trans_increasing (os_l _)). interpretation "trans_decreasing" 'trans_decreasing = (h_trans_increasing (os_r _)). -(* TEST DUALITY -lemma test_trans_decreasing_duality: - ∀C:ordered_set.∀a:sequence C.a is_decreasing → - ∀n,m:nat_ordered_set. n ≤ m → a m ≤ a n. -intros; apply (trans_decreasing ? H ?? H1); qed. -*) +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. + ∀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 (hos_carr (os_l nat_ordered_set)); change with (n "a 'order_converges' x" non associative with precedence 45 interpretation "Order convergence" 'order_converge s u = (order_converge _ s u). (* Definition 2.8 *) -definition segment ≝ λO:half_ordered_set.λa,b:O.λx:O.(x ≤≤ b) ∧ (a ≤≤ x). +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 "[term 19 a,term 19 b]" non associative with precedence 90 for @{'segment $a $b}. -interpretation "Ordered set sergment" 'segment a b = (segment (os_l _) a b). +notation "‡O" non associative with precedence 90 for @{'segment $O}. +interpretation "Ordered set sergment" 'segment x = (segment x). -notation "hvbox(x \in break [term 19 a, term 19 b])" non associative with precedence 45 - for @{'segment_in $a $b $x}. -interpretation "Ordered set sergment in" 'segment_in a b x= (segment (os_l _) a b x). +interpretation "Ordered set sergment in" 'mem x s = (in_segment _ s x). definition segment_ordered_set_carr ≝ - λO:half_ordered_set.λu,v:O.∃x.segment ? u v x. + λO:half_ordered_set.λs:‡O.∃x.x ∈ s. definition segment_ordered_set_exc ≝ - λO:half_ordered_set.λu,v:O. - λx,y:segment_ordered_set_carr ? u v.\fst x ≰≰ \fst y. + λ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,u,v. coreflexive ? (segment_ordered_set_exc O u v). -intros 4; cases x; simplify; apply hos_coreflexive; qed. + ∀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,u,v. cotransitive ? (segment_ordered_set_exc O u v). -intros 6 (O u v x y z); cases x; cases y ; cases z; simplify; apply hos_cotransitive; + ∀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.∀u,v:O.half_ordered_set. -intros (O u v); apply (mk_half_ordered_set ?? (segment_ordered_set_corefl O u v) (segment_ordered_set_cotrans ???)); + ∀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.∀u,v:O.ordered_set. -intros (O u v); letin hos ≝ (half_segment_ordered_set (os_l O) u v); -constructor 1; [apply hos; | apply (dual_hos hos); | reflexivity] + ∀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 "hvbox({[a, break b]/})" non associative with precedence 90 - for @{'h_segment_set $a $b}. -interpretation "Half ordered set segment" 'h_segment_set a b = - (half_segment_ordered_set _ a b). +definition hint_sequence3: + ∀C:ordered_set. + sequence (Type_of_ordered_set_dual C) → sequence (hos_carr (os_r C)). +intros;assumption; +qed. + +coercion hint_sequence nocomposites. +coercion hint_sequence1 nocomposites. +coercion hint_sequence2 nocomposites. +coercion hint_sequence3 nocomposites. + +(* Lemma 2.9 - non easily dualizable *) -notation < "hvbox({[a, break b]})" non associative with precedence 90 - for @{'segment_set $a $b}. -notation > "hvbox({[a, break b]})" non associative with precedence 90 - for @{'segment_set $a $b}. -interpretation "Ordered set segment" 'segment_set a b = - (segment_ordered_set _ a b). +lemma x2sx_: + ∀O:half_ordered_set. + ∀s:segment O.∀x,y:half_segment_ordered_set ? s. + \fst x ≰≰ \fst y → x ≰≰ y. +intros 4; cases x; cases y; clear x y; simplify; unfold hos_excess; +whd in ⊢ (?→? (% ? ?)? ? ? ? ?); simplify in ⊢ (?→%); +cases (wloss_prop O) (E E); do 2 rewrite < E; intros; assumption; +qed. +lemma sx2x_: + ∀O:half_ordered_set. + ∀s:segment O.∀x,y:half_segment_ordered_set ? s. + x ≰≰ y → \fst x ≰≰ \fst y. +intros 4; cases x; cases y; clear x y; simplify; unfold hos_excess; +whd in ⊢ (? (% ? ?) ?? ? ? ? → ?); simplify in ⊢ (% → ?); +cases (wloss_prop O) (E E); do 2 rewrite < E; intros; assumption; +qed. + +lemma l2sl_: + ∀C,s.∀x,y:half_segment_ordered_set C s. \fst x ≤≤ \fst y → x ≤≤ y. +intros; intro; apply H; apply sx2x_; apply H1; +qed. + + +lemma sl2l_: + ∀C,s.∀x,y:half_segment_ordered_set C s. x ≤≤ y → \fst x ≤≤ \fst y. +intros; intro; apply H; apply x2sx_; apply H1; +qed. + +coercion x2sx_ nocomposites. +coercion sx2x_ nocomposites. +coercion l2sl_ nocomposites. +coercion sl2l_ nocomposites. -(* Lemma 2.9 *) lemma h_segment_preserves_supremum: - ∀O:half_ordered_set.∀l,u:O.∀a:sequence {[l,u]/}.∀x:{[l,u]/}. - increasing ? ⌊n,\fst (a n)⌋ ∧ - supremum ? ⌊n,\fst (a n)⌋ (\fst x) → uparrow ? a x. + ∀O:half_ordered_set.∀s:segment O. + ∀a:sequence (half_segment_ordered_set ? s). + ∀x:half_segment_ordered_set ? s. + increasing ? ⌊n,\fst (a n)⌋ ∧ + supremum ? ⌊n,\fst (a n)⌋ (\fst x) → uparrow ? a x. intros; split; cases H; clear H; -[1: apply H1; +[1: intro n; lapply (H1 n) as K; clear H1 H2; + intro; apply K; clear K; apply rule H; |2: cases H2; split; clear H2; - [1: apply H; - |2: clear H; intro y0; apply (H3 (\fst y0));]] + [1: intro n; lapply (H n) as K; intro W; apply K; + apply rule W; + |2: clear H1 H; intros (y0 Hy0); cases (H3 (\fst y0));[exists[apply w]] + [1: change in H with (\fst (a w) ≰≰ \fst y0); apply rule H; + |2: apply rule Hy0;]]] qed. notation "'segment_preserves_supremum'" non associative with precedence 90 for @{'segment_preserves_supremum}. @@ -288,17 +379,33 @@ notation "'segment_preserves_infimum'" non associative with precedence 90 for @{ interpretation "segment_preserves_supremum" 'segment_preserves_supremum = (h_segment_preserves_supremum (os_l _)). interpretation "segment_preserves_infimum" 'segment_preserves_infimum = (h_segment_preserves_supremum (os_r _)). +(* +test segment_preserves_infimum2: + ∀O:ordered_set.∀s:‡O.∀a:sequence {[s]}.∀x:{[s]}. + ⌊n,\fst (a n)⌋ is_decreasing ∧ + (\fst x) is_infimum ⌊n,\fst (a n)⌋ → a ↓ x. +intros; apply (segment_preserves_infimum s a x H); +qed. +*) + (* Definition 2.10 *) + alias symbol "pi2" = "pair pi2". alias symbol "pi1" = "pair pi1". +(* definition square_segment ≝ - λO:ordered_set.λa,b:O.λx: O squareO. - And4 (\fst x ≤ b) (a ≤ \fst x) (\snd x ≤ b) (a ≤ \snd x). - + λO:half_ordered_set.λs:segment O.λx: square_half_ordered_set O. + in_segment ? s (\fst x) ∧ in_segment ? s (\snd x). +*) definition convex ≝ - λO:ordered_set.λU:O squareO → Prop. - ∀p.U p → \fst p ≤ \snd p → ∀y. - square_segment O (\fst p) (\snd p) y → U y. + λO:half_ordered_set.λU:square_half_ordered_set O → Prop. + ∀s.U s → le O (\fst s) (\snd s) → + ∀y. + le O (\fst y) (\snd s) → + le O (\fst s) (\fst y) → + le O (\snd y) (\snd s) → + le O (\fst y) (\snd y) → + U y. (* Definition 2.11 *) definition upper_located ≝ @@ -323,8 +430,8 @@ interpretation "Ordered set lower locatedness" 'lower_located s = 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 ??? u Hxy) (W W); -[2: cases (H5 ? W) (w Hw); left; exists [apply w] assumption; +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.