2.4. Quantifier Negation Laws
The De Morgan laws of Lecture 1 exchange negation with conjunction and disjunction. The laws of Table 2.4.1 exchange negation with the quantifiers.
Name | Equivalence |
|---|---|
Negation of ∃ | ¬(∃ x, P x) ≡ ∀ x, ¬P x |
Negation of ∀ | ¬(∀ x, P x) ≡ ∃ x, ¬P x |
Table 2.4.1. The quantifier negation laws.
The first law is constructive in both directions.
theorem not_exists_iff (α : Type) (P : α → Prop) :
¬(∃ x, P x) ↔ ∀ x, ¬P x := α:TypeP:α → Prop⊢ (¬∃ x, P x) ↔ ∀ (x : α), ¬P x
α:TypeP:α → Prop⊢ (¬∃ x, P x) → ∀ (x : α), ¬P xα:TypeP:α → Prop⊢ (∀ (x : α), ¬P x) → ¬∃ x, P x
α:TypeP:α → Prop⊢ (¬∃ x, P x) → ∀ (x : α), ¬P x α:TypeP:α → Proph:¬∃ x, P xa:αhPa:P a⊢ False
All goals completed! 🐙
α:TypeP:α → Prop⊢ (∀ (x : α), ¬P x) → ¬∃ x, P x α:TypeP:α → Proph:∀ (x : α), ¬P xhex:∃ x, P x⊢ False
α:TypeP:α → Proph:∀ (x : α), ¬P xa:αhPa:P a⊢ False
All goals completed! 🐙
In the second law, the direction from ∃ x, ¬P x to ¬(∀ x, P x) is constructive, and the converse direction requires classical reasoning, as the first De Morgan law did in Lecture 1. Two applications of Classical.byContradiction produce the witness.
theorem not_forall_exists (α : Type) (P : α → Prop)
(h : ¬∀ x, P x) : ∃ x, ¬P x := α:TypeP:α → Proph:¬∀ (x : α), P x⊢ ∃ x, ¬P x
α:TypeP:α → Proph:¬∀ (x : α), P x⊢ (¬∃ x, ¬P x) → False
α:TypeP:α → Proph:¬∀ (x : α), P xhne:¬∃ x, ¬P x⊢ False
α:TypeP:α → Proph:¬∀ (x : α), P xhne:¬∃ x, ¬P x⊢ ∀ (x : α), P x
α:TypeP:α → Proph:¬∀ (x : α), P xhne:¬∃ x, ¬P xa:α⊢ P a
α:TypeP:α → Proph:¬∀ (x : α), P xhne:¬∃ x, ¬P xa:α⊢ ¬P a → False
α:TypeP:α → Proph:¬∀ (x : α), P xhne:¬∃ x, ¬P xa:αhnPa:¬P a⊢ False
All goals completed! 🐙
2.4.1. Examples
The examples below apply the two negation laws and combine them with the connectives of Lecture 1. Examples 6 and 10 reason classically.
Example 1. A property that fails everywhere admits no witness. This is the constructive direction of the first law. The anonymous constructor pattern in intro introduces the existential and destructs it in one step, so no obtain is needed.
example (α : Type) (P : α → Prop)
(h : ∀ x, ¬P x) : ¬∃ x, P x := α:TypeP:α → Proph:∀ (x : α), ¬P x⊢ ¬∃ x, P x
α:TypeP:α → Proph:∀ (x : α), ¬P xa:αhPa:P a⊢ False
All goals completed! 🐙
Example 2. Conversely, if no witness exists, the property fails at each element.
example (α : Type) (P : α → Prop)
(h : ¬∃ x, P x) : ∀ x, ¬P x := α:TypeP:α → Proph:¬∃ x, P x⊢ ∀ (x : α), ¬P x
α:TypeP:α → Proph:¬∃ x, P xa:αhPa:P a⊢ False
All goals completed! 🐙
Example 3. A witness refutes the negation of the existential.
example (α : Type) (P : α → Prop)
(a : α) (hPa : P a) : ¬¬∃ x, P x := α:TypeP:α → Propa:αhPa:P a⊢ ¬¬∃ x, P x
α:TypeP:α → Propa:αhPa:P ahn:¬∃ x, P x⊢ False
All goals completed! 🐙
Example 4. A property that holds everywhere excludes any counterexample. The proof is a proof term, as in Lecture 1. Since the negated goal is a function into False, a fun that matches the counterexample's witness proves it.
example (α : Type) (P : α → Prop)
(h : ∀ x, P x) : ¬∃ x, ¬P x :=
fun ⟨a, hnPa⟩ => hnPa (h a)
Example 5. A counterexample refutes the universal statement. This is the constructive direction of the second law.
example (α : Type) (P : α → Prop)
(h : ∃ x, ¬P x) : ¬∀ x, P x := α:TypeP:α → Proph:∃ x, ¬P x⊢ ¬∀ (x : α), P x
α:TypeP:α → Proph:∃ x, ¬P xhall:∀ (x : α), P x⊢ False
α:TypeP:α → Prophall:∀ (x : α), P xa:αhnPa:¬P a⊢ False
All goals completed! 🐙
Example 6. The converse of Example 4 requires classical reasoning. Given the absence of counterexamples, Classical.byContradiction proves the property at each element.
example (α : Type) (P : α → Prop)
(h : ¬∃ x, ¬P x) : ∀ x, P x := α:TypeP:α → Proph:¬∃ x, ¬P x⊢ ∀ (x : α), P x
α:TypeP:α → Proph:¬∃ x, ¬P xa:α⊢ P a
α:TypeP:α → Proph:¬∃ x, ¬P xa:α⊢ ¬P a → False
α:TypeP:α → Proph:¬∃ x, ¬P xa:αhnPa:¬P a⊢ False
All goals completed! 🐙
Example 7. A pointwise implication transports the absence of witnesses from the conclusion to the premise. The pattern in intro again destructs the existential at introduction.
example (α : Type) (P Q : α → Prop)
(h : ∀ x, P x → Q x) (hn : ¬∃ x, Q x) : ¬∃ x, P x := α:TypeP:α → PropQ:α → Proph:∀ (x : α), P x → Q xhn:¬∃ x, Q x⊢ ¬∃ x, P x
α:TypeP:α → PropQ:α → Proph:∀ (x : α), P x → Q xhn:¬∃ x, Q xa:αhPa:P a⊢ False
All goals completed! 🐙
Example 8. When no element satisfies both properties, each element that satisfies the first fails to satisfy the second.
example (α : Type) (P Q : α → Prop)
(h : ¬∃ x, P x ∧ Q x) : ∀ x, P x → ¬Q x := α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∧ Q x⊢ ∀ (x : α), P x → ¬Q x
α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∧ Q xa:αhPa:P ahQa:Q a⊢ False
All goals completed! 🐙
Example 9. Negating an existential disjunction yields, at each element, the conjunction of the negations, which combines the first law with a De Morgan law.
example (α : Type) (P Q : α → Prop)
(h : ¬∃ x, P x ∨ Q x) : ∀ x, ¬P x ∧ ¬Q x := α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q x⊢ ∀ (x : α), ¬P x ∧ ¬Q x
α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:α⊢ ¬P a ∧ ¬Q a
α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:α⊢ ¬P aα:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:α⊢ ¬Q a
α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:α⊢ ¬P a α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:αhPa:P a⊢ False
All goals completed! 🐙
α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:α⊢ ¬Q a α:TypeP:α → PropQ:α → Proph:¬∃ x, P x ∨ Q xa:αhQa:Q a⊢ False
All goals completed! 🐙
Example 10. The theorem not_forall_exists of this section extracts a counterexample, and the pointwise implication converts it into a witness.
example (α : Type) (P Q : α → Prop) (h : ¬∀ x, P x)
(hq : ∀ x, ¬P x → Q x) : ∃ x, Q x := α:TypeP:α → PropQ:α → Proph:¬∀ (x : α), P xhq:∀ (x : α), ¬P x → Q x⊢ ∃ x, Q x
α:TypeP:α → PropQ:α → Proph:¬∀ (x : α), P xhq:∀ (x : α), ¬P x → Q xa:αhnPa:¬P a⊢ ∃ x, Q x
All goals completed! 🐙