Section nat_meet_power2_neq.
Let nat_meet_power2_lt x y : x < y -> (power x 2) ⇣ (power y 2) = 0.
Fact nat_meet_power2_neq x y : x <> y -> (power x 2) ⇣ (power y 2) = 0.
End nat_meet_power2_neq.
Fact nat_meet_12n n : 1⇣(2*n) = 0.
Fact nat_meet_12 : 1⇣2 = 0.
Fact power_2_minus_1_gt n x : x < power n 2 <-> x ≲ power n 2 - 1.
Definition nat_join n m := ⟦ ⟬n⟭↑⟬m⟭ ⟧.
Local Infix "⇡" := nat_join (at level 50, left associativity).
Fact nat_join_comm n m : n⇡m = m⇡n.
Fact nat_join_left n m : n ≲ n⇡m.
Fact nat_join_right n m : m ≲ n⇡m.
Hint Resolve nat_join_left nat_join_right : core.
Fact nat_join_0n n : 0⇡n = n.
Fact nat_join_n0 n : n⇡0 = n.
Fact nat_join_mono a b u v : a ≲ b -> u ≲ v -> a⇡u ≲ b⇡v.
Fact nat_join_assoc n m k : n⇡(m⇡k) = n⇡m⇡k.
Fact nat_join_meet_distr_l n m k : n⇡(m⇣k) = (n⇡m)⇣(n⇡k).
Fact nat_meet_join_distr_l n m k : n⇣(m⇡k) = (n⇣m)⇡(n⇣k).
Hint Resolve nat_join_0n nat_join_n0 nat_join_assoc : core.
Fact nat_join_binary_le n m k : n⇡m ≲ k <-> n ≲ k /\ m ≲ k.
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 *)

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 }.