Lean4
/-- O(log n). Does the set (approximately) contain the element `x`? That is,
is there an element that is equivalent to `x` in the order?
1 ∈ {1, 2, 3} = true
4 ∈ {1, 2, 3} = false
Using a preorder on `ℕ × ℕ` that only compares the first coordinate:
(1, 1) ∈ {(0, 1), (1, 2)} = true
(3, 1) ∈ {(0, 1), (1, 2)} = false -/
def mem (x : α) : Ordnode α → Bool
| nil => false
| node _ l y r =>
match cmpLE x y with
| Ordering.lt => mem x l
| Ordering.eq => true
| Ordering.gt => mem x r