(* A diophantine representation of bitwise or *)
(* End lb_nat. *)
Fixpoint lb_bots n :=
match n with
| 0   => nil
| S n => ⟘ :: lb_bots n
end.
Definition lb_shift n l := lb_bots n ++ l.
Fact lb_shift_0 l : lb_shift 0 l = l.
Fact lb_shift_meet n l m : lb_shift n (l↓m) = (lb_shift n l)↓(lb_shift n m).
Fact lb_shift_join n l m : lb_shift n (l↑m) = (lb_shift n l)↑(lb_shift n m).
Fact lb_shift_ortho n l m : length l <= n -> l ⟂ lb_shift n m.
Fact lb_shift_ortho_meet n l m : length l <= n -> l ↓ lb_shift n m ≂ nil.
Fact nat_pow2_lb_shift n q : ⟬q*power n 2⟭ ≂ lb_shift n ⟬q⟭ .
Fact nat_euclid_pow2_lb n r q : r < power n 2 -> ⟬r+q*power n 2⟭ ≂ ⟬r⟭ ↑lb_shift n ⟬q⟭ .
Definition nat_meet n m := ⟦ ⟬n⟭↓⟬m⟭ ⟧.
Local Infix "⇣" := nat_meet (at level 40, left associativity).
Fact nat_meet_comm n m : n⇣m = m⇣n.
Fact nat_meet_left n m : n⇣m ≲ n.
Fact nat_meet_right n m : n⇣m ≲ m.
Hint Resolve nat_meet_left nat_meet_right.
Fact binary_le_nat_meet n m : n ≲ m <-> n⇣m = n.

Theorem nat_meet_dio a b c : a = b⇣c <-> exists x y,  b = a+x
/\ c = a+y
/\ a ≲ a+x
/\ a ≲ a+y
/\ x ≲ x+y.