% This is a TeX file
% It is essentially a programming language for mathematics documents
% You can ignore this first portion of the file, as it is essentially a bunch of "include" statements.
\documentclass[10pt]{article}

\usepackage{pictex, latexsym, graphicx,amsmath,amssymb,amsbsy,amsfonts,amsthm,verbatim}
\usepackage{graphics}
\usepackage[colorlinks=true,urlcolor=blue]{hyperref}
\usepackage{fullpage}
\usepackage{fancyhdr}
\usepackage{array}

\usepackage{algorithm,algorithmic}
\usepackage{multirow}

\setlength{\parskip}{0.5em}
\setlength{\parindent}{0em}
\setlength{\voffset}{-0.5in}
\setlength{\headsep}{0.25in}

% The following denotes a counter for the problems.
\newcounter{problem}
\newcommand{\problem}{\textbf{Problem \refstepcounter{problem}.}}

% These are macro shortcuts! Helpful!
\def\vu{\mathbf{u}}
\def\vx{\mathbf{x}}
\def\vy{\mathbf{y}}
\def\vb{\mathbf{b}}
\def\vv{\mathbf{v}}
\def\vw{\mathbf{w}}

\renewcommand{\implies}{\rightarrow}
%\newcommand{\lnot}{\neg}
\renewcommand{\lor}{\vee}
\renewcommand{\land}{\wedge}
\newcommand{\xor}{\oplus}
\renewcommand{\iff}{\leftrightarrow}
\newcommand{\TRUE}{\mathbf{T}}
\newcommand{\FALSE}{\mathbf{F}}
\newcommand{\universe}{\mathcal{U}}


\begin{document}
\pagestyle{fancyplain}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% NOW you can start typing your text that will appear in the PDF!!!

% Note that anything after a '%' is a comment!

% Anything immediately after a '\' is a command. 
% Some denote formatting, some are for special characters.
% The '$' symbol starts and ends "math mode". Use this only for mathematical statements
% In math mode, any sequence of letters is meant to be a list of variables, so use "\sin x" for the sine of x, which will look much different from "sin x"

\lhead{}
\rhead{}
\chead{COM S 330 --- Lecture Notes --- Week of Jan 12--16}

\renewcommand{\arraystretch}{1.25}

\section{Monday, January 12}

\textbf{Announcements:} Course Syllabus, Homework 01 Due Jan 15.

\textbf{Reading:} Rosen: 1.1, 1.2, 1.3. LLM: 1.1--1.2, 3.1--3.4

\subsection{Rosen 1.1 --- Propositional Logic}

\textbf{Def:} A \emph{proposition} is a declarative sentence (a sentence that declares a fact) that is either true or false, never both.

\textbf{Ex:} ``Ames is a city in Iowa.''   ``Today is Monday.''  ``$2 \times 3 = 6$.'' ``$2 \times 2 = 5$.''

\textbf{Non-Ex:} ``How are you doing?'' ``Go outside, for once!'' ``$3x = 6$.'' ``$x+y=z$.''

Use letters (such as $x, y, z, p, q, r, s, \dots$) to denote \emph{propositional variables}, which symbolize some proposition (and whether or not it is true).

The \emph{truth value} is either \emph{true} ($\TRUE$) or \emph{false} ($\FALSE$).

\textbf{Def:} The \emph{propositional calculus} or \emph{propositional logic} is a way to combine propositions to create other propositions.

\textbf{Def:} If $p$ is a proposition, then the \emph{negation} of $p$, denoted $\lnot p$ or $\overline p$, is the statement
\begin{center}``It is not the case that $p$.''\end{center}

\textbf{Def:} A \emph{truth table} expresses the truth value of a compound proposition given every possible combination of truth values for its propositional variables.


