From: Enrico Tassi Date: Tue, 14 Oct 2008 13:08:54 +0000 (+0000) Subject: firs step for dualization X-Git-Tag: make_still_working~4687 X-Git-Url: http://matita.cs.unibo.it/gitweb/?a=commitdiff_plain;h=bf7f52019b3f65b6d635a8b49a63f0d95080f189;p=helm.git firs step for dualization --- diff --git a/helm/software/matita/contribs/dama/dama/bishop_set.ma b/helm/software/matita/contribs/dama/dama/bishop_set.ma index 64ae4495d..68d213bd4 100644 --- a/helm/software/matita/contribs/dama/dama/bishop_set.ma +++ b/helm/software/matita/contribs/dama/dama/bishop_set.ma @@ -27,12 +27,12 @@ interpretation "bishop set apartness" 'apart x y = (bs_apart _ x y). definition bishop_set_of_ordered_set: ordered_set → bishop_set. intros (E); apply (mk_bishop_set E (λa,b:E. a ≰ b ∨ b ≰ a)); -[1: unfold; cases E; simplify; clear E; intros (x); unfold; - intros (H1); apply (H x); cases H1; assumption; -|2: unfold; intros(x y H); cases H; clear H; [right|left] assumption; -|3: intros (E); unfold; cases E (T f _ cTf); simplify; intros (x y z Axy); - cases Axy (H H); lapply (cTf ? ? z H) as H1; cases H1; clear Axy H1; - [left; left|right; left|right; right|left; right] assumption] +[1: intro x; simplify; intro H; cases H; clear H; + apply (exc_coreflexive x H1); +|2: intros 3 (x y H); simplify in H ⊢ %; cases H; [right|left]assumption; +|3: intros 4 (x y z H); simplify in H ⊢ %; cases H; clear H; + [ cases (exc_cotransitive x y z H1); [left;left|right;left] assumption; + | cases (exc_cotransitive y x z H1); [right;right|left;right] assumption;]] qed. (* Definition 2.2 (2) *) @@ -55,10 +55,10 @@ intros 6 (E x y z Exy Eyz); intro Axy; cases (bs_cotransitive ???y Axy); [apply Exy|apply Eyz] assumption. qed. -coercion cic:/matita/dama/bishop_set/bishop_set_of_ordered_set.con. +coercion bishop_set_of_ordered_set. lemma le_antisymmetric: - ∀E:ordered_set.antisymmetric E (le E) (eq E). + ∀E:ordered_set.antisymmetric E (le (os_l E)) (eq E). intros 5 (E x y Lxy Lyx); intro H; cases H; [apply Lxy;|apply Lyx] assumption; qed. @@ -67,7 +67,8 @@ lemma le_le_eq: ∀E:ordered_set.∀a,b:E. a ≤ b → b ≤ a → a ≈ b. intros (E x y L1 L2); intro H; cases H; [apply L1|apply L2] assumption; qed. -definition lt ≝ λE:ordered_set.λa,b:E. a ≤ b ∧ a # b. +(* +definition lt ≝ λE:half_ordered_set.λa,b:E. a ≤ b ∧ a # b. interpretation "ordered sets less than" 'lt a b = (lt _ a b). @@ -78,16 +79,17 @@ qed. lemma lt_transitive: ∀E.transitive ? (lt E). intros (E); unfold; intros (x y z H1 H2); cases H1 (Lxy Axy); cases H2 (Lyz Ayz); -split; [apply (le_transitive ???? Lxy Lyz)] clear H1 H2; +split; [apply (le_transitive E ??? Lxy Lyz)] clear H1 H2; cases Axy (H1 H1); cases Ayz (H2 H2); [1:cases (Lxy H1)|3:cases (Lyz H2)]clear Axy Ayz; -[1: cases (os_cotransitive ??? y H1) (X X); [cases (Lxy X)|cases (os_coreflexive ?? X)] -|2: cases (os_cotransitive ??? x H2) (X X); [right;assumption|cases (Lxy X)]] +[1: cases (hos_cotransitive E ?? y H1) (X X); [cases (Lxy X)|cases (hos_coreflexive E ? X)] +|2: cases (hos_cotransitive E ?? x H2) (X X); [right;assumption|cases (Lxy X)]] qed. theorem lt_to_excess: ∀E:ordered_set.∀a,b:E. (a < b) → (b ≰ a). intros (E a b Lab); cases Lab (LEab Aab); cases Aab (H H);[cases (LEab H)] assumption; qed. +*) definition bs_subset ≝ λO:bishop_set.λP,Q:O→Prop.∀x:O.P x → Q x. diff --git a/helm/software/matita/contribs/dama/dama/bishop_set_rewrite.ma b/helm/software/matita/contribs/dama/dama/bishop_set_rewrite.ma index 7ead93370..27bb10f5a 100644 --- a/helm/software/matita/contribs/dama/dama/bishop_set_rewrite.ma +++ b/helm/software/matita/contribs/dama/dama/bishop_set_rewrite.ma @@ -55,12 +55,12 @@ notation > "'Ap'≫" non associative with precedence 50 for @{'aprewriter}. interpretation "ap_rewr" 'aprewriter = (ap_rewr _ _ _). lemma exc_rewl: ∀A:ordered_set.∀x,z,y:A. x ≈ y → y ≰ z → x ≰ z. -intros (A x z y Exy Ayz); cases (os_cotransitive ??? x Ayz); [2:assumption] +intros (A x z y Exy Ayz); cases (hos_cotransitive ??? x Ayz); [2:assumption] cases Exy; right; assumption; qed. lemma exc_rewr: ∀A:ordered_set.∀x,z,y:A. x ≈ y → z ≰ y → z ≰ x. -intros (A x z y Exy Azy); cases (os_cotransitive ???x Azy); [assumption] +intros (A x z y Exy Azy); cases (hos_cotransitive ???x Azy); [assumption] cases (Exy); left; assumption; qed. diff --git a/helm/software/matita/contribs/dama/dama/depends b/helm/software/matita/contribs/dama/dama/depends index 2a59fb1aa..1d54328f5 100644 --- a/helm/software/matita/contribs/dama/dama/depends +++ b/helm/software/matita/contribs/dama/dama/depends @@ -18,11 +18,10 @@ russell_support.ma logic/cprop_connectives.ma nat/nat.ma models/q_copy.ma models/q_bars.ma models/nat_dedekind_sigma_complete.ma models/nat_uniform.ma nat/le_arith.ma russell_support.ma supremum.ma models/nat_lebesgue.ma lebesgue.ma models/nat_order_continuous.ma -models/q_function.ma models/q_copy.ma russell_support.ma models/nat_uniform.ma models/discrete_uniformity.ma nat_ordered_set.ma uniform.ma supremum.ma ordered_uniform.ma uniform.ma -models/q_rebase.ma Q/q/qtimes.ma models/q_function.ma +models/q_rebase.ma Q/q/qtimes.ma models/q_copy.ma russell_support.ma Q/q/qplus.ma Q/q/qtimes.ma datatypes/constructors.ma diff --git a/helm/software/matita/contribs/dama/dama/depends.png b/helm/software/matita/contribs/dama/dama/depends.png index 87c0beacb..8cbedcae0 100644 Binary files a/helm/software/matita/contribs/dama/dama/depends.png and b/helm/software/matita/contribs/dama/dama/depends.png differ diff --git a/helm/software/matita/contribs/dama/dama/nat_ordered_set.ma b/helm/software/matita/contribs/dama/dama/nat_ordered_set.ma index 231cdf941..d4aa1d57d 100644 --- a/helm/software/matita/contribs/dama/dama/nat_ordered_set.ma +++ b/helm/software/matita/contribs/dama/dama/nat_ordered_set.ma @@ -44,9 +44,10 @@ cases (nat_discriminable x z); [2: left; assumption] cases H1; clear H1; qed. lemma nat_ordered_set : ordered_set. -apply (mk_ordered_set ? nat_excess); -[1: intro x; intro; apply (not_le_Sn_n ? H); -|2: apply nat_excess_cotransitive] +letin hos ≝ (mk_half_ordered_set nat nat_excess ? nat_excess_cotransitive);[ + intro x; intro H; apply (not_le_Sn_n ? H);] +constructor 1; +[ apply hos; | apply (dual_hos hos); | reflexivity] qed. interpretation "ordered set N" 'N = nat_ordered_set. @@ -54,7 +55,7 @@ interpretation "ordered set N" 'N = nat_ordered_set. alias id "le" = "cic:/matita/nat/orders/le.ind#xpointer(1/1)". lemma os_le_to_nat_le: ∀a,b:nat_ordered_set.a ≤ b → le a b. -intros; normalize in H; apply (not_lt_to_le ?? H); +intros; normalize in H; apply (not_lt_to_le b a H); qed. lemma nat_le_to_os_le: @@ -62,6 +63,7 @@ lemma nat_le_to_os_le: intros 3; apply (le_to_not_lt a b);assumption; qed. +(* lemma nat_lt_to_os_lt: ∀a,b:nat_ordered_set.a < b → lt nat_ordered_set a b. intros 3; split; @@ -73,4 +75,5 @@ lemma os_lt_to_nat_lt: ∀a,b:nat_ordered_set. lt nat_ordered_set a b → a < b. intros; cases H; clear H; cases H2; [2: apply H;| cases (H1 H)] -qed. \ No newline at end of file +qed. +*) \ No newline at end of file diff --git a/helm/software/matita/contribs/dama/dama/ordered_set.ma b/helm/software/matita/contribs/dama/dama/ordered_set.ma index 06c222830..8a1191442 100644 --- a/helm/software/matita/contribs/dama/dama/ordered_set.ma +++ b/helm/software/matita/contribs/dama/dama/ordered_set.ma @@ -15,51 +15,141 @@ include "datatypes/constructors.ma". include "logic/cprop_connectives.ma". + +(* TEMPLATES +notation "''" non associative with precedence 90 for @{'}. +notation "''" non associative with precedence 90 for @{'}. + +interpretation "" ' = ( (os_l _)). +interpretation "" ' = ( (os_r _)). +*) + (* Definition 2.1 *) -record ordered_set: Type ≝ { - os_carr:> Type; - os_excess: os_carr → os_carr → CProp; - os_coreflexive: coreflexive ? os_excess; - os_cotransitive: cotransitive ? os_excess +record half_ordered_set: Type ≝ { + hos_carr:> Type; + hos_excess: hos_carr → hos_carr → CProp; + hos_coreflexive: coreflexive ? hos_excess; + hos_cotransitive: cotransitive ? hos_excess +}. + +definition dual_hos : half_ordered_set → half_ordered_set. +intro; constructor 1; +[ apply (hos_carr h); +| apply (λx,y.hos_excess h y x); +| apply (hos_coreflexive h); +| intros 4 (x y z H); simplify in H ⊢ %; cases (hos_cotransitive h ?? z H); + [right|left] assumption;] +qed. + +record ordered_set : Type ≝ { + os_l : half_ordered_set; + os_r_ : half_ordered_set; + os_with : os_r_ = dual_hos os_l }. -interpretation "Ordered set excess" 'nleq a b = (os_excess _ a b). +definition os_r : ordered_set → half_ordered_set. +intro o; apply (dual_hos (os_l o)); qed. + +definition Type_of_ordered_set : ordered_set → Type. +intro o; apply (hos_carr (os_l o)); qed. + +definition Type_of_ordered_set_dual : ordered_set → Type. +intro o; apply (hos_carr (os_r o)); qed. + +coercion Type_of_ordered_set_dual. +coercion Type_of_ordered_set. + +notation "a ≰≰ b" non associative with precedence 45 for @{'nleq_low $a $b}. +interpretation "Ordered half set excess" 'nleq_low a b = (hos_excess _ a b). + +interpretation "Ordered set excess (dual)" 'ngeq a b = (hos_excess (os_r _) a b). +interpretation "Ordered set excess" 'nleq a b = (hos_excess (os_l _) a b). + +notation "'exc_coreflexive'" non associative with precedence 90 for @{'exc_coreflexive}. +notation "'cxe_coreflexive'" non associative with precedence 90 for @{'cxe_coreflexive}. + +interpretation "exc_coreflexive" 'exc_coreflexive = (hos_coreflexive (os_l _)). +interpretation "cxe_coreflexive" 'cxe_coreflexive = (hos_coreflexive (os_r _)). + +notation "'exc_cotransitive'" non associative with precedence 90 for @{'exc_cotransitive}. +notation "'cxe_cotransitive'" non associative with precedence 90 for @{'cxe_cotransitive}. + +interpretation "exc_cotransitive" 'exc_cotransitive = (hos_cotransitive (os_l _)). +interpretation "cxe_cotransitive" 'cxe_cotransitive = (hos_cotransitive (os_r _)). (* Definition 2.2 (3) *) -definition le ≝ λE:ordered_set.λa,b:E. ¬ (a ≰ b). +definition le ≝ λE:half_ordered_set.λa,b:E. ¬ (a ≰≰ b). -interpretation "Ordered set greater or equal than" 'geq a b = (le _ b a). +notation "hvbox(a break ≤≤ b)" non associative with precedence 45 for @{ 'leq_low $a $b }. +interpretation "Ordered half set less or equal than" 'leq_low a b = (le _ a b). -interpretation "Ordered set less or equal than" 'leq a b = (le _ a b). +interpretation "Ordered set greater or equal than" 'geq a b = (le (os_r _) a b). +interpretation "Ordered set less or equal than" 'leq a b = (le (os_l _) a b). -lemma le_reflexive: ∀E.reflexive ? (le E). -unfold reflexive; intros 3 (E x H); apply (os_coreflexive ?? H); +lemma hle_reflexive: ∀E.reflexive ? (le E). +unfold reflexive; intros 3 (E x H); apply (hos_coreflexive ?? H); qed. -lemma le_transitive: ∀E.transitive ? (le E). -unfold transitive; intros 7 (E x y z H1 H2 H3); cases (os_cotransitive ??? y H3) (H4 H4); +notation "'le_reflexive'" non associative with precedence 90 for @{'le_reflexive}. +notation "'ge_reflexive'" non associative with precedence 90 for @{'ge_reflexive}. + +interpretation "le reflexive" 'le_reflexive = (hle_reflexive (os_l _)). +interpretation "ge reflexive" 'ge_reflexive = (hle_reflexive (os_r _)). + +(* DUALITY TESTS +lemma test_le_ge_convertible :∀o:ordered_set.∀x,y:o. x ≤ y → y ≥ x. +intros; assumption; qed. + +lemma test_ge_reflexive :∀o:ordered_set.∀x:o. x ≥ x. +intros; apply ge_reflexive. qed. + +lemma test_le_reflexive :∀o:ordered_set.∀x:o. x ≤ x. +intros; apply le_reflexive. qed. +*) + +lemma hle_transitive: ∀E.transitive ? (le E). +unfold transitive; intros 7 (E x y z H1 H2 H3); cases (hos_cotransitive ??? y H3) (H4 H4); [cases (H1 H4)|cases (H2 H4)] qed. +notation "'le_transitive'" non associative with precedence 90 for @{'le_transitive}. +notation "'ge_transitive'" non associative with precedence 90 for @{'ge_transitive}. + +interpretation "le transitive" 'le_transitive = (hle_transitive (os_l _)). +interpretation "ge transitive" 'ge_transitive = (hle_transitive (os_r _)). + (* Lemma 2.3 *) -lemma exc_le_variance: - ∀O:ordered_set.∀a,b,a',b':O.a ≰ b → a ≤ a' → b' ≤ b → a' ≰ b'. +lemma exc_hle_variance: + ∀O:half_ordered_set.∀a,b,a',b':O.a ≰≰ b → a ≤≤ a' → b' ≤≤ b → a' ≰≰ b'. intros (O a b a1 b1 Eab Laa1 Lb1b); -cases (os_cotransitive ??? a1 Eab) (H H); [cases (Laa1 H)] -cases (os_cotransitive ??? b1 H) (H1 H1); [assumption] +cases (hos_cotransitive ??? a1 Eab) (H H); [cases (Laa1 H)] +cases (hos_cotransitive ??? b1 H) (H1 H1); [assumption] cases (Lb1b H1); qed. -lemma square_ordered_set: ordered_set → ordered_set. +notation "'exc_le_variance'" non associative with precedence 90 for @{'exc_le_variance}. +notation "'exc_ge_variance'" non associative with precedence 90 for @{'exc_ge_variance}. + +interpretation "exc_le_variance" 'exc_le_variance = (exc_hle_variance (os_l _)). +interpretation "exc_ge_variance" 'exc_ge_variance = (exc_hle_variance (os_r _)). + +lemma square_half_ordered_set: half_ordered_set → half_ordered_set. intro O; -apply (mk_ordered_set (O × O)); -[1: intros (x y); apply (\fst x ≰ \fst y ∨ \snd x ≰ \snd y); +apply (mk_half_ordered_set (O × O)); +[1: intros (x y); apply (\fst x ≰≰ \fst y ∨ \snd x ≰≰ \snd y); |2: intro x0; cases x0 (x y); clear x0; simplify; intro H; - cases H (X X); apply (os_coreflexive ?? X); + cases H (X X); apply (hos_coreflexive ?? X); |3: intros 3 (x0 y0 z0); cases x0 (x1 x2); cases y0 (y1 y2) ; cases z0 (z1 z2); clear x0 y0 z0; simplify; intro H; cases H (H1 H1); clear H; - [1: cases (os_cotransitive ??? z1 H1); [left; left|right;left]assumption; - |2: cases (os_cotransitive ??? z2 H1); [left;right|right;right]assumption]] + [1: cases (hos_cotransitive ??? z1 H1); [left; left|right;left]assumption; + |2: cases (hos_cotransitive ??? z2 H1); [left;right|right;right]assumption]] +qed. + +lemma square_ordered_set: ordered_set → ordered_set. +intro O; constructor 1; +[ apply (square_half_ordered_set (os_l O)); +| apply (dual_hos (square_half_ordered_set (os_l O))); +| reflexivity] qed. notation "s 2 \atop \nleq" non associative with precedence 90 diff --git a/helm/software/matita/contribs/dama/dama/supremum.ma b/helm/software/matita/contribs/dama/dama/supremum.ma index 6fa8e35ad..a3a341fea 100644 --- a/helm/software/matita/contribs/dama/dama/supremum.ma +++ b/helm/software/matita/contribs/dama/dama/supremum.ma @@ -19,16 +19,15 @@ include "nat_ordered_set.ma". include "sequence.ma". (* Definition 2.4 *) -definition upper_bound ≝ λO:ordered_set.λa:sequence O.λu:O.∀n:nat.a n ≤ u. -definition lower_bound ≝ λO:ordered_set.λa:sequence O.λu:O.∀n:nat.u ≤ a n. +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). -definition infimum ≝ - λO:ordered_set.λs:sequence O.λx.lower_bound ? s x ∧ (∀y:O.y ≰ x → ∃n.y ≰ s n). + λ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 decreasing ≝ λO:ordered_set.λa:sequence O.∀n:nat.a (S n) ≤ a 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 45 for @{'upper_bound $s $x}. @@ -42,7 +41,6 @@ notation < "x \nbsp 'is_supremum' \nbsp s" non associative with precedence 45 for @{'supremum $s $x}. 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 > "x 'is_lower_bound' s" non associative with precedence 45 @@ -56,13 +54,16 @@ notation > "x 'is_supremum' s" non associative with precedence 45 notation > "x 'is_infimum' s" non associative with precedence 45 for @{'infimum $s $x}. -interpretation "Ordered set upper bound" 'upper_bound s x = (upper_bound _ s x). -interpretation "Ordered set lower bound" 'lower_bound s x = (lower_bound _ s x). -interpretation "Ordered set increasing" 'increasing s = (increasing _ s). -interpretation "Ordered set decreasing" 'decreasing s = (decreasing _ s). -interpretation "Ordered set strong sup" 'supremum s x = (supremum _ s x). -interpretation "Ordered set strong inf" 'infimum s x = (infimum _ s x). +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). +(* 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. @@ -73,108 +74,107 @@ apply le_le_eq; intro X; qed. (* 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. -lemma infimum_is_lower_bound: +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 _)). + +(* 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 → v ≤ u. -intros 7 (C s u Hu v Hv H); cases Hu (_ H1); clear Hu; -cases (H1 ? H) (w Hw); apply Hv; assumption; + 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:ordered_set.λa:sequence C.∀n:nat.a (S n) ≰ a n. -definition strictly_decreasing ≝ - λC:ordered_set.λa:sequence C.∀n:nat.a n ≰ a (S n). + λ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 45 for @{'strictly_increasing $s}. interpretation "Ordered set strict increasing" 'strictly_increasing s = - (strictly_increasing _ s). + (strictly_increasing (os_l _) s). + 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_decreasing _ s). + (strictly_increasing (os_r _) s). definition uparrow ≝ - λC:ordered_set.λs:sequence C.λu:C. - s is_increasing ∧ u is_supremum s. - -definition downarrow ≝ - λC:ordered_set.λs:sequence C.λu:C. - s is_decreasing ∧ u is_infimum s. - + λ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" 'sup_inc s u = (uparrow _ s 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 downarrow" 'inf_dec s u = (downarrow _ s u). +*) +interpretation "Ordered set downarrow" 'fintersects s u = (uparrow (os_r _) s u). -lemma trans_increasing: - ∀C:ordered_set.∀a:sequence C.a is_increasing → - ∀n,m:nat_ordered_set. n ≤ m → a n ≤ a m. +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 (os_coreflexive ?? X);] + intro X; cases (hos_coreflexive ?? X);] cases (le_to_or_lt_eq ?? (not_lt_to_le (S n1) n H1)); clear H1; -[2: rewrite > H2; intro; cases (os_coreflexive ?? H1); -|1: apply (le_transitive ???? (H ?) (Hs ?)); +[2: rewrite > H2; intro; cases (hos_coreflexive ?? H1); +|1: apply (hle_transitive ???? (H ?) (Hs ?)); intro; whd in H1; apply (not_le_Sn_n n); apply (transitive_le ??? H2 H1);] qed. -lemma trans_decreasing: +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 _)). + +(* 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 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 (os_coreflexive ?? X);] -cases (le_to_or_lt_eq ?? (not_lt_to_le (S n1) n H1)); clear H1; -[2: rewrite > H2; intro; cases (os_coreflexive ?? H1); -|1: apply (le_transitive ???? (Hs ?) (H ?)); - intro; whd in H1; apply (not_le_Sn_n n); apply (transitive_le ??? H2 H1);] -qed. +intros; apply (trans_decreasing ? H ?? H1); qed. +*) -lemma trans_increasing_exc: - ∀C:ordered_set.∀a:sequence C.a is_increasing → - ∀n,m:nat_ordered_set. m ≰ n → a n ≤ a m. +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 interpretation "Order convergence" 'order_converge s u = (order_converge _ s u). (* Definition 2.8 *) -definition segment ≝ λO:ordered_set.λa,b:O.λx:O.(x ≤ b) ∧ (a ≤ x). +definition segment ≝ λO:half_ordered_set.λa,b:O.λx:O.(x ≤≤ b) ∧ (a ≤≤ x). notation "[term 19 a,term 19 b]" non associative with precedence 90 for @{'segment $a $b}. -interpretation "Ordered set sergment" 'segment a b = (segment _ a b). +interpretation "Ordered set sergment" 'segment a b = (segment (os_l _) a b). 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 _ a b x). +interpretation "Ordered set sergment in" 'segment_in a b x= (segment (os_l _) a b x). + +definition segment_ordered_set_carr ≝ + λO:half_ordered_set.λu,v:O.∃x.segment ? u v x. +definition segment_ordered_set_exc ≝ + λO:half_ordered_set.λu,v:O. + λx,y:segment_ordered_set_carr ? u v.\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. +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; +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 ???)); +qed. lemma segment_ordered_set: ∀O:ordered_set.∀u,v:O.ordered_set. -intros (O u v); apply (mk_ordered_set (∃x.x ∈ [u,v])); -[1: intros (x y); apply (\fst x ≰ \fst y); -|2: intro x; cases x; simplify; apply os_coreflexive; -|3: intros 3 (x y z); cases x; cases y ; cases z; simplify; apply os_cotransitive] +intros (O u v); letin hos ≝ (half_segment_ordered_set (os_l O) u v); +constructor 1; [apply hos; | apply (dual_hos hos); | reflexivity] qed. notation "hvbox({[a, break b]})" non associative with precedence 90 for @{'segment_set $a $b}. +interpretation "Ordered set segment" 'segment_set a b = + (half_segment_ordered_set _ a b). interpretation "Ordered set segment" 'segment_set a b = (segment_ordered_set _ a b). + (* Lemma 2.9 *) -lemma segment_preserves_supremum: - ∀O:ordered_set.∀l,u:O.∀a:sequence {[l,u]}.∀x:{[l,u]}. - ⌊n,\fst (a n)⌋ is_increasing ∧ - (\fst x) is_supremum ⌊n,\fst (a n)⌋ → a ↑ x. +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. intros; split; cases H; clear H; [1: apply H1; |2: cases H2; split; clear H2; @@ -261,23 +275,18 @@ intros; split; cases H; clear H; |2: clear H; intro y0; apply (H3 (\fst y0));]] qed. -lemma segment_preserves_infimum: - ∀O:ordered_set.∀l,u:O.∀a:sequence {[l,u]}.∀x:{[l,u]}. - ⌊n,\fst (a n)⌋ is_decreasing ∧ - (\fst x) is_infimum ⌊n,\fst (a n)⌋ → a ↓ x. -intros; split; cases H; clear H; -[1: apply H1; -|2: cases H2; split; clear H2; - [1: apply H; - |2: clear H; intro y0; apply (H3 (\fst y0));]] -qed. +notation "'segment_preserves_supremum'" non associative with precedence 90 for @{'segment_preserves_supremum}. +notation "'segment_preserves_infimum'" non associative with precedence 90 for @{'segment_preserves_infimum}. + +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 _)). (* Definition 2.10 *) alias symbol "square" = "ordered set square". alias symbol "pi2" = "pair pi2". alias symbol "pi1" = "pair pi1". definition square_segment ≝ - λO:ordered_set.λa,b:O.λx:O square. + λO:ordered_set.λa,b:O.λx: O square. And4 (\fst x ≤ b) (a ≤ \fst x) (\snd x ≤ b) (a ≤ \snd x). definition convex ≝ @@ -286,40 +295,34 @@ definition convex ≝ (* Definition 2.11 *) definition upper_located ≝ - λO:ordered_set.λa:sequence O.∀x,y:O. y ≰ x → - (∃i:nat.a i ≰ x) ∨ (∃b:O.y≰b ∧ ∀i:nat.a i ≤ b). - -definition lower_located ≝ - λO:ordered_set.λa:sequence O.∀x,y:O. x ≰ y → - (∃i:nat.x ≰ a i) ∨ (∃b:O.b≰y ∧ ∀i:nat.b ≤ a i). + λO:half_ordered_set.λa:sequence O.∀x,y:O. y ≰≰ x → + (∃i:nat.a i ≰≰ x) ∨ (∃b:O.y ≰≰ b ∧ ∀i:nat.a i ≤≤ b). notation < "s \nbsp 'is_upper_located'" non associative with precedence 45 for @{'upper_located $s}. notation > "s 'is_upper_located'" non associative with precedence 45 for @{'upper_located $s}. interpretation "Ordered set upper locatedness" 'upper_located s = - (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 = - (lower_located _ s). - + (upper_located (os_r _) s). + (* Lemma 2.12 *) -lemma uparrow_upperlocated: - ∀C:ordered_set.∀a:sequence C.∀u:C.a ↑ u → a is_upper_located. +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 (os_cotransitive ??? u Hxy) (W W); +cases H3 (H4 H5); clear H3; cases (hos_cotransitive ??? u Hxy) (W W); [2: cases (H5 ? W) (w Hw); left; exists [apply w] assumption; |1: right; exists [apply u]; split; [apply W|apply H4]] -qed. +qed. -lemma downarrow_lowerlocated: - ∀C:ordered_set.∀a:sequence C.∀u:C.a ↓ u → a is_lower_located. -intros (C a u H); cases H (H2 H3); clear H; intros 3 (x y Hxy); -cases H3 (H4 H5); clear H3; cases (os_cotransitive ??? u Hxy) (W W); -[1: cases (H5 ? W) (w Hw); left; exists [apply w] assumption; -|2: 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 _)).