Fact nat_joins_binary_le_left n f m : msum nat_join 0 n f ≲ m <-> forall i, i < n -> f i ≲ m.
Fact nat_joins_binary_le_right m n f : (exists i, i < n /\ m ≲ f i) -> m ≲ msum nat_join 0 n f.
Fact nat_joins_binary_le n m f g :
(forall i, i < n -> exists j, j < m /\ f i ≲ g j)
-> msum nat_join 0 n f ≲ msum nat_join 0 m g.
Fact nat_double_joins_binary_le n m f g :
(forall i j, j < i < n -> exists k, k < m /\ f i j ≲ g k)
-> msum nat_join 0 n (fun i => msum nat_join 0 i (f i)) ≲ msum nat_join 0 m g.
Fact binary_le_join_inv m a b : m ≲ a⇡b -> m = (m⇣a)⇡(m⇣b).
Fact binary_le_joins_inv m n f : m ≲ msum nat_join 0 n f
-> { k : nat & { g : nat -> nat & { h | m = msum nat_join 0 k g
/\ k <= n
/\ (forall i, i < k -> g i <> 0 /\ g i ≲ f (h i))
/\ (forall i, i < k -> h i < n)
/\ (forall i j, i < j < k -> h i < h j) } } }.
Fact binary_le_joins_inv' m n f : m ≲ msum nat_join 0 n f
-> { g | m = msum nat_join 0 n g /\ forall i, i < n -> g i ≲ f i }.
(* This is how we compute the meet by division by powers of 2 *)

(* Specifications: *)
Lemma nat_join_mult_power2 q x y : (x*power q 2) ⇡ (y*power q 2)
= (x⇡y)*power q 2.
Lemma binary_le_mult_power2_inv m x q : m ≲ x * power q 2 -> m <> 0 -> { y | m = y * power q 2 /\ y <> 0 /\ y ≲ x }.
Lemma nat_join_euclid2 q r1 d1 r2 d2 :
r1 < power q 2
-> r2 < power q 2
-> (r1+d1*power q 2) ⇡ (r2+d2*power q 2)
= (r1⇡r2) + (d1⇡d2)*power q 2.