+record segment (O : Type) : Type ≝ {
+ seg_l_ : O;
+ seg_u_ : O
+}.
+
+notation > "𝕦_term 90 s p" non associative with precedence 45 for @{'upp $s $p}.
+notation "𝕦 \sub term 90 s p" non associative with precedence 45 for @{'upp $s $p}.
+notation > "𝕝_term 90 s p" non associative with precedence 45 for @{'low $s $p}.
+notation "𝕝 \sub term 90 s p" non associative with precedence 45 for @{'low $s $p}.
+
+definition seg_u ≝
+ λO:half_ordered_set.λs:segment O.λP: O → CProp.
+ wloss O ? (λl,u.P u) (seg_l_ ? s) (seg_u_ ? s).
+definition seg_l ≝
+ λO:half_ordered_set.λs:segment O.λP: O → CProp.
+ wloss O ? (λl,u.P u) (seg_u_ ? s) (seg_l_ ? s).
+
+interpretation "uppper" 'upp s P = (seg_u (os_l _) s P).
+interpretation "lower" 'low s P = (seg_l (os_l _) s P).
+interpretation "uppper dual" 'upp s P = (seg_l (os_r _) s P).
+interpretation "lower dual" 'low s P = (seg_u (os_r _) s P).
+
+definition in_segment ≝
+ λO:half_ordered_set.λs:segment O.λx:O.
+ wloss O ? (λp1,p2.p1 ∧ p2) (seg_u ? s (λu.u ≤≤ x)) (seg_l ? s (λl.x ≤≤ l)).