(* If u,v is an enumeration of R, this sequence of open intervals
   tears the segment [0,1]. The recursive definition needs the proof that the
   previous interval is ordered, hence the type.

   The first sequence is increasing, the second decreasing.
   The first is below the second.
   Therefore the first sequence has a limit, a least upper bound b, that u cannot reach,
   which contradicts u (v b) = b. *)
Definition tearing_sequences (u : nat -> R) (v : R -> nat)
  : (enumeration R u v) -> nat -> { ab : prod R R | Rlt (fst ab) (snd ab) }.

(* Specifications: *)
Lemma tearing_sequences_projsig (u : nat -> R) (v : R -> nat) (en : enumeration R u v) (n : nat) : let (I,pr) := tearing_sequences u v en n in proj1_sig (tearing_sequences u v en (S n)) = first_two_in_interval u v (fst I) (snd I) en pr.
Lemma tearing_sequences_inc_dec (u : nat -> R) (v : R -> nat) (pen : enumeration R u v) : forall n : nat, let I := proj1_sig (tearing_sequences u v pen n) in let SI := proj1_sig (tearing_sequences u v pen (S n)) in Rlt (fst I) (fst SI) /\ Rlt (snd SI) (snd I).
Lemma split_lt_succ : forall n m : nat, lt n (S m) -> lt n m \/ n = m.
Lemma increase_seq_transit (u : nat -> R) : (forall n : nat, Rlt (u n) (u (S n))) -> (forall n m : nat, n < m -> Rlt (u n) (u m)).
Lemma decrease_seq_transit (u : nat -> R) : (forall n : nat, Rlt (u (S n)) (u n)) -> (forall n m : nat, n < m -> Rlt (u m) (u n)).
Lemma tearing_sequences_ordered_forall (u : nat -> R) (v : R -> nat) (pen : enumeration R u v) : forall n m : nat, let In := proj1_sig (tearing_sequences u v pen n) in let Im := proj1_sig (tearing_sequences u v pen m) in Rlt (fst In) (snd Im).