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
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}.
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
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.
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<n1); (* is sort elimination not allowed preserved by delta? *)
+[1: change in n1 with (hos_carr (os_l nat_ordered_set));
+ change with (n<n1);
cases (le_to_or_lt_eq ?? H1); [apply le_S_S_to_le;assumption]
- cases (Hs n); rewrite < H3 in H2; assumption (* ogni goal di tipo Prop non è anche di tipo CProp *)
-|2: cases (os_cotransitive ??? (a n1) H2); [assumption]
+ cases (Hs n); rewrite < H3 in H2; assumption;
+|2: cases (hos_cotransitive ??? (a n1) H2); [assumption]
cases (Hs n1); assumption;]
qed.
-lemma trans_decreasing_exc:
- ∀C:ordered_set.∀a:sequence C.a is_decreasing →
- ∀n,m:nat_ordered_set. m ≰ n → a m ≤ a n .
-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<n1); (* is sort elimination not allowed preserved by delta? *)
- cases (le_to_or_lt_eq ?? H1); [apply le_S_S_to_le;assumption]
- cases (Hs n); rewrite < H3 in H2; assumption (* ogni goal di tipo Prop non è anche di tipo CProp *)
-|2: cases (os_cotransitive ??? (a n1) H2); [2:assumption]
- cases (Hs n1); assumption;]
-qed.
+notation "'trans_increasing_exc'" non associative with precedence 90 for @{'trans_increasing_exc}.
+notation "'trans_decreasing_exc'" non associative with precedence 90 for @{'trans_decreasing_exc}.
+
+interpretation "trans_increasing_exc" 'trans_increasing_exc = (h_trans_increasing_exc (os_l _)).
+interpretation "trans_decreasing_exc" 'trans_decreasing_exc = (h_trans_increasing_exc (os_r _)).
alias symbol "exists" = "CProp exists".
-lemma strictly_increasing_reaches:
- ∀C:ordered_set.∀m:sequence nat_ordered_set.
+lemma nat_strictly_increasing_reaches:
+ ∀m:sequence nat_ordered_set.
m is_strictly_increasing → ∀w.∃t.m t ≰ w.
intros; elim w;
[1: cases (nat_discriminable O (m O)); [2: cases (not_le_Sn_n O (ltn_to_ltO ?? H1))]
apply (transitive_le ??? H2 Hp);]]
qed.
-lemma selection_uparrow:
- ∀C:ordered_set.∀m:sequence nat_ordered_set.m is_strictly_increasing →
- ∀a:sequence C.∀u.a ↑ u → ⌊x,a (m x)⌋ ↑ u.
+lemma h_selection_uparrow:
+ ∀C:half_ordered_set.∀m:sequence nat_ordered_set.
+ m is_strictly_increasing →
+ ∀a:sequence C.∀u.uparrow ? a u → uparrow ? ⌊x,a (m x)⌋ u.
intros (C m Hm a u Ha); cases Ha (Ia Su); cases Su (Uu Hu); repeat split;
-[1: intro n; simplify; apply trans_increasing_exc; [assumption] apply (Hm n);
+[1: intro n; simplify; apply (h_trans_increasing_exc ? a Ia); apply (Hm n);
|2: intro n; simplify; apply Uu;
|3: intros (y Hy); simplify; cases (Hu ? Hy);
- cases (strictly_increasing_reaches C ? Hm w);
- exists [apply w1]; cases (os_cotransitive ??? (a (m w1)) H); [2:assumption]
- cases (trans_increasing_exc C ? Ia ?? H1); assumption;]
+ cases (nat_strictly_increasing_reaches ? Hm w);
+ exists [apply w1]; cases (hos_cotransitive ??? (a (m w1)) H); [2:assumption]
+ cases (h_trans_increasing_exc ?? Ia ?? H1); assumption;]
qed.
-lemma selection_downarrow:
- ∀C:ordered_set.∀m:sequence nat_ordered_set.m is_strictly_increasing →
- ∀a:sequence C.∀u.a ↓ u → ⌊x,a (m x)⌋ ↓ u.
-intros (C m Hm a u Ha); cases Ha (Ia Su); cases Su (Uu Hu); repeat split;
-[1: intro n; simplify; apply trans_decreasing_exc; [assumption] apply (Hm n);
-|2: intro n; simplify; apply Uu;
-|3: intros (y Hy); simplify; cases (Hu ? Hy);
- cases (strictly_increasing_reaches C ? Hm w);
- exists [apply w1]; cases (os_cotransitive ??? (a (m w1)) H); [assumption]
- cases (trans_decreasing_exc C ? Ia ?? H1); assumption;]
-qed.
+notation "'selection_uparrow'" non associative with precedence 90 for @{'selection_uparrow}.
+notation "'selection_downarrow'" non associative with precedence 90 for @{'selection_downarrow}.
+
+interpretation "selection_uparrow" 'selection_uparrow = (h_selection_uparrow (os_l _)).
+interpretation "selection_downarrow" 'selection_downarrow = (h_selection_uparrow (os_r _)).
(* Definition 2.7 *)
definition order_converge ≝
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;
|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 ≝
(* 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 _)).