# Math Demo

Temml renders `$…$` and `$$…$$` to native MathML. The samples below are the
notation the discrete-math labs use.

## Logic connectives

A proposition is a statement that is definitely true or false — a `bool`. We
name them $p$ and $q$ and combine them with four connectives:

| Logic                 | Means   | In code         |
| --------------------- | ------- | --------------- |
| $\neg p$              | NOT     | `!p`            |
| $p \land q$           | AND     | `p && q`        |
| $p \lor q$            | OR      | `p \|\| q`      |
| $p \Rightarrow q$     | IMPLIES | _(no operator)_ |
| $p \Leftrightarrow q$ | IFF     | `p === q`       |

## Quantifiers

$$
\forall x \in S,\; P(x)
\qquad
\exists x \in S,\; P(x)
$$

Read $\forall$ as `.every()` and $\exists$ as `.some()`. The usual domains are
$\mathbb{N}$, $\mathbb{Z}$, and $\mathbb{R}$.

## Sets

The even integers, written with set-builder braces that markdown must not eat:

$\{\, n \in \mathbb{Z} \mid n \bmod 2 = 0 \,\}$

## Negation

$$
\neg\,\forall x\, P(x) \;\equiv\; \exists x\, \neg P(x)
$$

A short derivation:

$$
\begin{aligned}
\neg(p \land q) &\equiv \neg p \lor \neg q \\
\neg(p \lor q) &\equiv \neg p \land \neg q
\end{aligned}
$$

## Calculus (sanity check)

$$
\int_0^\infty \frac{x^2}{e^x}\, dx
$$

## Edge cases

TeX source in inline code stays literal: `\forall`, `\exists`, `\in`.

A fenced example must not be rendered as math:

```tex
\forall x \in S,\; P(x)
$5 is not math either
```

Currency prose is not math: tickets cost $5 and $10.
