Boolean quantifiers #
This proves a few properties about List.all and List.any, which are the Bool universal and
existential quantifiers. Their definitions are in core Lean.
theorem
List.all_iff_forall_prop
{α : Type u_1}
{p : α → Prop}
[DecidablePred p]
{l : List α}
:
(l.all fun (a : α) => decide (p a)) = true ↔ ∀ a ∈ l, p a
theorem
List.any_iff_exists_prop
{α : Type u_1}
{p : α → Prop}
[DecidablePred p]
{l : List α}
:
(l.any fun (a : α) => decide (p a)) = true ↔ ∃ a ∈ l, p a
theorem
List.any_of_mem
{α : Type u_1}
{l : List α}
{a : α}
{p : α → Bool}
(h₁ : a ∈ l)
(h₂ : p a = true)
:
l.any p = true