\begin{center}
\begin{tabular}[h]{|c|c|}
\hline
$p$ & $\lnot p$\\
\hline
$\TRUE$ & $\FALSE$ \\
\hline
$\FALSE$ & $\TRUE$\\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|c|c|}
\hline
$p$ & $q$ & $p \land q$\\
\hline
$\TRUE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\TRUE$ & $\FALSE$ & $\FALSE$ \\
\hline
$\FALSE$ & $\TRUE$ & $\FALSE$ \\
\hline
$\FALSE$ & $\FALSE$ & $\FALSE$ \\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|c|c|}
\hline
$p$ & $q$ & $p \lor q$\\
\hline
$\TRUE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\TRUE$ & $\FALSE$ & $\TRUE$ \\
\hline
$\FALSE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\FALSE$ & $\FALSE$ & $\FALSE$ \\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|c|c|}
\hline
$p$ & $q$ & $p \xor q$\\
\hline
$\TRUE$ & $\TRUE$ & $\FALSE$ \\
\hline
$\TRUE$ & $\FALSE$ & $\TRUE$ \\
\hline
$\FALSE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\FALSE$ & $\FALSE$ & $\FALSE$ \\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|c|c|}
\hline
$p$ & $q$ & $p \implies q$\\
\hline
$\TRUE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\TRUE$ & $\FALSE$ & $\FALSE$ \\
\hline
$\FALSE$ & $\TRUE$ & $\TRUE$ \\
\hline
$\FALSE$ & $\FALSE$ & $\TRUE$ \\
\hline
\end{tabular}

\textbf{Table:} Truth tables for $\lnot p$, $p \land q$, $p \lor q$, $p \xor q$, and $p \implies q$.
\end{center}

\textbf{Def:} Let $p$ and $q$ be propositions. 
The \emph{conjunction} of $p$ and $q$, denoted $p \land q$ and said ``$p$ and $q$,'' is true exactly when $p$ and $q$ are both true.
The \emph{disjunction} of $p$ and $q$, denoted $p \lor q$ and said ``$p$ or $q$,'' is true exactly when at least one of $p$ or $q$ is true.

\textbf{Note:} If you say ``Will you have the soup or the salad?'' in English, you are typically saying you can have \emph{exactly one} of the soup or the salad.
However, in the disjunction $p \lor q$, it is still true if BOTH $p$ and $q$ are true. This is called \emph{inclusive or}.
When you want to specify the statement ``exactly one of $p$ and $q$ is true,'' then you want the \emph{exclusive or}, denoted $p \xor q$.

\textbf{Def:} Let $p$ and $q$ be propositions. The \emph{conditional statement} $p \implies q$ is the proposition ``if $p$, then $q$.''
This proposition is true only when $q$ is true whenever $p$ is true.
There are many ways to describe this relationship (see Rosen, p. 6 for a list).

A conditional statement is sometimes called an \emph{implication}.

\begin{center}``If your final weighted score is above 90\%, then you will receive an A in this course.''\end{center}

The idea of ``$p \implies q$'' is that $p$ is a condition, and only when that condition is true can you say something for sure about $q$!
If $p$ is false, then the conditional statement ``$p \implies q$'' is \emph{vacuously true}.

\begin{center}``If pigs have wings, then pigs can fly.''

``If I am a hat, then I am the president.''
\end{center}

\textbf{Note:} Do not confuse the ``if $p$ then $q$'' phrasing too much with the if/then constructions in programming (but they are related!).

Given a conditional statement ``$p \implies q$'' there are a few ways to modify it (that are worth remembering):
\begin{enumerate}
\item \emph{converse} : ``$q \implies p$'' (sometimes written ``$p \leftarrow q$'').
\item \emph{contrapositive} : ``$\lnot q \implies \lnot p$
\item \emph{inverse} : ``$\lnot p \implies \lnot q$
\end{enumerate}

See the following truth table to see that these do not always agree with the conditional statement.

\begin{center}

\begin{tabular}[h]{|c|c|c|c|c|c|c|}
\hline
&&Conditional&Converse & Contrapositive & Inverse & Biconditional\\
$p$ & $q$ & $p \implies q$ & $q \implies p$ & $\lnot q \implies \lnot p$ & $\lnot p \implies \lnot q$ & $p \iff q$ \\
\hline
$\TRUE$ & $\TRUE$ & $\TRUE$ & $\TRUE$ & $\TRUE$ & $\TRUE$  & $\TRUE$ \\
\hline
$\TRUE$ & $\FALSE$ & $\FALSE$  & $\TRUE$  & $\FALSE$  & $\TRUE$& $\FALSE$\\
\hline
$\FALSE$ & $\TRUE$ & $\TRUE$  & $\FALSE$  & $\TRUE$  & $\FALSE$& $\FALSE$\\
\hline
$\FALSE$ & $\FALSE$ & $\TRUE$  & $\TRUE$  & $\TRUE$  & $\TRUE$  & $\TRUE$\\
\hline
\end{tabular}

\textbf{Table:} Truth table for variations on conditional statements. Observe that these conditionals each false in exactly one situation: where $p$ and $q$ differ (and which of these two cases is different in some situations).
\end{center}



