Ex 1 Predicate over a Finite Domain lambda

Define a predicate $P(x)$: "$x$ is even" as a Python lambda over the domain $\{1, 2, \ldots, 10\}$.

Ex 2 Universal Quantifier — Finite Domain

Check whether $\forall x \in D,\; P(x)$ holds by testing every element of the domain $D = \{1, 2, 3, 4, 5\}$.

Hint: Use all(P(x) for x in domain) and next(x for x in domain if not P(x)).
Ex 3 Existential Quantifier — Finite Domain

Check whether $\exists x \in D,\; P(x)$ holds over the domain $D = \{-5, -4, \ldots, 5\}$.

Hint: Use any(P(x) for x in domain) and next(x for x in domain if P(x), None).
Ex 4 Z3: Universal Quantifier over ℝ Z3 · ForAll · prove

Use Z3 to reason about universal quantification over the real numbers.

Hint: To find a counterexample to $\forall x\; P(x)$, add $x^2\leq 0$ to the solver and check for model.
Ex 5 Z3: Existential Quantifier — Real vs Integer Z3 · Solver

Use Z3 to determine the satisfiability of $\exists x,\; x^2 = 2$ in two different domains:

What does this demonstrate about the importance of the domain in quantified statements?