Section Compactness.
Fixpoint Tn n T : Type :=
match n with
| O => unit
| S n => (T * Tn n T)%type
end.
Fixpoint bounded_n n : Tn n R -> Tn n R -> Tn n R -> Prop :=
match n return Tn n R -> Tn n R -> Tn n R -> Prop with
| O => fun a b x : Tn O R => True
| S n => fun a b x : Tn (S n) R =>
let '(a1,a2) := a in
let '(b1,b2) := b in
let '(x1,x2) := x in
a1 <= x1 <= b1 /\ bounded_n n a2 b2 x2
end.
Fixpoint close_n n d : Tn n R -> Tn n R -> Prop :=
match n return Tn n R -> Tn n R -> Prop with
| O => fun x t : Tn O R => True
| S n => fun x t : Tn (S n) R =>
let '(x1,x2) := x in
let '(t1,t2) := t in
Rabs (x1 - t1) < d /\ close_n n d x2 t2
end.
(** * Compactness: there is a finite covering of opens *)
(** * Compactness: there is a covering based on a gauge function *)

Lemma compactness_value :
forall n a b (delta : Tn n R -> posreal),
{ d : posreal | forall x, bounded_n n a b x -> ~~ exists t, bounded_n n a b t /\ close_n n (delta t) x t /\ d <= delta t }.