\textbf{Def:} Let $p$ and $q$ be propositions. The \emph{biconditional} statement $p \iff q$ is the proposition ``$p$ if and only if $q$'' and is true when $p$ and $q$ have the same truth value.





\subsubsection{Recommended Homework}

Rosen 1.1: 1--5, 8--15, 22--28.





\clearpage
\section{Wednesday, January 14}

\textbf{Announcement:} Homework 01 due Thursday, Jan 15th.

\textbf{Correction/Reminder:} AND ($\land$) is a \emph{conjunction}, OR ($\lor$) is a \emph{disjunction}. Write out truth tables of all symbols.

Now that we are armed with our basic operators, we can make more complicated propositions, called \emph{compound propositions}. We can blindly construct these, and their truth value depends on the truth values of its constituent propositions. (We use parentheses to nest these operations, so you know which inner propositions are grouped.)

\textbf{Example:} Construct the truth table for the compound proposition $(p\implies q) \land (\lnot p \implies \lnot q)$.

\textbf{Example:} Construct the truth table for the compound proposition $(p\implies q) \lor ( \lnot q \implies p)$.

\textbf{Example:} Construct the truth table for the compound proposition $(\lnot p\land q) \lor ( p \land \lnot q )$.

\textbf{Note:} When you construct a truth table with $n$ propositional variables, you will have $2^n = \underbrace{2 \times 2 \times \cdots \times 2}_{n\text{ times}}$ rows. This is because there are two options for each of the $n$ variables, and these choices are made ``independently.'' See \href{https://www.youtube.com/watch?v=_uTpEXn-lBg}{this video on constructing truth tables}, specifically how to generate all combinations of truth values.

\textbf{Precedence of Logical Operators:} Just as $-$ (negation), $+$ and $-$ (addition and subtraction), $*$ (multiplication), and $/$ (division) have different orders of importance when considering a complicated algebraic phrase, so too do logical operators. The orders can be confusing, so we will use parentheses as often as possible to prevent this being an issue.

Order of precedence: $\lnot$, $\land$, $\lor$, $\implies$, $\iff$.

\textbf{Logic and Binary Representation:} One last thing: In a computer, we use 0 and 1 as a ``bit''.  This is the most basic computing element. We can treat 1 as $\TRUE$ and 0 as $\FALSE$ and find an equivalence in terms.
But more importantly, if we perform bit-wise operations on a string of bits, then we are determining the compound proposition for each combination of bits.

\textbf{Example:}
\[
\begin{array}{r@{\ }c@{}c@{}c@{}c@{}c@{}c}
\vx = & 1 & 0 & 1 & 1 & 0 & 1 \\
\vy = & 0 & 1 & 1 & 0 & 0 & 1 \\
\hline
\vx \land \vy = &0 & 0 & 1 & 0 & 0 & 1 \\
\vx \lor \vy =   &1 & 1 & 1 & 1 & 0 & 1 \\
\vx \xor \vy = & 1 & 1 & 0 & 1 & 0 & 0
\end{array}
\]

\subsubsection{Recommended Homework}

Roesn 1.1: 31--39, 43--44.

\subsection{Rosen 1.2 --- Applications of Propositional Logic} 

\textbf{Application 1:} Translating English Sentences. (Important for lawyers in particular!)

\textbf{Application 2:} Systems Specifications. (Don't forget about testing!)

\textbf{Application 3:} Logic Puzzles.

\url{http://www.logic-puzzles.org/init.php}


The Knights and Knaves (see \url{http://en.wikipedia.org/wiki/Knights_and_Knaves}) problem is about two types of people: Knights always say the truth, and Knaves always lie.
Based on your interaction, you need to determine if they are a Knight or a Knave and also possibly some other information.

\begin{quote}
You come to a fork in the road. The two ways are guarded by two people. There is a sign saying ``Exactly one of these guards is a Knight, and the other is a Knave. Exactly one path leads to your goal, the other leads to certain death.''

``Would you answer ``Yes'' if I asked you ``Does your path lead to freedom?''''

``Would the other one answer ``Yes'' if I asked them ``Does your path lead to freedom?''''
\end{quote}

\textbf{The Boxes} from \url{http://www.folj.com/puzzles/}
\begin{quote}
There are three boxes. One is labeled "APPLES" another is labeled "ORANGES". The last one is labeled "APPLES AND ORANGES". You know that each is labeled incorrectly. You may ask me to pick one fruit from one box which you choose.

How can you label the boxes correctly?\end{quote}

\textbf{Example:} See book for ``Muddy Children Puzzle''


\textbf{Application 4:} Paradoxes.

Liar Paradox: Suppose a Knight or a Knave says ``I always lie.'' Is the person a Knight or a Knave?

\textbf{Alt 1:} ``This sentence is false.''

\textbf{Alt 2:} ``The next sentence is false.'' ``The previous sentence is true.''



\textbf{Application 5:} Logical Circuits.

Using NOT, OR, and AND gates, we can construct circuits to compute compound propositions.

Can we make our circuits more efficient? Fewer gates? Smaller depth? We should not modify the behavior while we do this! This means we must develop  methods to \emph{demonstrate equivalence between logical statements}.


\subsubsection{Recommended Homework}

Rosen 1.2: 1--5, 7--12, 15--18, 19--23, 24--31, 40--43.

Explore \url{http://en.wikipedia.org/wiki/Category:Logic_puzzles}






\clearpage
\section{Friday, January 16}
\subsection{Rosen 1.3 --- Propositional Equivalences}

\textbf{Question:} Given two complex propositional statements, can you tell if they always evaluate to the same value?

Alternative viewpoint: Given two logic circuits, do they always output the same value?

One method: Exhaustively list the truth table. Very difficult in general!

\textbf{Def:} A compound proposition that is always true (no matter what truth values of the propositional variables) is a \emph{tautology}.

\textbf{Examples:} $b \lor \lnot b$. $(p \land \lnot p) \implies (q \land \lnot q)$.

\textbf{Def:} A compound proposition that is always false (no matter what truth values of the propositional variables) is a \emph{contradiction}.

\textbf{Examples:} $b \land \lnot b$.  $(p \lor q) \iff (\lnot p \land \lnot q)$.

\textbf{Def:} A proposition that is neither a tautology or a contradiction is a \emph{contingency}.

\textbf{Def:} The compound propositions $p$ and $q$ are called \emph{logically equivalent} if $p \iff q$ is a tautology. The notation $p \equiv q$ denotes that $p$ and $q$ are logically equivalent.

\begin{center}
\begin{tabular}[h]{|c|}
\hline
DeMorgan's Laws\\
\hline
$\lnot (p \land q) \equiv \lnot p \lor \lnot q$\\
$\lnot (p \lor q) \equiv \lnot p \land \lnot q$\\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|}
\hline
Extended DeMorgan's Laws\\
\hline
$\lnot (p_1 \land p_2 \land \dots \land p_n ) \equiv \lnot p_1 \lor \lnot p_2 \lor \dots \lor \lnot p_n$\\
$\lnot (p_1 \lor p_2 \lor \dots \lor p_n ) \equiv \lnot p_1 \land \lnot p_2 \land \dots \land \lnot p_n$\\
\hline
\end{tabular}
\quad
\begin{tabular}[h]{|c|}
\hline
Extended DeMorgan's Laws (Concise)\\
\hline
$\lnot \bigwedge_{i=1}^n p_i \equiv \bigvee_{i=1}^n (\lnot p_i)$\\
$\lnot \bigvee_{i=1}^n p_i \equiv \bigwedge_{i=1}^n (\lnot p_i)$\\
\hline
\end{tabular}
\end{center}

We will use the notation 
\[
	\bigvee_{i=1}^n p_i \text{ to denote }p_1 \lor p_2 \lor \dots \lor p_n,
\]
and 
\[
	\bigwedge_{i=1}^n p_i\text{ to denote }p_1 \land p_2 \land \dots \land p_n,
\]
the same way we use
\[
	\sum_{i=1}^n x_i\text{ to denote }x_1 + x_2 + \cdots + x_n.
\]

For more logical equivalences, see the Logic Cheatsheet!

\textbf{Constructing New Logical Equivalences}

We can create logical equivalences by brute-force using the truth table, but that becomes very hard and boring. Let's instead use a very limited form of \emph{proof!}

Essentially, we use our list of logical equivalences to translate from one statement to the other!

\textbf{Example:} Demonstrate the equivalence $(p \implies r) \lor (q \implies r) \equiv (p \land q) \implies r$.

\begin{tabular}[h]{rll}
$(p \implies r) \lor (q \implies r)$ & $\equiv (\lnot p \lor r) \lor (q \implies r)$ & Logical equivalence of conditional statement\\
& $\equiv (\lnot p \lor r) \lor (\lnot q \lor r)$ & Logical equivalence of Conditional statement\\
& $\equiv (\lnot p \lor \lnot q) \lor (r \lor r)$ & Commutative law\\
& $\equiv (\lnot p \lor \lnot q) \lor r$ & Idempotent law\\
& $\equiv \lnot (p \land q) \lor r$  & DeMorgan's law\\
& $\equiv (p \land q) \implies r$ & Logical equivalence of conditional statement
\end{tabular}

Let $p$ be a compound proposition. We could demonstrate that $p$ is a tautology by demonstrating the equivalence $p \equiv \TRUE$.
We could demonstrate that $p$ is a contradiction by demonstrating the equivalence $p \equiv \FALSE$.


\textbf{Example:} Demonstrate that $(a \lor b)\land (\lnot a\lor c) \implies (b \lor c)$ is a tautology.

\begin{tabular}[h]{rll}
$(a \lor b)\land (\lnot a\lor c) \implies (b \lor c)$ & $\equiv \lnot\left[(a \lor b)\land (\lnot a\lor c)\right] \lor (b \lor c)$ & Logical equivalence of conditional statement\\
& $\equiv \lnot(a \lor b) \lor \lnot(\lnot a\lor c) \lor (b \lor c)$ & DeMorgan's Law\\
& $\equiv (\lnot a \land \lnot b) \lor \lnot(\lnot a\lor c) \lor (b \lor c)$ & DeMorgan's Law\\
& $\equiv (\lnot a \land \lnot  b) \lor (\lnot(\lnot a) \land \lnot c) \lor (b \lor c)$ & DeMorgan's Law\\
& $\equiv (\lnot a \land \lnot  b) \lor ( a \land \lnot c) \lor (b \lor c)$ & Double Negation Law\\
& $\equiv (\lnot a \land \lnot  b) \lor b \lor ( a \land \lnot c) \lor c$ & Commutative Law\\
& $\equiv \left[(\lnot a \lor b) \land ( \lnot b \lor b)\right] \lor ( a \land \lnot c) \lor c$ & Distributive Law\\
& $\equiv \left[(\lnot a \lor b) \land ( \lnot b \lor b)\right] \lor \left[( a \lor c ) \land ( \lnot c \lor c )\right]$ & Distributive Law\\
& $\equiv \left[(\lnot a \lor b) \land \TRUE \right] \lor \left[( a \lor c ) \land ( \lnot c \lor c )\right]$ & Negation Law\\
& $\equiv \left[(\lnot a \lor b) \land \TRUE \right] \lor \left[( a \lor c ) \land \TRUE \right]$ & Negation Law\\
& $\equiv (\lnot a \lor b) \lor \left[( a \lor c ) \land \TRUE \right]$ & Identity Law\\
& $\equiv (\lnot a \lor b) \lor ( a \lor c )$ & Identity Law\\
& $\equiv (\lnot a \lor a) \lor ( b \lor c )$ & Commutative Law\\
& $\equiv \TRUE \lor ( b \lor c )$ & Negation Law\\
& $\equiv \TRUE$ & Domination Law
\end{tabular}


\textbf{Propositional Satisfiability}

Given a compound proposition, we can demonstrate it is NOT a contradiction by simply giving one example assignment of truth values to the propositional variables such that the compound proposition is true.

\textbf{Def:} A compound proposition is \emph{satisfiable} if there is an assignment of truth values to its variables that makes it true; such an assignment is a \emph{solution}.
Otherwise, the proposition is \emph{unsatisfiable} (which means it is a contradiction!).

\textbf{Example:} Determine if the compound proposition $(p \lor q) \land (\lnot p \lor \lnot q)$ is satisfiable. [Hint: the first clause says that one of $p$ and $q$ is true, while the second says that one is false.]

\textbf{Example:} Determine if the compound proposition $(p \lor q) \land (\lnot p \lor \lnot q) \land (\lnot p \lor q)$ is satisfiable.

\textbf{Example:} Determine if the compound proposition $(p \lor q) \land (\lnot p \lor \lnot q) \land (\lnot p \lor q) \land ( p \lor  \lnot q)$ is satisfiable.

{\small
\begin{tabular}[h]{rlp{1.5in}}
$(p \lor q) \land (\lnot p \lor \lnot q) \land (\lnot p \lor q) \land ( p \lor  \lnot q)$ & $\equiv (p \lor q) \land (\lnot p \lor \lnot q) \land (p \implies q) \land ( q \implies p)$ & Logical equivalence of conditional statement\\
& $\equiv (p \lor q) \land (\lnot p \lor \lnot q) \land (p\iff q)$ & Logical equivalence using biconditional statement\\
& $\equiv (\lnot p \implies q) \land (q \implies \lnot p) \land (p\iff q)$ & Logical equivalence of conditional statement\\
& $\equiv (\lnot p \iff q) \land (p\iff q)$ &Logical equivalence using biconditional statement\\
& $\equiv \lnot(p \iff q) \land (p\iff q)$ &Logical equivalence using biconditional statement\\
& $\equiv \lnot r \land r$ & \textit{Substitution $r = p \iff q$}\\
& $\equiv \FALSE$ & Negation law
\end{tabular}
}


\textbf{Applications}

Book has Sudoku. Let's talk about KenKen. But first: Latin Squares!

\textbf{Def:} Let $n$ be a positive integer. 
An $n \times n$ \emph{latin square} is an $n \times n$ table where every row and column contains the numbers $1, \dots, n$ exactly once.

We can create a proposition that is true if we have a latin square. 
We first need to create propositional variables.

Let $p(i,j,k)$ be true if the $i,j$ position has value $k$.

For $i, j$, the compound proposition
\[
	\bigwedge_{k=1}^n \left[p(i,j,k)\implies \lnot p(i,j,k')\right] 
\]
guarantees that at most one number is placed in the $i,j$ position.
For integers $i$ and $k$, the compound proposition
\[
	\bigvee_{j=1}^n p(i,j,k) 
\]
guarantees that the number $k$ appears somewhere in the $i$th row.
Similarly,
\[
	\bigvee_{i=1}^n p(i,j,k)
\]
guarantees that the number $k$ appears somewhere in the $j$th column.
To take the conjunction of all of these statements, we find a compound proposition that is true if and only if the values $p(i,j,k)$ correspond to a latin square.
\[
	\bigwedge_{i=1}^n \bigwedge_{j=1}^n \bigwedge_{k=1}^n \bigwedge_{k' \neq k} \left[p(i,j,k)\implies \lnot p(i,j,k')\right] \land
	\bigwedge_{i=1}^n \bigwedge_{k=1}^n \bigvee_{j=1}^n p(i,j,k) \land
	\bigwedge_{j=1}^n \bigwedge_{k=1}^n \bigvee_{i=1}^n p(i,j,k). 
\]
\textbf{Exercise:} Determine why we do not need to add propositions for the following properties:\\
1. The $i,j$ position contains at least one number.\\
2. The $i$th row contains the number $k$ at most once.\\
3. The $j$th column contains the number $k$ at most once.

\emph{KenKen} is a puzzle that starts with a partially-complete latin square [that is, some of the propositional variables $p(i,j,k)$ are set to $\TRUE$; e.g. $p(2,1,5)$ is part of our conjunction].
But also, other constraints are added!
Specifically, some contiguous blocks of the square are grouped together and an algebraic operation ($+$, $-$, $\times$, or $/$) is specified along with the desired output when applying that operation to those numbers.
These can be specified using our logic, although in a more complicated way!

\textbf{Example:} Suppose that in a $7 \times 7$ KenKen, the pair of positions $(3,4)$ and $(4,4)$ have the constraint ``$\times 21$'' Then, we explore the possible values that can multiply to find 21.
These are exactly $3 \times 7$ and $7 \times 3$.
So, we add to our list of constraints the disjunction:
\[
\left[
	\left[ p(3,4,3) \land p(3,4,7)\right] \lor \left[ p(3,4,7) \land p(3,4,3)\right]
\right]
\]

\textbf{Example:} Suppose that in a $7 \times 7$ KenKen, the pair of positions $(3,4)$ and $(4,4)$ have the constraint ``$/ 2$'' Then, we explore the possible values that can divide to form $2$.
These are $2 / 1$, $4 / 2$ and $6 / 3$.
So, we add to our list of constraints the disjunction:

\scalebox{0.8}{
$
\left[	\left[ p(3,4,1) \land p(3,4,2)\right] \lor
	\left[ p(3,4,2) \land p(3,4,1)\right] \lor
	\left[ p(3,4,2) \land p(3,4,4)\right] \lor
	\left[ p(3,4,4) \land p(3,4,2)\right] \lor
	\left[ p(3,4,3) \land p(3,4,6)\right] \lor
	\left[ p(3,4,6) \land p(3,4,3)\right] \right]
$
}



\end{document} 