Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************)
(* * The Coq Proof Assistant / The Coq Development Team *)
(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
(* // * This file is distributed under the terms of the *)
(* * GNU Lesser General Public License Version 2.1 *)
(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
Set interfaces, inspired by the one of Ocaml. When compared with
Ocaml, the main differences are:
Several variants of the set interfaces are available:
If unsure, S = Sets is probably what you're looking for: most other
signatures are subsets of it, while Sets can be obtained from
RawSets via the use of a subset type (see (W)Raw2Sets below).
- the lack of iter function, useless since Coq is purely functional
- the use of option types instead of Not_found exceptions
- the use of nat instead of int for the cardinal function
- WSetsOn : functorial signature for weak sets
- WSets : self-contained version of WSets
- SetsOn : functorial signature for ordered sets
- Sets : self-contained version of Sets
- WRawSets : a signature for weak sets that may be ill-formed
- RawSets : same for ordered sets
Require Export Bool SetoidList RelationClasses Morphisms RelationPairs Equalities Orders OrdersFacts. Set Implicit Arguments. Unset Strict Implicit. Module Type TypElt. Parameters t elt : Type. End TypElt. Module Type HasWOps (Import T:TypElt). Parameter empty : t.
The empty set.
Parameter is_empty : t -> bool.
Test whether a set is empty or not.
Parameter mem : elt -> t -> bool.
mem x s tests whether x belongs to the set s.
Parameter add : elt -> t -> t.
add x s returns a set containing all elements of s,
plus x. If x was already in s, s is returned unchanged.
Parameter singleton : elt -> t.
singleton x returns the one-element set containing only x.
Parameter remove : elt -> t -> t.
remove x s returns a set containing all elements of s,
except x. If x was not in s, s is returned unchanged.
Parameter union : t -> t -> t.
Set union.
Parameter inter : t -> t -> t.
Set intersection.
Parameter diff : t -> t -> t.
Set difference.
Parameter equal : t -> t -> bool.
equal s1 s2 tests whether the sets s1 and s2 are
equal, that is, contain equal elements.
Parameter subset : t -> t -> bool.
subset s1 s2 tests whether the set s1 is a subset of
the set s2.
Parameter fold : forall A : Type, (elt -> A -> A) -> t -> A -> A.
fold f s a computes (f xN ... (f x2 (f x1 a))...),
where x1 ... xN are the elements of s.
The order in which elements of s are presented to f is
unspecified.
Parameter for_all : (elt -> bool) -> t -> bool.
for_all p s checks if all elements of the set
satisfy the predicate p.
Parameter exists_ : (elt -> bool) -> t -> bool.
∃ p s checks if at least one element of
the set satisfies the predicate p.
Parameter filter : (elt -> bool) -> t -> t.
filter p s returns the set of all elements in s
that satisfy predicate p.
Parameter partition : (elt -> bool) -> t -> t * t.
partition p s returns a pair of sets (s1, s2), where
s1 is the set of all the elements of s that satisfy the
predicate p, and s2 is the set of all the elements of
s that do not satisfy p.
Parameter cardinal : t -> nat.
Return the number of elements of a set.
Parameter elements : t -> list elt.
Return the list of all elements of the given set, in any order.
Parameter choose : t -> option elt.
Return one element of the given set, or None if
the set is empty. Which element is chosen is unspecified.
Equal sets could return different elements.
End HasWOps. Module Type WOps (E : DecidableType). Definition elt := E.t. Parameter t : Type.
the abstract type of sets
Include HasWOps. End WOps.
Functorial signature for weak sets
Module Type WSetsOn (E : DecidableType).
First, we ask for all the functions
Include WOps E.
Logical predicates
Parameter In : elt -> t -> Prop. Declare Instance In_compat : Proper (E.eq==>eq==>iff) In. Definition Equal s s' := forall a : elt, In a s <-> In a s'. Definition Subset s s' := forall a : elt, In a s -> In a s'. Definition Empty s := forall a : elt, ~ In a s. Definition For_all (P : elt -> Prop) s := forall x, In x s -> P x. Definition Exists (P : elt -> Prop) s := exists x, In x s /\ P x. Notation "s [=] t" := (Equal s t) (at level 70, no associativity). Notation "s [<=] t" := (Subset s t) (at level 70, no associativity). Definition eq : t -> t -> Prop := Equal. Include IsEq.
eq is obviously an equivalence, for subtyping only
Include HasEqDec.
Specifications of set operators
Section Spec. Variable s s': t. Variable x y : elt. Variable f : elt -> bool. Notation compatb := (Proper (E.eq==>Logic.eq)) (only parsing). Parameter mem_spec : mem x s = true <-> In x s. Parameter equal_spec : equal s s' = true <-> s[=]s'. Parameter subset_spec : subset s s' = true <-> s[<=]s'. Parameter empty_spec : Empty empty. Parameter is_empty_spec : is_empty s = true <-> Empty s. Parameter add_spec : In y (add x s) <-> E.eq y x \/ In y s. Parameter remove_spec : In y (remove x s) <-> In y s /\ ~E.eq y x. Parameter singleton_spec : In y (singleton x) <-> E.eq y x. Parameter union_spec : In x (union s s') <-> In x s \/ In x s'. Parameter inter_spec : In x (inter s s') <-> In x s /\ In x s'. Parameter diff_spec : In x (diff s s') <-> In x s /\ ~In x s'. Parameter fold_spec : forall (A : Type) (i : A) (f : elt -> A -> A), fold f s i = fold_left (flip f) (elements s) i. Parameter cardinal_spec : cardinal s = length (elements s). Parameter filter_spec : compatb f -> (In x (filter f s) <-> In x s /\ f x = true). Parameter for_all_spec : compatb f -> (for_all f s = true <-> For_all (fun x => f x = true) s). Parameter exists_spec : compatb f -> (exists_ f s = true <-> Exists (fun x => f x = true) s). Parameter partition_spec1 : compatb f -> fst (partition f s) [=] filter f s. Parameter partition_spec2 : compatb f -> snd (partition f s) [=] filter (fun x => negb (f x)) s. Parameter elements_spec1 : InA E.eq x (elements s) <-> In x s.
When compared with ordered sets, here comes the only
property that is really weaker:
Parameter elements_spec2w : NoDupA E.eq (elements s). Parameter choose_spec1 : choose s = Some x -> In x s. Parameter choose_spec2 : choose s = None -> Empty s. End Spec. End WSetsOn.
Static signature for weak sets
Module Type WSets. Declare Module E : DecidableType. Include WSetsOn E. End WSets.
Functorial signature for sets on ordered elements
Module Type HasOrdOps (Import T:TypElt). Parameter compare : t -> t -> comparison.
Total ordering between sets. Can be used as the ordering function
for doing sets of sets.
Parameter min_elt : t -> option elt.
Return the smallest element of the given set
(with respect to the E.compare ordering),
or None if the set is empty.
Parameter max_elt : t -> option elt.
Same as min_elt, but returns the largest element of the
given set.
End HasOrdOps. Module Type Ops (E : OrderedType) := WOps E <+ HasOrdOps. Module Type SetsOn (E : OrderedType). Include WSetsOn E <+ HasOrdOps <+ HasLt <+ IsStrOrder. Section Spec. Variable s s': t. Variable x y : elt. Parameter compare_spec : CompSpec eq lt s s' (compare s s').
Additional specification of elements
Parameter elements_spec2 : sort E.lt (elements s).
Remark: since fold is specified via elements, this stronger
specification of elements has an indirect impact on fold,
which can now be proved to receive elements in increasing order.
Parameter min_elt_spec1 : min_elt s = Some x -> In x s. Parameter min_elt_spec2 : min_elt s = Some x -> In y s -> ~ E.lt y x. Parameter min_elt_spec3 : min_elt s = None -> Empty s. Parameter max_elt_spec1 : max_elt s = Some x -> In x s. Parameter max_elt_spec2 : max_elt s = Some x -> In y s -> ~ E.lt x y. Parameter max_elt_spec3 : max_elt s = None -> Empty s.
Additional specification of choose
Parameter choose_spec3 : choose s = Some x -> choose s' = Some y -> Equal s s' -> E.eq x y. End Spec. End SetsOn.
Static signature for sets on ordered elements
Module Type Sets. Declare Module E : OrderedType. Include SetsOn E. End Sets. Module Type S := Sets.
Some subtyping tests
WSetsOn ---> WSets | | | | V V SetsOn ---> Sets Module S_WS (M : Sets) <: WSets := M. Module Sfun_WSfun (E:OrderedType)(M : SetsOn E) <: WSetsOn E := M. Module S_Sfun (M : Sets) <: SetsOn M.E := M. Module WS_WSfun (M : WSets) <: WSetsOn M.E := M.
Signatures for set representations with ill-formed values.
- A first module deals with the datatype (eg. list or tree) without
- A second module implements the exact Sets interface by
Module Type WRawSets (E : DecidableType).
First, we ask for all the functions
Include WOps E.
Is a set well-formed or ill-formed ?
Parameter IsOk : t -> Prop. Class Ok (s:t) : Prop := ok : IsOk s.
In order to be able to validate (at least some) particular sets as
well-formed, we ask for a boolean function for (semi-)deciding
predicate Ok. If Ok isn't decidable, isok may be the
always-false function.
Parameter isok : t -> bool.
MS:
Dangerous instance, the isok s = true hypothesis cannot be discharged
with typeclass resolution. Is it really an instance?
Declare Instance isok_Ok s `(isok s = true) : Ok s | 10.
Logical predicates
Parameter In : elt -> t -> Prop. Declare Instance In_compat : Proper (E.eq==>eq==>iff) In. Definition Equal s s' := forall a : elt, In a s <-> In a s'. Definition Subset s s' := forall a : elt, In a s -> In a s'. Definition Empty s := forall a : elt, ~ In a s. Definition For_all (P : elt -> Prop) s := forall x, In x s -> P x. Definition Exists (P : elt -> Prop) s := exists x, In x s /\ P x. Notation "s [=] t" := (Equal s t) (at level 70, no associativity). Notation "s [<=] t" := (Subset s t) (at level 70, no associativity). Definition eq : t -> t -> Prop := Equal. Declare Instance eq_equiv : Equivalence eq.
First, all operations are compatible with the well-formed predicate.
Declare Instance empty_ok : Ok empty. Declare Instance add_ok s x `(Ok s) : Ok (add x s). Declare Instance remove_ok s x `(Ok s) : Ok (remove x s). Declare Instance singleton_ok x : Ok (singleton x). Declare Instance union_ok s s' `(Ok s, Ok s') : Ok (union s s'). Declare Instance inter_ok s s' `(Ok s, Ok s') : Ok (inter s s'). Declare Instance diff_ok s s' `(Ok s, Ok s') : Ok (diff s s'). Declare Instance filter_ok s f `(Ok s) : Ok (filter f s). Declare Instance partition_ok1 s f `(Ok s) : Ok (fst (partition f s)). Declare Instance partition_ok2 s f `(Ok s) : Ok (snd (partition f s)).
Now, the specifications, with constraints on the input sets.
Section Spec. Variable s s': t. Variable x y : elt. Variable f : elt -> bool. Notation compatb := (Proper (E.eq==>Logic.eq)) (only parsing). Parameter mem_spec : forall `{Ok s}, mem x s = true <-> In x s. Parameter equal_spec : forall `{Ok s, Ok s'}, equal s s' = true <-> s[=]s'. Parameter subset_spec : forall `{Ok s, Ok s'}, subset s s' = true <-> s[<=]s'. Parameter empty_spec : Empty empty. Parameter is_empty_spec : is_empty s = true <-> Empty s. Parameter add_spec : forall `{Ok s}, In y (add x s) <-> E.eq y x \/ In y s. Parameter remove_spec : forall `{Ok s}, In y (remove x s) <-> In y s /\ ~E.eq y x. Parameter singleton_spec : In y (singleton x) <-> E.eq y x. Parameter union_spec : forall `{Ok s, Ok s'}, In x (union s s') <-> In x s \/ In x s'. Parameter inter_spec : forall `{Ok s, Ok s'}, In x (inter s s') <-> In x s /\ In x s'. Parameter diff_spec : forall `{Ok s, Ok s'}, In x (diff s s') <-> In x s /\ ~In x s'. Parameter fold_spec : forall (A : Type) (i : A) (f : elt -> A -> A), fold f s i = fold_left (flip f) (elements s) i. Parameter cardinal_spec : forall `{Ok s}, cardinal s = length (elements s). Parameter filter_spec : compatb f -> (In x (filter f s) <-> In x s /\ f x = true). Parameter for_all_spec : compatb f -> (for_all f s = true <-> For_all (fun x => f x = true) s). Parameter exists_spec : compatb f -> (exists_ f s = true <-> Exists (fun x => f x = true) s). Parameter partition_spec1 : compatb f -> fst (partition f s) [=] filter f s. Parameter partition_spec2 : compatb f -> snd (partition f s) [=] filter (fun x => negb (f x)) s. Parameter elements_spec1 : InA E.eq x (elements s) <-> In x s. Parameter elements_spec2w : forall `{Ok s}, NoDupA E.eq (elements s). Parameter choose_spec1 : choose s = Some x -> In x s. Parameter choose_spec2 : choose s = None -> Empty s. End Spec. End WRawSets.
From weak raw sets to weak usual sets
Module WRaw2SetsOn (E:DecidableType)(M:WRawSets E) <: WSetsOn E.
We avoid creating induction principles for the Record
Local Unset Elimination Schemes. Definition elt := E.t. Record t_ := Mkt {this :> M.t; is_ok : M.Ok this}. Definition t := t_. Arguments Mkt this {is_ok}. Hint Resolve is_ok : typeclass_instances. Definition In (x : elt)(s : t) := M.In x (this s). Definition Equal (s s' : t) := forall a : elt, In a s <-> In a s'. Definition Subset (s s' : t) := forall a : elt, In a s -> In a s'. Definition Empty (s : t) := forall a : elt, ~ In a s. Definition For_all (P : elt -> Prop)(s : t) := forall x, In x s -> P x. Definition Exists (P : elt -> Prop)(s : t) := exists x, In x s /\ P x. Definition mem (x : elt)(s : t) := M.mem x s. Definition add (x : elt)(s : t) : t := Mkt (M.add x s). Definition remove (x : elt)(s : t) : t := Mkt (M.remove x s). Definition singleton (x : elt) : t := Mkt (M.singleton x). Definition union (s s' : t) : t := Mkt (M.union s s'). Definition inter (s s' : t) : t := Mkt (M.inter s s'). Definition diff (s s' : t) : t := Mkt (M.diff s s'). Definition equal (s s' : t) := M.equal s s'. Definition subset (s s' : t) := M.subset s s'. Definition empty : t := Mkt M.empty. Definition is_empty (s : t) := M.is_empty s. Definition elements (s : t) : list elt := M.elements s. Definition choose (s : t) : option elt := M.choose s. Definition fold (A : Type)(f : elt -> A -> A)(s : t) : A -> A := M.fold f s. Definition cardinal (s : t) := M.cardinal s. Definition filter (f : elt -> bool)(s : t) : t := Mkt (M.filter f s). Definition for_all (f : elt -> bool)(s : t) := M.for_all f s. Definition exists_ (f : elt -> bool)(s : t) := M.exists_ f s. Definition partition (f : elt -> bool)(s : t) : t * t := let p := M.partition f s in (Mkt (fst p), Mkt (snd p)).Proper (E.eq ==> eq ==> iff) InProper (E.eq ==> eq ==> iff) Inintros; apply M.In_compat; congruence. Qed. Definition eq : t -> t -> Prop := Equal.forall x y : E.t, E.eq x y -> forall x0 y0 : t, x0 = y0 -> (In x x0 -> In y y0) /\ (In y y0 -> In x x0)Equivalence eqfirstorder. Qed.Equivalence eqforall s s' : t, {eq s s'} + {~ eq s s'}forall s s' : t, {eq s s'} + {~ eq s s'}s:M.tHs:M.Ok ss':M.tHs':M.Ok s'{eq {| this := s; is_ok := Hs |} {| this := s'; is_ok := Hs' |}} + {~ eq {| this := s; is_ok := Hs |} {| this := s'; is_ok := Hs' |}}destruct (M.equal s s') eqn:H; [left|right]; rewrite <- M.equal_spec; congruence. Defined. Section Spec. Variable s s' : t. Variable x y : elt. Variable f : elt -> bool. Notation compatb := (Proper (E.eq==>Logic.eq)) (only parsing).s:M.tHs:M.Ok ss':M.tHs':M.Ok s'{M.Equal s s'} + {~ M.Equal s s'}s, s':tx, y:eltf:elt -> boolmem x s = true <-> In x sexact (@M.mem_spec _ _ _). Qed.s, s':tx, y:eltf:elt -> boolmem x s = true <-> In x ss, s':tx, y:eltf:elt -> boolequal s s' = true <-> Equal s s'exact (@M.equal_spec _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolequal s s' = true <-> Equal s s's, s':tx, y:eltf:elt -> boolsubset s s' = true <-> Subset s s'exact (@M.subset_spec _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolsubset s s' = true <-> Subset s s's, s':tx, y:eltf:elt -> boolEmpty emptyexact M.empty_spec. Qed.s, s':tx, y:eltf:elt -> boolEmpty emptys, s':tx, y:eltf:elt -> boolis_empty s = true <-> Empty sexact (@M.is_empty_spec _). Qed.s, s':tx, y:eltf:elt -> boolis_empty s = true <-> Empty ss, s':tx, y:eltf:elt -> boolIn y (add x s) <-> E.eq y x \/ In y sexact (@M.add_spec _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolIn y (add x s) <-> E.eq y x \/ In y ss, s':tx, y:eltf:elt -> boolIn y (remove x s) <-> In y s /\ ~ E.eq y xexact (@M.remove_spec _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolIn y (remove x s) <-> In y s /\ ~ E.eq y xs, s':tx, y:eltf:elt -> boolIn y (singleton x) <-> E.eq y xexact (@M.singleton_spec _ _). Qed.s, s':tx, y:eltf:elt -> boolIn y (singleton x) <-> E.eq y xs, s':tx, y:eltf:elt -> boolIn x (union s s') <-> In x s \/ In x s'exact (@M.union_spec _ _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolIn x (union s s') <-> In x s \/ In x s's, s':tx, y:eltf:elt -> boolIn x (inter s s') <-> In x s /\ In x s'exact (@M.inter_spec _ _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolIn x (inter s s') <-> In x s /\ In x s's, s':tx, y:eltf:elt -> boolIn x (diff s s') <-> In x s /\ ~ In x s'exact (@M.diff_spec _ _ _ _ _). Qed.s, s':tx, y:eltf:elt -> boolIn x (diff s s') <-> In x s /\ ~ In x s's, s':tx, y:eltf:elt -> boolforall (A : Type) (i : A) (f0 : elt -> A -> A), fold f0 s i = fold_left (fun (a : A) (e : elt) => f0 e a) (elements s) iexact (@M.fold_spec _). Qed.s, s':tx, y:eltf:elt -> boolforall (A : Type) (i : A) (f0 : elt -> A -> A), fold f0 s i = fold_left (fun (a : A) (e : elt) => f0 e a) (elements s) is, s':tx, y:eltf:elt -> boolcardinal s = length (elements s)exact (@M.cardinal_spec s _). Qed.s, s':tx, y:eltf:elt -> boolcardinal s = length (elements s)s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> In x (filter f s) <-> In x s /\ f x = trueexact (@M.filter_spec _ _ _). Qed.s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> In x (filter f s) <-> In x s /\ f x = trues, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> for_all f s = true <-> For_all (fun x0 : elt => f x0 = true) sexact (@M.for_all_spec _ _). Qed.s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> for_all f s = true <-> For_all (fun x0 : elt => f x0 = true) ss, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> exists_ f s = true <-> Exists (fun x0 : elt => f x0 = true) sexact (@M.exists_spec _ _). Qed.s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> exists_ f s = true <-> Exists (fun x0 : elt => f x0 = true) ss, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> Equal (fst (partition f s)) (filter f s)exact (@M.partition_spec1 _ _). Qed.s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> Equal (fst (partition f s)) (filter f s)s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> Equal (snd (partition f s)) (filter (fun x0 : elt => negb (f x0)) s)exact (@M.partition_spec2 _ _). Qed.s, s':tx, y:eltf:elt -> boolProper (E.eq ==> Logic.eq) f -> Equal (snd (partition f s)) (filter (fun x0 : elt => negb (f x0)) s)s, s':tx, y:eltf:elt -> boolInA E.eq x (elements s) <-> In x sexact (@M.elements_spec1 _ _). Qed.s, s':tx, y:eltf:elt -> boolInA E.eq x (elements s) <-> In x ss, s':tx, y:eltf:elt -> boolNoDupA E.eq (elements s)exact (@M.elements_spec2w _ _). Qed.s, s':tx, y:eltf:elt -> boolNoDupA E.eq (elements s)s, s':tx, y:eltf:elt -> boolchoose s = Some x -> In x sexact (@M.choose_spec1 _ _). Qed.s, s':tx, y:eltf:elt -> boolchoose s = Some x -> In x ss, s':tx, y:eltf:elt -> boolchoose s = None -> Empty sexact (@M.choose_spec2 _). Qed. End Spec. End WRaw2SetsOn. Module WRaw2Sets (D:DecidableType)(M:WRawSets D) <: WSets with Module E := D. Module E := D. Include WRaw2SetsOn D M. End WRaw2Sets.s, s':tx, y:eltf:elt -> boolchoose s = None -> Empty s
Same approach for ordered sets
Module Type RawSets (E : OrderedType). Include WRawSets E <+ HasOrdOps <+ HasLt <+ IsStrOrder. Section Spec. Variable s s': t. Variable x y : elt.
Specification of compare
Parameter compare_spec : forall `{Ok s, Ok s'}, CompSpec eq lt s s' (compare s s').
Additional specification of elements
Parameter elements_spec2 : forall `{Ok s}, sort E.lt (elements s).
Specification of min_elt
Parameter min_elt_spec1 : min_elt s = Some x -> In x s. Parameter min_elt_spec2 : forall `{Ok s}, min_elt s = Some x -> In y s -> ~ E.lt y x. Parameter min_elt_spec3 : min_elt s = None -> Empty s.
Specification of max_elt
Parameter max_elt_spec1 : max_elt s = Some x -> In x s. Parameter max_elt_spec2 : forall `{Ok s}, max_elt s = Some x -> In y s -> ~ E.lt x y. Parameter max_elt_spec3 : max_elt s = None -> Empty s.
Additional specification of choose
Parameter choose_spec3 : forall `{Ok s, Ok s'}, choose s = Some x -> choose s' = Some y -> Equal s s' -> E.eq x y. End Spec. End RawSets.
From Raw to usual sets
Module Raw2SetsOn (O:OrderedType)(M:RawSets O) <: SetsOn O. Include WRaw2SetsOn O M. Definition compare (s s':t) := M.compare s s'. Definition min_elt (s:t) : option elt := M.min_elt s. Definition max_elt (s:t) : option elt := M.max_elt s. Definition lt (s s':t) := M.lt s s'.
Specification of lt
StrictOrder ltStrictOrder ltReflexive (complement (fun s s' : t => M.lt s s'))forall x y z : t, M.lt x y -> M.lt y z -> M.lt x zReflexive (fun x y : t => M.lt x y -> False)forall x y z : t, M.lt x y -> M.lt y z -> M.lt x zforall x : t, M.lt x x -> Falseforall x y z : t, M.lt x y -> M.lt y z -> M.lt x zx:tH:M.lt x xFalseforall x y z : t, M.lt x y -> M.lt y z -> M.lt x zforall x y z : t, M.lt x y -> M.lt y z -> M.lt x ztransitivity y; auto. Qed.x, y, z:tH:M.lt x yH0:M.lt y zM.lt x zProper (eq ==> eq ==> iff) ltProper (eq ==> eq ==> iff) ltforall x y : t, eq x y -> forall x0 y0 : t, eq x0 y0 -> (lt x x0 -> lt y y0) /\ (lt y y0 -> lt x x0)forall x y : t, Equal x y -> forall x0 y0 : t, Equal x0 y0 -> (M.lt x x0 -> M.lt y y0) /\ (M.lt y y0 -> M.lt x x0)s1:M.tp1:M.Ok s1s2:M.tp2:M.Ok s2E:Equal {| this := s1; is_ok := p1 |} {| this := s2; is_ok := p2 |}s1':M.tp1':M.Ok s1's2':M.tp2':M.Ok s2'E':Equal {| this := s1'; is_ok := p1' |} {| this := s2'; is_ok := p2' |}(M.lt s1 s1' -> M.lt s2 s2') /\ (M.lt s2 s2' -> M.lt s1 s1')s1:M.tp1:M.Ok s1s2:M.tp2:M.Ok s2E:M.eq s1 s2s1':M.tp1':M.Ok s1's2':M.tp2':M.Ok s2'E':Equal {| this := s1'; is_ok := p1' |} {| this := s2'; is_ok := p2' |}(M.lt s1 s1' -> M.lt s2 s2') /\ (M.lt s2 s2' -> M.lt s1 s1')rewrite E,E'; intuition. Qed. Section Spec. Variable s s' s'' : t. Variable x y : elt.s1:M.tp1:M.Ok s1s2:M.tp2:M.Ok s2E:M.eq s1 s2s1':M.tp1':M.Ok s1's2':M.tp2':M.Ok s2'E':M.eq s1' s2'(M.lt s1 s1' -> M.lt s2 s2') /\ (M.lt s2 s2' -> M.lt s1 s1')s, s', s'':tx, y:eltCompSpec eq lt s s' (compare s s')unfold compare; destruct (@M.compare_spec s s' _ _); auto. Qed.s, s', s'':tx, y:eltCompSpec eq lt s s' (compare s s')
Additional specification of elements
s, s', s'':tx, y:eltSorted O.lt (elements s)exact (@M.elements_spec2 _ _). Qed.s, s', s'':tx, y:eltSorted O.lt (elements s)
Specification of min_elt
s, s', s'':tx, y:eltmin_elt s = Some x -> In x sexact (@M.min_elt_spec1 _ _). Qed.s, s', s'':tx, y:eltmin_elt s = Some x -> In x ss, s', s'':tx, y:eltmin_elt s = Some x -> In y s -> ~ O.lt y xexact (@M.min_elt_spec2 _ _ _ _). Qed.s, s', s'':tx, y:eltmin_elt s = Some x -> In y s -> ~ O.lt y xs, s', s'':tx, y:eltmin_elt s = None -> Empty sexact (@M.min_elt_spec3 _). Qed.s, s', s'':tx, y:eltmin_elt s = None -> Empty s
Specification of max_elt
s, s', s'':tx, y:eltmax_elt s = Some x -> In x sexact (@M.max_elt_spec1 _ _). Qed.s, s', s'':tx, y:eltmax_elt s = Some x -> In x ss, s', s'':tx, y:eltmax_elt s = Some x -> In y s -> ~ O.lt x yexact (@M.max_elt_spec2 _ _ _ _). Qed.s, s', s'':tx, y:eltmax_elt s = Some x -> In y s -> ~ O.lt x ys, s', s'':tx, y:eltmax_elt s = None -> Empty sexact (@M.max_elt_spec3 _). Qed.s, s', s'':tx, y:eltmax_elt s = None -> Empty s
Additional specification of choose
s, s', s'':tx, y:eltchoose s = Some x -> choose s' = Some y -> Equal s s' -> O.eq x yexact (@M.choose_spec3 _ _ _ _ _ _). Qed. End Spec. End Raw2SetsOn. Module Raw2Sets (O:OrderedType)(M:RawSets O) <: Sets with Module E := O. Module E := O. Include Raw2SetsOn O M. End Raw2Sets.s, s', s'':tx, y:eltchoose s = Some x -> choose s' = Some y -> Equal s s' -> O.eq x y
It is in fact possible to provide an ordering on sets with
very little information on them (more or less only the In
predicate). This generic build of ordering is in fact not
used for the moment, we rather use a simpler version
dedicated to sets-as-sorted-lists, see MakeListOrdering.
Module Type IN (O:OrderedType). Parameter Inline t : Type. Parameter Inline In : O.t -> t -> Prop. Declare Instance In_compat : Proper (O.eq==>eq==>iff) In. Definition Equal s s' := forall x, In x s <-> In x s'. Definition Empty s := forall x, ~In x s. End IN. Module MakeSetOrdering (O:OrderedType)(Import M:IN O). Module Import MO := OrderedTypeFacts O. Definition eq : t -> t -> Prop := Equal.Equivalence eqfirstorder. Qed.Equivalence eqProper (O.eq ==> eq ==> iff) InProper (O.eq ==> eq ==> iff) Inx, x':O.tEx:O.eq x x's, s':tEs:eq s s'In x s <-> In x' s'apply Es. Qed. Definition Below x s := forall y, In y s -> O.lt y x. Definition Above x s := forall y, In y s -> O.lt x y. Definition EquivBefore x s s' := forall y, O.lt y x -> (In y s <-> In y s'). Definition EmptyBetween x y s := forall z, In z s -> O.lt z y -> O.lt z x. Definition lt s s' := exists x, EquivBefore x s s' /\ ((In x s' /\ Below x s) \/ (In x s /\ exists y, In y s' /\ O.lt x y /\ EmptyBetween x y s')).x, x':O.tEx:O.eq x x's, s':tEs:eq s s'In x' s <-> In x' s'Proper (O.eq ==> eq ==> eq ==> iff) EquivBeforeProper (O.eq ==> eq ==> eq ==> iff) EquivBeforeProper (O.eq ==> eq ==> eq ==> iff) (fun (x : O.t) (s s' : t) => forall y : O.t, O.lt y x -> In y s <-> In y s')setoid_rewrite E; setoid_rewrite E1; setoid_rewrite E2; intuition. Qed.x, x':O.tE:O.eq x x's1, s1':tE1:eq s1 s1's2, s2':tE2:eq s2 s2'(forall y : O.t, O.lt y x -> In y s1 <-> In y s2) <-> (forall y : O.t, O.lt y x' -> In y s1' <-> In y s2')Proper (O.eq ==> eq ==> iff) BelowProper (O.eq ==> eq ==> iff) BelowProper (O.eq ==> eq ==> iff) (fun (x : O.t) (s : t) => forall y : O.t, In y s -> O.lt y x)setoid_rewrite Ex; setoid_rewrite Es; intuition. Qed.x, x':O.tEx:O.eq x x's, s':tEs:eq s s'(forall y : O.t, In y s -> O.lt y x) <-> (forall y : O.t, In y s' -> O.lt y x')Proper (O.eq ==> eq ==> iff) AboveProper (O.eq ==> eq ==> iff) AboveProper (O.eq ==> eq ==> iff) (fun (x : O.t) (s : t) => forall y : O.t, In y s -> O.lt x y)setoid_rewrite Ex; setoid_rewrite Es; intuition. Qed.x, x':O.tEx:O.eq x x's, s':tEs:eq s s'(forall y : O.t, In y s -> O.lt x y) <-> (forall y : O.t, In y s' -> O.lt x' y)Proper (O.eq ==> O.eq ==> eq ==> iff) EmptyBetweenProper (O.eq ==> O.eq ==> eq ==> iff) EmptyBetweenProper (O.eq ==> O.eq ==> eq ==> iff) (fun (x y : O.t) (s : t) => forall z : O.t, In z s -> O.lt z y -> O.lt z x)setoid_rewrite Ex; setoid_rewrite Ey; setoid_rewrite Es; intuition. Qed.x, x':O.tEx:O.eq x x'y, y':O.tEy:O.eq y y's, s':tEs:eq s s'(forall z : O.t, In z s -> O.lt z y -> O.lt z x) <-> (forall z : O.t, In z s' -> O.lt z y' -> O.lt z x')Proper (eq ==> eq ==> iff) ltProper (eq ==> eq ==> iff) ltProper (eq ==> eq ==> iff) (fun s s' : t => exists x : O.t, EquivBefore x s s' /\ (In x s' /\ Below x s \/ In x s /\ (exists y : O.t, In y s' /\ O.lt x y /\ EmptyBetween x y s')))setoid_rewrite E1; setoid_rewrite E2; intuition. Qed.s1, s1':tE1:eq s1 s1's2, s2':tE2:eq s2 s2'(exists x : O.t, EquivBefore x s1 s2 /\ (In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2))) <-> (exists x : O.t, EquivBefore x s1' s2' /\ (In x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')))StrictOrder ltStrictOrder lt(* irreflexive *)Irreflexive ltTransitive lts:tx:O.tIN:In x sEm:Below x sFalses:tx:O.tIN:In x sy:O.tIN':In y sLT:O.lt x yBe:EmptyBetween x y sFalseTransitive lts:tx:O.tIN:In x sy:O.tIN':In y sLT:O.lt x yBe:EmptyBetween x y sFalseTransitive lt(* transitive *)Transitive lt(* 1) Pre / Pre --> Pre *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2H:O.lt x x'EquivBefore x s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2H:O.lt x x'In x s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 2) Pre / Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 2a) x=x' --> Pre *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.eq x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'EquivBefore y s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:O.lt z yIn z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:O.lt z yINz:In z s1In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:O.lt z yINz:In z s3In z s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2z:O.tPre:O.lt z xx':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'Hz:O.lt z yINz:In z s1In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:O.lt z yINz:In z s3In z s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:O.lt z yINz:In z s3In z s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yz:O.tBe:O.lt z x'H:O.eq x x'Hz:O.lt z yINz:In z s3In z s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'In y s3 /\ Below y s1 \/ In y s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt y y0 /\ EmptyBetween y y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'Below y s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y:O.tINy:In y s3LT:O.lt x' yBe:EmptyBetween x' y s3H:O.eq x x'z:O.tHz:In z s1O.lt z ys1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 2b) x<x' --> Pre *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'EquivBefore x s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'z:O.tHz:O.lt z xIn z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 2c) x>x' --> Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xEquivBefore x' s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xz:O.tHz:O.lt z x'In z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s2Pre:Below x s1x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s1s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 3) Lex / Pre --> Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':Below x' s2lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'EquivBefore x s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'z:O.tHz:O.lt z xIn z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'In y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'EmptyBetween x y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'EmptyBetween x y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s3Pre':O.lt y x'z:O.tHz:In z s3LTz:O.lt z yIn z s2s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 4) Lex / Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3lt s1 s3(* 4a) x=x' --> impossible *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.eq x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.eq x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2Be:EmptyBetween x y s2x':O.tLT:O.lt x' yEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.eq x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3(* 4b) x<x' --> Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'lt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'EquivBefore x s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'z:O.tHz:O.lt z xIn z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'In x s3 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x x'exists y : O.t, In y s3 /\ O.lt x y /\ EmptyBetween x y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3(* 4ba *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.eq y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'Be':EmptyBetween x' y' s3H:O.lt x x'H0:O.eq y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'Be':EmptyBetween x' y' s3H:O.lt x x'H0:O.eq y x'O.lt x y's1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'Be':EmptyBetween x' y' s3H:O.lt x x'H0:O.eq y x'EmptyBetween x y' s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'Be':EmptyBetween x' y' s3H:O.lt x x'H0:O.eq y x'EmptyBetween x y' s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'Be':EmptyBetween x' y' s3H:O.lt x x'H0:O.eq y x'z:O.tHz:In z s3LTz:O.lt z y'O.lt z xs1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'z:O.tBe':O.lt z x'H:O.lt x x'H0:O.eq y x'Hz:In z s3LTz:O.lt z y'O.lt z xs1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'z:O.tBe':O.lt z x'H:O.lt x x'H0:O.eq y x'Hz:In z s2LTz:O.lt z y'O.lt z xs1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2y':O.tIny':In y' s3LT':O.lt x' y'z:O.tBe':O.lt z x'H:O.lt x x'H0:O.eq y x'Hz:In z s2LTz:O.lt z y'O.lt z ys1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3(* 4bb *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'exists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'In y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'EmptyBetween x y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'EmptyBetween x y s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'z:O.tHz:In z s3LTz:O.lt z yO.lt z xs1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt y x'z:O.tHz:In z s3LTz:O.lt z yIn z s2s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3(* 4bc*)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LT:O.lt x yBe:EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y0 : O.t, In y0 s3 /\ O.lt x' y0 /\ EmptyBetween x' y0 s3H:O.lt x x'H0:O.lt x' yH1:O.lt x' xexists y0 : O.t, In y0 s3 /\ O.lt x y0 /\ EmptyBetween x y0 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3(* 4c) x>x' --> Lex *)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xlt s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xEquivBefore x' s1 s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xz:O.tHz:O.lt z x'In z s1 <-> In z s3s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s3 /\ Below x' s1 \/ In x' s1 /\ (exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3)rewrite (EQ x'); auto. Qed.s1, s2, s3:tx:O.tEQ:EquivBefore x s1 s2IN:In x s1Lex:exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2x':O.tEQ':EquivBefore x' s2 s3IN':In x' s2Lex':exists y : O.t, In y s3 /\ O.lt x' y /\ EmptyBetween x' y s3H:O.lt x' xIn x' s1forall s s' : t, Empty s' -> ~ lt s s'forall s s' : t, Empty s' -> ~ lt s s's, s':tHs':Empty s'x:O.tIN:In x s'Falses, s':tHs':Empty s'x, y:O.tIN:In y s'Falseelim (Hs' y IN). Qed. Definition Add x s s' := forall y, In y s' <-> O.eq x y \/ In y s.s, s':tHs':Empty s'x, y:O.tIN:In y s'Falseforall (x : O.t) (s1 s2 s2' : t), Empty s1 -> Above x s2 -> Add x s2 s2' -> lt s1 s2'forall (x : O.t) (s1 s2 s2' : t), Empty s1 -> Above x s2 -> Add x s2 s2' -> lt s1 s2'x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'lt s1 s2'x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'EquivBefore x s1 s2'x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xIN:In y s1In y s2'x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xIN:In y s2'In y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xIN:In y s2'In y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xEQ:O.eq x yIn y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xIN:In y s2In y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:O.lt y xIN:In y s2In y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1y:O.tAb:O.lt x yAd:Add x s2 s2'Hy:O.lt y xIN:In y s2In y s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2' /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'In x s2'x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'Below x s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'O.eq x x \/ In x s2x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'Below x s1x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'Below x s1elim (Em y Hy). Qed.x:O.ts1, s2, s2':tEm:Empty s1Ab:Above x s2Ad:Add x s2 s2'y:O.tHy:In y s1O.lt y xforall (x1 x2 : O.t) (s1 s1' s2 s2' : t), Above x1 s1 -> Above x2 s2 -> Add x1 s1 s1' -> Add x2 s2 s2' -> O.lt x1 x2 -> lt s1' s2'forall (x1 x2 : O.t) (s1 s1' s2 s2' : t), Above x1 s1 -> Above x2 s2 -> Add x1 s1 s1' -> Add x2 s2 s2' -> O.lt x1 x2 -> lt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2lt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2EquivBefore x1 s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1In y s1' <-> In y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1O.eq x1 y \/ In y s1 <-> O.eq x2 y \/ In y s2x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1U:In y s1O.eq x2 y \/ In y s2x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1U:In y s2O.eq x1 y \/ In y s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':ty:O.tAb1:O.lt x1 yAb2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2Hy:O.lt y x1U:In y s1O.eq x2 y \/ In y s2x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1U:In y s2O.eq x1 y \/ In y s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tHy:O.lt y x1U:In y s2O.eq x1 y \/ In y s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1y:O.tAb2:O.lt x2 yAd1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2Hy:O.lt y x1U:In y s2O.eq x1 y \/ In y s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x1 s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2exists y : O.t, In y s2' /\ O.lt x1 y /\ EmptyBetween x1 y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2In x2 s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2EmptyBetween x1 x2 s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2EmptyBetween x1 x2 s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tIn y s2' -> O.lt y x2 -> O.lt y x1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tO.eq x2 y \/ In y s2 -> O.lt y x2 -> O.lt y x1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tU:O.eq x2 yO.lt y x2 -> O.lt y x1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tU:In y s2O.lt y x2 -> O.lt y x1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2y:O.tU:In y s2O.lt y x2 -> O.lt y x1order. Qed.x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1y:O.tAb2:O.lt x2 yAd1:Add x1 s1 s1'Ad2:Add x2 s2 s2'LT:O.lt x1 x2U:In y s2O.lt y x2 -> O.lt y x1forall (x1 x2 : O.t) (s1 s1' s2 s2' : t), Above x1 s1 -> Above x2 s2 -> Add x1 s1 s1' -> Add x2 s2 s2' -> O.eq x1 x2 -> lt s1 s2 -> lt s1' s2'forall (x1 x2 : O.t) (s1 s1' s2 s2' : t), Above x1 s1 -> Above x2 s2 -> Add x1 s1 s1' -> Add x2 s2 s2' -> O.eq x1 x2 -> lt s1 s2 -> lt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)lt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)O.lt x1 xx1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xlt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2O.lt x1 xx1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xlt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xlt s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xEquivBefore x s1' s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xz:O.tHz:O.lt z xIn z s1' <-> In z s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xz:O.tHz:O.lt z xO.eq x1 z \/ In z s1 <-> O.eq x2 z \/ In z s2x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xz:O.tHz:O.lt z xU:In z s1In z s2x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xz:O.tHz:O.lt z xU:In z s2In z s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xz:O.tHz:O.lt z xU:In z s2In z s1x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2Disj:In x s2 /\ Below x s1 \/ In x s1 /\ (exists y : O.t, In y s2 /\ O.lt x y /\ EmptyBetween x y s2)H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2Em:Below x s1H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y : O.t, In y s2' /\ O.lt x y /\ EmptyBetween x y s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2Em:Below x s1H:O.lt x1 xIn x s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2Em:Below x s1H:O.lt x1 xBelow x s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2Em:Below x s1H:O.lt x1 xBelow x s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s2Em:Below x s1H:O.lt x1 xz:O.tIn z s1' -> O.lt z xx1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s2' /\ Below x s1' \/ In x s1' /\ (exists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2')x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn x s1'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xexists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xexists y0 : O.t, In y0 s2' /\ O.lt x y0 /\ EmptyBetween x y0 s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xIn y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xEmptyBetween x y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xEmptyBetween x y s2'x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xz:O.tIn z s2' -> O.lt z y -> O.lt z xintros [U|U]; try specialize (Ab2 z U); auto; order. Qed. End MakeSetOrdering. Module MakeListOrdering (O:OrderedType). Module MO:=OrderedTypeFacts O. Notation t := (list O.t). Notation In := (InA O.eq). Definition eq s s' := forall x, In x s <-> In x s'. Instance eq_equiv : Equivalence eq := _. Inductive lt_list : t -> t -> Prop := | lt_nil : forall x s, lt_list nil (x :: s) | lt_cons_lt : forall x y s s', O.lt x y -> lt_list (x :: s) (y :: s') | lt_cons_eq : forall x y s s', O.eq x y -> lt_list s s' -> lt_list (x :: s) (y :: s'). Hint Constructors lt_list : core. Definition lt := lt_list. Hint Unfold lt : core.x1, x2:O.ts1, s1', s2, s2':tAb1:Above x1 s1Ab2:Above x2 s2Ad1:Add x1 s1 s1'Ad2:Add x2 s2 s2'Hx:O.eq x1 x2x:O.tEQ:EquivBefore x s1 s2IN:In x s1y:O.tINy:In y s2LTy:O.lt x yBe:EmptyBetween x y s2H:O.lt x1 xz:O.tO.eq x2 z \/ In z s2 -> O.lt z y -> O.lt z xStrictOrder ltStrictOrder lt(* irreflexive *)Irreflexive ltTransitive ltforall s s' : t, s = s' -> ~ lt s s'H:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive ltx:O.ts:tH:nil = x :: sFalsex, y:O.ts, s':tH:x :: s = y :: s'H0:O.lt x yFalsex, y:O.ts, s':tH:x :: s = y :: s'H0:O.eq x yH1:lt_list s s'IHlt_list:s = s' -> FalseFalseH:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive ltx, y:O.ts, s':tH:x :: s = y :: s'H0:O.lt x yFalsex, y:O.ts, s':tH:x :: s = y :: s'H0:O.eq x yH1:lt_list s s'IHlt_list:s = s' -> FalseFalseH:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive lty:O.ts':tH0:O.lt y yH:y :: s' = y :: s'Falsex, y:O.ts, s':tH:x :: s = y :: s'H0:O.eq x yH1:lt_list s s'IHlt_list:s = s' -> FalseFalseH:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive ltx, y:O.ts, s':tH:x :: s = y :: s'H0:O.eq x yH1:lt_list s s'IHlt_list:s = s' -> FalseFalseH:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive ltH:forall s s' : t, s = s' -> ~ lt s s'Irreflexive ltTransitive lt(* transitive *)Transitive lts, s':tH:lt s s'forall (x : O.t) (s0 s'' : t), lt (x :: s0) s'' -> lt nil s''s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.lt x y -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.lt x y -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.lt x' ylt (x :: l) (y :: s'0)s, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.eq x' yH1:lt_list l' s'0lt (x :: l) (y :: s'0)s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.lt x' yO.lt x ys, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.eq x' yH1:lt_list l' s'0lt (x :: l) (y :: s'0)s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.eq x' yH1:lt_list l' s'0lt (x :: l) (y :: s'0)s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'x, x':O.tl, l':tE:O.lt x x's'':ty:O.ts'0:tH0:O.eq x' yH1:lt_list l' s'0O.lt x ys, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'forall (x y : O.t) (s0 s'0 : t), O.eq x y -> lt_list s0 s'0 -> (forall s'' : t, lt s'0 s'' -> lt s0 s'') -> forall s'' : t, lt (y :: s'0) s'' -> lt (x :: s0) s''s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':tH3:lt (y :: s'0) s''lt (x :: s0) s''s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.lt y y0lt (x :: s0) (y0 :: s'1)s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1lt (x :: s0) (y0 :: s'1)s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.lt y y0O.lt x y0s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1lt (x :: s0) (y0 :: s'1)s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1lt (x :: s0) (y0 :: s'1)s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1O.eq x y0s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1lt_list s0 s'1unfold lt in *; auto. Qed.s, s':tH:lt s s'x, y:O.ts0, s'0:tH0:O.eq x yH1:lt_list s0 s'0H2:forall s''0 : t, lt s'0 s''0 -> lt s0 s''0s'':ty0:O.ts'1:tH4:O.eq y y0H5:lt_list s'0 s'1lt_list s0 s'1Proper (eqlistA O.eq ==> eqlistA O.eq ==> iff) ltProper (eqlistA O.eq ==> eqlistA O.eq ==> iff) ltProper (eqlistA O.eq ==> eqlistA O.eq ==> impl) lts1, s1':tE1:eqlistA O.eq s1 s1's2, s2':tE2:eqlistA O.eq s2 s2'H:lt s1 s2lt s1' s2's1, s2:tH:lt s1 s2forall s1' : t, eqlistA O.eq s1 s1' -> forall s2' : t, eqlistA O.eq s2 s2' -> lt s1' s2'x:O.ts, s1', s2':tx':O.tl':tH:O.eq x x'H0:eqlistA O.eq s l'lt nil (x' :: l')x, y:O.ts, s':tH:O.lt x ys1', s2':tx':O.tl':tH0:O.eq x x'H1:eqlistA O.eq s l'x'0:O.tl'0:tH2:O.eq y x'0H3:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.lt x ys1', s2':tx':O.tl':tH0:O.eq x x'H1:eqlistA O.eq s l'x'0:O.tl'0:tH2:O.eq y x'0H3:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.lt x ys1', s2':tx':O.tl':tH0:O.eq x x'H1:eqlistA O.eq s l'x'0:O.tl'0:tH2:O.eq y x'0H3:eqlistA O.eq s' l'0O.lt x' x'0x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt (x' :: l') (x'0 :: l'0)x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0O.eq x' x'0x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt_list l' l'0unfold lt in *; auto. Qed.x, y:O.ts, s':tH:O.eq x yH0:lt_list s s'IHlt_list:forall s1'0 : t, eqlistA O.eq s s1'0 -> forall s2'0 : t, eqlistA O.eq s' s2'0 -> lt s1'0 s2'0s1', s2':tx':O.tl':tH1:O.eq x x'H2:eqlistA O.eq s l'x'0:O.tl'0:tH3:O.eq y x'0H4:eqlistA O.eq s' l'0lt_list l' l'0forall (l1 l2 : t) (x y : O.t), O.eq x y -> eq l1 l2 -> eq (x :: l1) (y :: l2)forall (l1 l2 : t) (x y : O.t), O.eq x y -> eq l1 l2 -> eq (x :: l1) (y :: l2)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tIn z (x :: l1) <-> In z (y :: l2)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:O.eq z xIn z (y :: l2)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l1In z (y :: l2)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:O.eq z yIn z (x :: l1)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l2In z (x :: l1)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l1In z (y :: l2)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:O.eq z yIn z (x :: l1)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l2In z (x :: l1)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:O.eq z yIn z (x :: l1)l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l2In z (x :: l1)right; rewrite E12; auto. Qed. Hint Resolve eq_cons : core.l1, l2:tx, y:O.tExy:O.eq x yE12:forall x0 : O.t, In x0 l1 <-> In x0 l2z:O.tH0:In z l2In z (x :: l1)forall (c : comparison) (x1 x2 : O.t) (l1 l2 : t), O.eq x1 x2 -> CompSpec eq lt l1 l2 c -> CompSpec eq lt (x1 :: l1) (x2 :: l2) cdestruct c; simpl; inversion_clear 2; auto with relations. Qed. Hint Resolve cons_CompSpec : core. End MakeListOrdering.forall (c : comparison) (x1 x2 : O.t) (l1 l2 : t), O.eq x1 x2 -> CompSpec eq lt l1 l2 c -> CompSpec eq lt (x1 :: l1) (x2 :: l2) c