Section BETWEEN. (* Reference: "https://github.com/DmxLarchey/Murec_Extraction/blob/murec_artifact/theories/between.v" *)
Variable P : nat -> Prop.
Definition wBetween (n : nat) (m : nat) : Prop :=
forall i, n <= i -> i < m -> P i.
Definition Between (n : nat) (m : nat) : Prop :=
n <= m /\ wBetween n m.
End BETWEEN.
Inductive Dumin (n : nat) : Prop :=
| Dumin_stop : T n -> P n -> Dumin n
| Dumin_next : T n -> Dumin (S n) -> Dumin n.
#[local] Arguments Dumin_stop {_}.
#[local] Arguments Dumin_next {_}.
Definition Dumin_pi1 {n} (d : Dumin n) : T n :=
match d with
| Dumin_stop t _ => t
| Dumin_next t _ => t
end.
Definition Dumin_pi2 {n} (d : Dumin n) : Q n -> Dumin (S n) :=
match d with
| Dumin_stop t p  => fun q => False_ind _ (PQ_absurd n p q)
| Dumin_next _ d' => fun _ => d'
end.
Definition Pre_umin (s : nat) (n : nat) : Prop :=
n \in E.intersection (E.intersection T P) (Between T s).
Definition Post_umin (s : nat) (n : nat) : Prop :=
n \in E.intersection (E.intersection T P) (Between (E.intersection T Q) s).

Lemma Pre_umin_Dumin {s : nat}
(EXISTENCE : exists n, Pre_umin s n)
: Dumin s.