Notation bin_add := bool_add_with_rem.
Fact bin_add_eq_00x x : bin_add ⟘ ⟘  x = (⟘,x).
Fact lb_succ_spec_1 l : ⟦lb_succ ⟙ l⟧ = S ⟦l⟧.
Fact lb_succ_spec a l : ⟦lb_succ a l⟧ = bool2nat a + ⟦l⟧.
Fact lb_succ_bot l : lb_succ ⟘ l ≂ l.
Fixpoint lb_plus a l m :=
match l, m with
| nil,   m   => lb_succ a m
| l,    nil  => lb_succ a l
| x::l, y::m => let (r,z) := bin_add a x y in z::lb_plus r l m
end.
Fact lb_plus_fix_0 a l : lb_plus a nil l = lb_succ a l.
Local Infix "⊕" := (lb_plus ⟘ ) (at level 41, left associativity).
Fact lb_plus_spec_0 l m : ⟦l⊕m⟧ = ⟦l⟧ + ⟦m⟧.
Fact lb_ortho_plus l m : l ⟂ m <-> l ⪯ l⊕m.
(*  Theorem lb_ortho_diophantine x y : lb_dio (fun v => v x ⟂ v y).  *)
Fact lb_ortho_plus_join x y : x ⟂ y -> x⊕y ≂ x↑y.
Fact lb_ortho_plus_id a x y : a ⟂ x -> a ⟂ y -> x ⟂ y <-> (a⊕x)↓(a⊕y) ≂ a.
(* A purely Boolean algebraic proof *)
Fact lb_minus_plus a b : a ⪯ b -> exists x, b ≂ a⊕x /\ a ⪯  a⊕x.
(* A diophantine representation of bitwise and *)

Theorem lb_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.
Fact lb_join_dio a b c : a ≂ b↑c <-> exists x, a ≂ b⊕x /\ b ⪯  b⊕x /\ x ⪯ c /\ c ⪯ a.