\documentclass[t]{beamer}
\mode<presentation>

\newcommand{\lecnumber}{7}

\include{cocmacros}
\newcommand{\uuline}[1]{\underline{\underline{#1}}}
\newcommand{\ures}[3]{
  \begin{array}{c@{\hspace*{2em}}c} 
    #1 & #2 \\ \hline \multicolumn{2}{c}{#3} 
  \end{array}}
\newcommand{\uex}{\underline{Example}}
\newcommand{\un}{\underline{Note}}

\title{\lecnumber. Quantified Linear Arithmetic}
\date{}
\institute[Stanford University]

\begin{document}

\setbeamertemplate{footline}[text line]
{
	%\begin{large}
	\hspace*{\stretch{1}}\lecnumber - \insertframenumber \bigskip
	%\end{large}
}

\begin{frame}[c]
\Large
\textsc{The Calculus of Computation:}\\
Decision Procedures with\\
Applications to Verification

\bigskip
\bigskip
by\\
Aaron Bradley\\
Zohar Manna

\bigskip
\bigskip
Springer 2007
\end{frame}

\begin{frame}[c]
	\bigskip
	\bigskip
	\bigskip
	\bigskip
	\center{\Large Part II: Algorithm Reasoning}\\
	\titlepage
\end{frame}

\begin{frame}
\underline{Quantifier Elimination} (QE) --- algorithm for elminiation of all
quantifiers of formula $F$ until quantifier-free formula $G$ that is equivalent
to $F$ remains\\
\smallskip
\un: Could be enough $F$ is \underline{equisatisfiable} to $F'$, that is
$F$ is satisfiable iff $F'$ is satisfiable

\bigskip
A theory $T$ \underline{admits quantifier elimination} if there is an algorithm that
given $\Sigma$-formula returns a quantifier-free $\Sigma$-formula $G$ that is
$T$-equivalent
\end{frame}

\begin{frame}
\uex\\
\smallskip
For $\srat$-formula\\
\smallskip
 \qquad $F:\ \exists x.\ 2x=y$,\\
quantifier-free $\trat$-equivalent $\srat$-formula is\\
\smallskip
 \qquad $G:\ \true$

\bigskip
For $\sint$-formula\\
\smallskip
 \qquad $F:\ \exists x.\ 2x=y$,\\
there is no quantifier-free $\tint$-equivalent $\sint$-formula.

\bigskip
Let $T_{\widehat{\integers}}$ be $\tint$ with divisibility predicates.\\
For $\Sigma_{\widehat{\integers}}$-formula\\
\smallskip
 \qquad $F:\ \exists x.\ 2x=y$,\\
a quantifier-free $T_{\widehat{\integers}}$-equivalent $\Sigma_{\widehat{\integers}}$-formula is\\
\smallskip
 \qquad $G:\ 2\ |\ y$.
\end{frame}

\begin{frame}
In developing a QE algorithm for theory $T$,
we need only consider formulae of the form\\
\smallskip
\qquad $\exists x.\ F$\\
for quantifier-free $F$

\bigskip
\uex: For $\Sigma$-formula
\[
\renewcommand{\arraystretch}{1.3}
\begin{array}{c@{:\ }l}
G_1 & \exists x.\ \forall y.\ \underbrace{\exists z.\ F_1[x,y,z]}_{F_2[x,y]}\\
G_2 & \exists x.\ \forall y.\ F_2[x,y]\\
G_3 & \exists x.\ \neg \underbrace{\exists y.\ \neg F_2[x,y]}_{F_3[x]}\\
G_4 & \underbrace{\exists x.\ \neg F_3[x]}_{F_4}\\
G_5 & F_4
\end{array}
\]
$G_5$ is quantifier-free and $T$-equivalent to $G_1$
\end{frame}

\begin{frame}
\frametitle{Quantifier Elimination for $\tint$}
$\Sigma_\integers:\ \set{\ldots, -2, -1, 0,\ 1,\ 2,\ \ldots, -3 \cdot, -2 \cdot
, 2 \cdot,\ 3 \cdot,\ \ldots,\ +,\ -,\ =,\ <}$

\bigskip
\underline{Lemma}:\\
\smallskip
Given quantifier-free $\sint$-formula $F$ s.t. $\freev(F) = \set{y}$.\\
$F$ represents the set of integers\\
\smallskip
\qquad $S:\ \set{n \in \integers\ :\ F\set{y \Mapsto n}\ \mbox{is $\tint$-valid}}~.$\\
\smallskip
Either $S \cap \integers^+$ or $\integers^+ \setminus S$ is finite.\\
where $\integers^+$ is the set of positive integers

\bigskip
\uex: $\sint$-formula \quad $F:\ \exists x.\ 2x=y$\\
\smallskip
\qquad $S$: even integers

\smallskip
$S \cap \integers^+$: positive even integers --- infinite\\
$\integers^+ \setminus S$: positive odd integers --- infinite

\smallskip
Therefore, by the lemma, there is no quantifier-free $\tint$-formula
that is $\tint$-equivalent to $F$.

\smallskip
Thus, $\tint$ does not admit QE.
\end{frame}

\begin{frame}
\underline{Augmented theory $\tinta$}

\bigskip
$\sinta$:\ $\sint$ with countable number of unary \underline{divisibility predicates}\\
\smallskip
\qquad $k\ |\ \cdot \quad \mbox{for $k \in \integers^+$}$\\
\smallskip
Intended interpretations:\\
\smallskip
\qquad $k\ |\ x$ holds iff $k$ divides $x$ without any remainder

\bigskip
\uex:\\
\smallskip
\qquad $x > 1 \band y > 1 \band 2\ |\ x + y$\\
\smallskip
is satisfiable (choose $x=2, y=2$).\\
\smallskip
\qquad $\neg(2\ |\ x) \band 4\ |\ x$\\
\smallskip
is not satisfiable.

\bigskip
\underline{Axioms of $\tinta$}: axioms of $\tint$ with additional countable set of axioms
\[
\forall x.\ k\ |\ x \biff \exists y.\ x = k y \quad \mbox{for $k \in \integers^+$}
\]
\end{frame}

\begin{frame}
\underline{$\tinta$ admits QE (Cooper's method)}\\
\smallskip
\underline{Algorithm}: Given $\sinta$-formula $\exists x.\ F[x]$, where $F$ is quantifier-free\\
Construct quantifier-free $\sinta$-formula that is equivalent to $\exists x.\ F[x]$.

\bigskip
\underline{Step 1}\\
\smallskip
Put $F[x]$ in NNF $F_1[x]$, that is,\\
$\exists x.\ F_1[x]$ has negations only in literals (only $\sband$, $\sbor$)\\
\qquad \qquad \ and $\tinta$-equivalent to $\exists x.\ F[x]$

\bigskip
\underline{Step 2}\\
\smallskip
Replace (left to right)
\[
\begin{array}{r@{\quad\Leftrightarrow\quad}l}
s = t        & s < t + 1 \band t < s + 1 \\
\neg (s = t) & s < t\ \vee\ t < s \\
\neg (s < t) & t < s + 1
\end{array}
\]
The output $\exists x.\ F_2[x]$ contains only literals of form
\[
s < t~, \quad k\ |\ t~, \quad\mbox{or}\quad \bnot (k\ |\ t)~,
\]
where $s$, $t$ are $\tinta$-terms and $k \in \integers^+$.

\end{frame}

\begin{frame}
\uex:\\
\qquad $\begin{array}{c}
\neg (x < y) \band \neg (x = y + 3)\\
\Downarrow\\
y < x+1 \band (x<y+3 \bor y+3<x)
\end{array}$

\bigskip
\underline{Step 3}

\smallskip
Collect terms containing $x$ so that literals have the form
\[
hx < t~, \quad t < hx~, \quad k\ |\ hx + t~, \quad\mbox{or}\quad
\neg (k\ |\ hx + t)~,
\]
where $t$ is a term and $h, k \in \integers^+$.  The output is the
formula $\exists x.\ F_3[x]$, which is $\tinta$-equivalent to $\exists x.\ F[x]$.

\smallskip
\uex:\\
\qquad $\begin{array}{c}
x+x+y<z+3z+2y-4x\\
\Downarrow\\
6x < 4z+y
\end{array}$
\end{frame}

\begin{frame}
\underline{Step 4}

\smallskip
Let
\[
\delta' = \mathsf{lcm}\set{h\ :\ h \mbox{ is a coefficient of $x$ in $F_3[x]$}}~,
\]
where $\mathsf{lcm}$ is the least common multiple.  Multiply atoms in
$F_3[x]$ by constants so that $\delta'$ is the coefficient of $x$
everywhere:
\[
\begin{array}{r@{\quad\Leftrightarrow\quad}l@{\quad\quad\mbox{where}\quad}l}
hx < t & \delta' x < h' t & h' h = \delta' \\

t < hx & h' t < \delta' x & h' h = \delta' \\

k\ |\ hx + t & h'k\ |\ \delta'x + h't & h'h = \delta' \\

\neg(k\ |\ hx + t) & \neg(h'k\ |\ \delta'x + h't) & h'h = \delta'
\end{array}
\]

The result $\exists x.\ F_3'[x]$, in which all occurrences of $x$ in $F_3'[x]$ are in terms $\delta' x$.

\bigskip
Replace $\delta' x$ terms in $F_3'$ with a fresh variable $x'$ to form\\
\smallskip
\qquad $F_3''\ :\ F_3 \set{\delta' x \mapsto x'}$
\end{frame}

\begin{frame}
Finally, construct\\
\smallskip
\qquad $\exists x'.\ \underbrace{F_3''[x'] \band \delta'\ |\ x'}_{F_4[x']}$

\bigskip
$\exists x'.F_4[x']$ is equivalent to $\exists x.\ F[x]$ and
each literal of $F_4[x']$ has one of the forms:
\begin{description}
\item [(A)] $x' < a$
\item [(B)] $b < x'$
\item [(C)] $h\ |\ x' + c$
\item [(D)] $\neg (k\ |\ x' + d)$
\end{description}
where $a, b, c, d$ are terms that do not contain $x$,
and $h, k \in \integers^+$.
\end{frame}

\begin{frame}
\uex: $\tinta$-formula\\
\smallskip
\qquad $\exists x.\ \underbrace{3x+1>y \band 2x-6<z \band 4\ |\ 5x+1}_{F[x]}$\\
\smallskip
after step 3\\
\smallskip
\qquad $\exists x.\ \underbrace{2x<z+6 \band y-1<3x \band 4\ |\ 5x+1}_{F_3[x]}$\\
\smallskip
Collecting coefficients of $x$ (step 4),\\
\smallskip
\qquad $\delta' = \mathsf{lcm}(2,3,5) = 30$\\
\smallskip
Multiply when necessary\\
\smallskip
\qquad $\exists x.\ 30x < 15z+90 \band 10y-10<30x \band 24\ |\ 30x+6$\\
\smallskip
Replacing $30x$ with fresh $x'$\\
\smallskip
\qquad $\exists x'.\ \underbrace{x'<15z+90 \,\,\sband\,\, 10y-10<x' \,\,\sband\,\, 24\ |\ x'+6 \,\,\sband\,\, 30\ |\ x'}_{F_4[x']}$\\
\smallskip
$\exists x'.\ F_4[x']$ is equivalent to $\exists x.\ F[x]$
\end{frame}

\begin{frame}
\underline{Step 5} (trickiest part):\\
\smallskip
Construct\\
\smallskip
\qquad left infinite projection $F_{-\infty}[x']$\\
\smallskip
of $F_4[x']$ by
\begin{itemize}
\item[(A)] replacing literals $x'<a$ by $\true$
\item[(B)] replacing literals $b<x'$ by $\false$
\end{itemize}
\underline{idea}: very small numbers satisfy (A) literals but not (B) literals

\bigskip
Let
\[
\delta = \mathsf{lcm}
\left\{\begin{array}{l}
\mbox{$h$ of (C) literals $h\ |\ x' + c$} \\
\mbox{$k$ of (D) literals $\neg(k\ |\ x' + d)$}
\end{array}\right\}
\]
and $B$ be the set of $b$ terms appearing in (B) literals.
Construct
\[
F_5:\
\bigvee_{j=1}^\delta \Fninf[j]
\bor
\bigvee_{j=1}^\delta\bigvee_{b \in B} F_4[b+j]~.
\]
$F_5$ is quantifier-free and $\tinta$-equivalent to $F$.
\end{frame}

\begin{frame}
\uuline{Intuition}\\
\smallskip
\underline{Property (Periodicity)}\\
\smallskip
\qquad if $k\ |\ \delta$\\
\qquad then $k\ |\ n$ iff $k\ |\ n+\lambda\delta$ for all $\lambda \in \integers$

\smallskip
That is, $k\ | \cdot$ cannot distinguish between $k\ |\ n$ and $k\ |\ n+\lambda\delta$.

\bigskip
By the choice of $\delta$ ($\mathsf{lcm}$ of the $h$'s and $k$'s) ---
no $|$ literal in $F_5$ can distinguish between $n$ and $n + \delta$.

\[
F_5:\
\bigvee_{j=1}^\delta \Fninf[j]
\bor
\bigvee_{j=1}^\delta\bigvee_{b \in B} F_4[b+j]
\]
\underline{left disjunct} $\bigvee_{j=1}^\delta \Fninf[j]$\ :\\
\begin{itemize}
\item[] Contains only $|$ literals
\item[] Asserts: \underline{no least $n \in \integers$ s.t. $F[n]$}.\\
\smallskip
For if there exists $n$ satisfying $F_{-\infty}$,\\
then every $n-\lambda\delta$, for $\lambda \in \integers^+$, also satisfies $F_{-\infty}$
\end{itemize}
\end{frame}

\begin{frame}
\underline{right disjunct} $\bigvee_{j=1}^\delta\bigvee_{b \in B} F_4[b+j]$\ :\\
\begin{itemize}
\item[] Asserts: \underline{There is least $n \in \integers$ s.t. $F[n]$}.\\
\smallskip
For let $b^*$ be the largest $b$ in (B).\\
If $n \in \integers$ is s.t. $F[n]$,\\
then\\
\qquad $\exists j (1 \le j \le \delta).\ b^* + j \le n \band F[b^* + j]$

\item[] In other words,\\
\quad if there is a solution,\\
\quad then one must appear in $\delta$ interval to the right of $b^*$
\end{itemize}

\underline{Example (cont)}:
\[
\begin{array}{c}
\exists x.\ \underbrace{3x+1>y \band 2x-6<z \band 4\ |\ 5x+1}_{F[x]}\\
\Downarrow\\
\exists x'.\ \underbrace{x'<15z+90 \,\,\sband\,\, 10y-10<x' \,\,\sband\,\, 24\ |\ x'+6 \,\,\sband\,\, 30\ |\ x'}_{F_4[x']}
\end{array}
\]
\end{frame}

\begin{frame}
By step 5,
\[
\Fninf[x]:\ \true \band \false \band 24\ |\ x' + 6 \band 30\ |\ x'~,
\]
which simplifies to $\false$.  Compute
\[
\delta = \mathsf{lcm}\set{24,30} = 120
\mbox{\quad and \quad}
B = \set{10y-10}~.
\]
Then replacing $x'$ by $10y-10+j$ in $F_4[x']$ produces
\[
F_5:\ \bigvee_{j=1}^{120}
\left[\begin{array}{l}
10y-10+j < 15z+90 \band 10y-10 < 10y-10+j \\
\mbox{} \band 24\ |\ 10y-10+j+6 \band 30\ |\ 10y-10+j
\end{array}\right]
\]
which simplifies to
\[
F_5:\ \bigvee_{j=1}^{120}
\left[\begin{array}{l}
10y+j < 15z+100 \band 0 < j \\
\mbox{} \band 24\ |\ 10y+j -4 \band 30\ |\ 10y-10+j
\end{array}\right]~.
\]
$F_5$ is quantifier-free and $\tinta$-equivalent to $F$.

\end{frame}

\begin{frame}
\uex:
\[
\underbrace{\exists x.\ (3x+1 < 10 \bor 7x-6 > 7) \band 2\ |\ x}_{F[x]}
\]
Isolate $x$ terms
\[
\exists x.\ (3x < 9 \bor 13 < 7x) \band 2\ |\ x~,
\]
so
\[
\delta' = \mathsf{lcm}\set{3,7} = 21~.
\]
After multiplying coefficients by proper constants,
\[
\exists x.\ (21x < 63 \bor 39 < 21x) \band 42\ |\ 21x~,
\]
we replace $21x$ by $x'$:
\[
\exists x'.\ \underbrace{(x' < 63 \bor 39 < x') \band 42\ |\ x' \band 21\ |\ x'}_{F_4[x']}~.
\]
\end{frame}

\begin{frame}
Then
\[
\Fninf[x']:\ (\true \bor \false) \band 42\ |\ x' \band 21\ |\ x'~,
\]
or, simplifying,
\[
\Fninf[x']:\ 42\ |\ x' \band 21\ |\ x'~.
\]
Finally,
\[
\delta = \mathsf{lcm}\set{21, 42} = 42
\mbox{\quad and \quad}
B = \set{39}~,
\]
so
\[
F_5:
\begin{array}{l}
{\displaystyle \bigvee_{j=1}^{42} (42\ |\ j \band 21\ |\ j)\ \bor \mbox{}}
\\ \hspace{1em}
{\displaystyle
\bigvee_{j=1}^{42}
  ((39+j < 63 \bor 39 < 39+j) \band 42\ |\ 39+j \band 21\ |\ 39+j)}~.
  \end{array}
  \]
  Since $42\ |\ 42$ and $21\ |\ 42$, the left main disjunct simplifies
  to $\true$, so that $F$ is $\tinta$-equivalent to $\true$.  Thus,
  $F$ is $\tinta$-valid.
\end{frame}

\begin{frame}
\uex:
\[
\exists x.\ \underbrace{2x = y}_{F[x]}
\]
Rewriting
\[
\exists x.\ \underbrace{y-1 < 2x \band 2x < y + 1}_{F_3[x]}
\]
Then
\[
\delta' = \mathsf{lcm}\set{2,2} = 2~,
\]
so by Step 4
\[
\exists x'.\ \underbrace{y-1 < x' \band x' < y + 1 \band 2\ |\ x'}_{F_4[x']}
\]
$\Fninf$ produces $\false$.
\end{frame}

\begin{frame}
However,
\[
\delta = \mathsf{lcm}\set{2} = 2
\mbox{\quad and \quad}
B = \set{y-1}~,
\]
so
\[
F_5:\ \bigvee_{j=1}^2 (y-1 < y-1+j \band y-1+j < y + 1 \band 2\ |\ y-1+j)
\]
Simplifying,
\[
F_5:\ \bigvee_{j=1}^2 (0 < j \band j < 2 \band 2\ |\ y-1+j)
\]
and then
\[
F_5:\ 2\ |\ y~,
\]
which is quantifier-free and $\tinta$-equivalent to $F$.
\end{frame}

\begin{frame}
\uuline{Two Improvements:}\\
\smallskip
\underline{A. Symmetric Elimination}\\
\smallskip
In step 5, if there are fewer\\
\qquad (A) literals $x' < a$\\
than\\
\qquad (B) literals $b < x'$.

\bigskip
Construct the \underline{right infinite projection} $F_{+\infty}[x']$ from $F_4[x']$ by replacing\\
\smallskip
\qquad each (A) literal $x' < a$ by $\false$\\
and\\
\qquad each (B) literal $b < x'$ by $\true$.

\bigskip
Then \underline{right elimination}.
\[
F_5:\
\bigvee_{j=1}^\delta \Fpinf[-j]
\bor
\bigvee_{j=1}^\delta\bigvee_{a \in A} F_4[a-j]~.
\]
\end{frame}

\begin{frame}
\underline{B. Eliminating Blocks of Quantifiers}
\[\exists x_1.\ \cdots \exists x_n.\ F[x_1,\ldots,x_n]\] 
where $F$ quantifier-free.\\
Eliminating $x_n$ (left elimination) produces

\qquad $\begin{array}{ll}
G_1:& \displaystyle \exists x_1.\ \cdots \exists x_{n-1}.\ \bigvee_{j=1}^\delta \Fninf[x_1,\ldots,x_{n-1},j] \bor\\
& \displaystyle \bigvee_{j=1}^\delta\bigvee_{b \in B} F_4[x_1,\ldots,x_{n-1},b+j]
\end{array}$

which is equivalent to

\qquad $
\begin{array}{ll}
G_2:&
\displaystyle \bigvee_{j=1}^\delta \exists x_1.\ \cdots \exists x_{n-1}.\ \Fninf[x_1,\ldots,x_{n-1},j]
\bor\\
&\displaystyle \bigvee_{j=1}^\delta\bigvee_{b \in B} \exists x_1.\ \cdots \exists x_{n-1}.\ F_4[x_1,\ldots,x_{n-1},b+j]
\end{array}$

Treat $j$ as a free variable and examine only $1 + |B|$ formulae
\begin{itemize}
\item $\exists x_1.\ \cdots \exists x_{n-1}.\ \Fninf[x_1,\ldots,x_{n-1},j]$
\item $\exists x_1.\ \cdots \exists x_{n-1}.\ F_4[x_1,\ldots,x_{n-1},b+j]$ for each $b \in B$
\end{itemize}
\end{frame}

\begin{frame}
\uex:
\[
F:\
\exists y.\ \exists x.\ x < -2 \band 1 - 5y < x \band 1 + y < 13x
\]
Since $\delta' = \mathsf{lcm}\set{1,13} = 13$
\[
\exists y.\ \exists x.\ 13x < -26 \band 13 - 65y < 13x \band 1 + y < 13x
\]
Then
\[
\exists y.\ \exists x'.\ x' < -26 \band 13 - 65y < x' \band 1 + y < x' \band 13\ |\ x'
\]
There is one (A) literal $x'<\ldots$ and two (B) literals $\ldots<x'$, we use right elimination.\\
\quad $F_{+\infty}=\false$ \qquad $\delta = \set{13} = 13$ \qquad $A = \set{-26}$
\[
\exists y.\
\bigvee_{j=1}^{13}
\left[\begin{array}{l}
-26 - j < -26 \band 13 - 65y < -26 - j \\
\mbox{} \band 1 + y < -26 - j \band 13\ |\ -26 - j
\end{array}\right]
\]
Commute
\[
G:\ \bigvee_{j=1}^{13}
\exists y.\ j > 0 \band 39 + j < 65y \band y < -27 - j \band 13\ |\ -26 - j
\]
\end{frame}

\begin{frame}
Apply QE (treating $j$ as free variable)
\[
H:\ \exists y.\ j > 0 \band 39 + j < 65y \band y < -27 - j \band 13\ |\ -26 - j
\]
Simplify
\[
H':\ \bigvee_{k=1}^{65}
(k < -1794 - 66j \band 13\ |\ -26 - j \band 65\ |\ 39 + j + k)
\]
Replace $H$ with $H'$ in $G$
\[
\bigvee_{j=1}^{13}
\bigvee_{k=1}^{65}
(k < -1794 - 66j \band 13\ |\ -26 - j \band 65\ |\ 39 + j + k)
\]
This formula is $\tinta$-equivalent to $F$.
\end{frame}

\begin{frame}
\frametitle{Quantifier Elimination over Rationals}
\hspace{\stretch{1}}$\Sigma_\rat:\ \set{0,\ 1,\ +,\ -,\ =,\ \ge}$\hspace{\stretch{1}} 

\smallskip
we use $>$ instead of $\ge$, as\\
\smallskip
\hspace{\stretch{1}}$x \ge y \Bequiv x > y \bor x = y
\qquad
x > y \Bequiv x \ge y \band \bnot (x = y)$~.\hspace{\stretch{1}}

\bigskip
\underline{Ferrante and Rackoff's Method}

Given a $\srat$-formula $\exists x.\ F[x]$, where $F[x]$ is quantifier-free\\
Generate quantifier-free formula $F_4$ (four steps) s.t.\\
\qquad $F_4$ is $\srat$-equivalent to $\exists x.\ F[x]$.

\bigskip
\underline{Step 1}: Put $F[x]$ in NNF.  The result is $\exists x.\ F_1[x]$.

\bigskip
\underline{Step 2}: Replace literals (left to right)
\[
\begin{array}{r@{\quad\Leftrightarrow\quad}l}
\neg (s < t) & t < s\ \vee\ t = s \\
\neg (s = t) & t < s\ \vee\ t > s
\end{array}
\]
The result $\exists x.\ F_2[x]$ does not contain negations.

\end{frame}

\begin{frame}
\underline{Step 3}: Solve for $x$ in each atom of $F_2[x]$, e.g.,
\[
t < c x~ \qquad \Bimplies \qquad \frac{t}{c} < x
\]
where $c \in \integers - \set{0}$.

\bigskip
All atoms in the result $\exists x.\ F_3[x]$ have form
\begin{description}
\item [(A)] $x < a$
\item [(B)] $b < x$
\item [(C)] $x = c$
\end{description}
where $a$, $b$, $c$ are terms that do not contain $x$.

\end{frame}

\begin{frame}
\underline{Step 4}: Construct from $F_3[x]$\\
\bigskip
\begin{itemize}
\item \underline{left infinite projection} $\Fninf$ by replacing\\
\smallskip
(A) atoms $x < a$ by $\true$\\
\smallskip
(B) atoms $b < x$ by $\false$\\
\smallskip
(C) atoms $x = c$ by $\false$\\
\bigskip
\item \underline{right infinite projection} $\Fpinf$ by replacing\\
\smallskip
(A) atoms $x < a$ by $\false$\\
\smallskip
(B) atoms $b < x$ by $\true$\\
\smallskip
(C) atoms $x = c$ by $\false$\\
\end{itemize}
\end{frame}

\begin{frame}
Let $S$ be the set of $a$, $b$, $c$ terms from (A), (B), (C) atoms.\\
Construct the final
\[
F_4:\ \Fninf \bor \Fpinf \bor \bigvee_{s,t \in S} F_3\left[\frac{s+t}{2}\right]~,
\]
which is $\trat$-equivalent to $\exists x.\ F[x]$.

\begin{itemize}
\item $\Fninf$ captures the case when small $n \in \rationals$
satisfy $F_3[n]$
\item $\Fpinf$ captures the case when large $n \in \rationals$
satisfy $F_3[n]$
\item last disjunct: for $s,t \in S$\\
if $s \equiv t$, check whether $s \in S$ satisfies $F_4[s]$\\
if $s \not\equiv t$, $\frac{s+t}{2}$ represents the whole interval $(s,t)$, so check $F_4[\frac{s+t}{2}]$
\end{itemize}
\end{frame}

\begin{frame}
\underline{Intuition}

Step 4 says that four cases are possible:
\begin{enumerate}
\item There is a left open interval s.t. all elements satisfy $F(x)$.
\[
\begin{array}{cc}
\hline
\longleftarrow\hspace{-.5ex}) & \hspace{5em}
\end{array}
\]
\item There is a right open interval s.t. all elements satisfy $F(x)$.
\[
\begin{array}{cc}
\hline
\hspace{5em} & (\hspace{-.5ex}\longrightarrow
\end{array}
\]
\item Some $a_i$, $b_i$, or $c_i$ satisfies $F(x)$.~
\[
\begin{array}{ccccc}
\hline
\cdots & b_2 & c_1 & a_2 & \cdots
\end{array}
\]
\item There is an open interval between two $a_i$, $b_i$, or $c_i$
terms s.t. every element satisfies $F(x)$.
\[
\begin{array}{ccc@{}c@{}cc}
&& \multicolumn{3}{c}{(\longleftrightarrow)} \\
\hline
\cdots & b_2 & b_1 & \uparrow & a_2 & \cdots \\
&&& \frac{b_1 + a_2}{2}
\end{array}
\]
\end{enumerate}
\end{frame}

\begin{frame}
\uex: $\srat$-formula
\[
\exists x.\ \underbrace{3x + 1 < 10 \band 7x - 6 > 7}_{F[x]}
\]
Solving for $x$
\[
\exists x.\ \underbrace{x < 3 \band x > \frac{13}{7}}_{F_3[x]}
\]
\begin{tabular}{ll}
Step 4: & $x < 3$ in (A) $\quad \Bimplies \quad \Fninf = \false$\\
& $x > \frac{13}{7}$ in (B) $\quad \Bimplies \quad \Fpinf = \false$\\
\end{tabular}
\[
F_4:\ \bigvee_{s,t \in S} \underbrace{\left(\frac{s+t}{2} < 3 \band \frac{s+t}{2} > \frac{13}{7}\right)}_{F_3[\frac{s+t}{2}]}
\]
\end{frame}

\begin{frame}
$S = \set{3,\frac{13}{7}} \quad \Bimplies$
\[
F_3\left[\frac{3 + 3}{2}\right] = \false \qquad F_3\left[\frac{\frac{13}{7} + \frac{13}{7}}{2}\right] = \false
\]
\[
F_3\left[\frac{\frac{13}{7} + 3}{2}\right]:\
\frac{\frac{13}{7} + 3}{2} < 3 \band \frac{\frac{13}{7} + 3}{2} > \frac{13}{7}
\]
simplifies to $\true$.  

\bigskip
Thus, $F_4: \true$ is $\trat$-equivalent to
$\exists x.\ F[x]$,\\ so $\exists x.\ F[x]$ is $\trat$-valid.
\end{frame}


\end{document}
