\section{Results and Discussion}
\label{sec:Results_and_Discussion}
This section contains lists of all important results and summarizes the most important things.

\subsection{Ultrasound Speed $c$}
\label{subsec:Ultrasound_Speed}
The following figures \ref{fig:results_ultrasound_speed} and \ref{fig:results_metals} show a graphical comparison between the calculated and the litearture values for the sound velocity.

\begin{figure}[H]
	\centering
	\includegraphics[scale=0.94]{results_ultrasound_speed}
	\caption{Graphical comparison between the calculated values (black cross with red uncertainty bar) and their respective literature values (blue cross). Especially the ultrasound speed of water is extremely close to the litearature value. The calculated sound velocities in PMMA at an oscillation frequency of 1 MHz are off by quite a bit (both logitudinal and transversal).}
	\label{fig:results_ultrasound_speed}
\end{figure}

\begin{figure}[H]
	\centering
	\includegraphics[scale=0.94]{results_metals}
	\caption{Graphical comparison of the three different metals aluminium, copper and brass. They are compared separately because their sound velocity is in a different range. This would have stretched out figure \ref{fig:results_ultrasound_speed} above and thus would have made it less readable. The literature values of the sound velocity (blue) in aluminium and copper lie inside the error bars of the respective metals.}
	\label{fig:results_metals}
\end{figure}

Table \ref{tab:Ultrasound_Speed} shows all calculated sound velocities and their respective literature values in one table.

\begin{table}[H]
	\centering
	\renewcommand{\arraystretch}{1.1}
	\begin{tabular}{|l|c|c|c|}
		\cline{2-4}
		\multicolumn{1}{c|}{} & $\boldsymbol{c}$ \textbf{@ 1 MHz} & $\boldsymbol{c}$ \textbf{@ 5 MHz} & \textbf{Litearture} \\
		\multicolumn{1}{c|}{} & in m/s & in m/s & in m/s \\
		\hline
		\textbf{PMMA} & $(2751\pm 19)$ & $(2721\pm 21)$ & $\approx 2700$ \\
		\hline
		\textbf{Aluminium} & - & $(6387\pm 59)$ & $\approx 6400$ \\
		\hline
		\textbf{Copper} & - & $(4680\pm 53)$ & $\approx 4700$ \\
		\hline
		\textbf{Brass} & - & $(4627\pm 52)$ & $\approx 4700$ \\
		\hline
		\textbf{Water 21 \textdegree C} & - & $(1488\pm 7)$ & $\approx 1483$ \\
		\hline
		\textbf{Water 49 \textdegree C} & - & $(1538\pm 8)$ & $\approx 1540$ \\
		\hline
		\textbf{Saltwater 40 \textdegree C} & - & $(1612\pm 10)$ & $\approx 1620$ \\
		\hline
		\textbf{PMMA trans.} & $(1405\pm 15)$ & - & $\approx 1350$ \\
		\hline
	\end{tabular}
	\caption{Summary of all calculated sound velocities and their respective literature values for the oscillation frequencies 1 MHz and 5 MHz.}
	\label{tab:Ultrasound_Speed}
\end{table}

% -----------------------------------------------------------------------------------------
\subsection{Attenuation Coefficient $\mu$}
\label{subsec:Attenuation_Coefficient}
The following figure \ref{fig:results_absorption} shows a graphical comparison between the two calculated attenuation coefficients and their uncertainties.

\begin{figure}[H]
	\centering
	\includegraphics[scale=0.94]{results_absorption}
	\caption{Graphical comparison between the calculated values (black cross with red uncertainty bar) and their respective literature values (blue cross). The calculated attenuatin coefficient for PMMA at a frequency of 5 MHz is very imprecise. This is due to the fact, that the amplitude values are approaching 0 very fast. Thus, it is hard to get accurate readings (see figure \ref{fig:measuring_procedure}).}
	\label{fig:results_absorption}
\end{figure}

Table \ref{tab:Attenuation_Coefficient} shows the values of the calculated attenuation coefficients.

\begin{table}[H]
	\centering
	\renewcommand{\arraystretch}{1.1}
	\begin{tabular}{|l|c|c|}
		\cline{2-3}
		\multicolumn{1}{c|}{} & $\boldsymbol{\mu}$ \textbf{@ 1 MHz} & $\boldsymbol{\mu}$ \textbf{@ 5 MHz} \\
		\multicolumn{1}{c|}{} & in m$^{-1}$ & in m$^{-1}$ \\
		\hline
		\textbf{PMMA} & $(16\pm 3)$ & $(43\pm 6)$ \\
		\hline
	\end{tabular}
	\caption{Summary of the calculated attenuation coefficients for the oscillation frequencies 1 MHz and 5 MHz.}
	\label{tab:Attenuation_Coefficient}
\end{table}


\documentclass[jou]{apa6}

\usepackage[american]{babel}

\usepackage{csquotes}
\usepackage[style=apa,sortcites=true,sorting=nyt,backend=biber]{biblatex}
\DeclareLanguageMapping{american}{american-apa}
\addbibresource{bibliography.bib}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Discrete Structures
%% The start of RBS stuff
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

% Working internal and external links in PDF
\usepackage{hyperref}
% Extra math symbols in LaTeX
\usepackage{amsmath}
\usepackage{gensymb}
\usepackage{amssymb}
% Enumerations with (a), (b), etc.
\usepackage{enumerate}
\usepackage{xcolor}

\let\OLDitemize\itemize
\renewcommand\itemize{\OLDitemize\addtolength{\itemsep}{-6pt}}

\usepackage{etoolbox}
\makeatletter
\preto{\@verbatim}{\topsep=3pt \partopsep=3pt }
\makeatother

% These sizes redefine APA for A4 paper size
\oddsidemargin 0.0in
\evensidemargin 0.0in
\textwidth 6.27in
\headheight 1.0in
\topmargin -24pt
\headheight 12pt
\headsep 12pt
\textheight 9.19in

\title{Sample Quiz 8}
\author{Discrete Structures, Spring 2020}
\affiliation{RBS}

\leftheader{Discrete Sample Quiz 8}

\abstract{%
}

%\keywords{}

\setlength\parindent{0pt}

\begin{document}

%\thispagestyle{empty}

\twocolumn
\section{Quiz 9: Advanced Counting}

\vspace{10pt}
{\bf Question 1.}
You have a rectangular chocolate bar of $2 \times n$ squares.
Denote by $a(n)$ the ways how you can divide the chocolate bar into
little dominoes (rectangles $1 \times 2$).
For example, $a(1) = 1$ and $a(2) = 2$.
Figure~\ref{fig:domino-tiling} shows a possible tiling for
the rectangle $2 \times n$, where $n=8$.

\begin{figure}[!htb]
\center{\includegraphics[width=2in]{quiz-09/domino-tiling.png}}
\caption{\label{fig:domino-tiling} Domino Tiling.}
\end{figure}

In your answer write the recurrent expression of {\tt a(n)} (express it through the previous members
of the sequence: {\tt a(n-1),...}).

{\em Note.} Assume that all the little
chocolate squares are distinguishable; the cuts that differ by
some symmetry (rotation or flip of the chocolate bar) are considered to be different.

\vspace{10pt}
{\bf Question 2.}
Somebody wants to find out, in how many ways it is possible to pay \$15 in a vending machine, using
\$1 coins, \$1 bills, \$2 bills and \$5 bills, where the order, how you insert them into the machine matters.

In your answer write an integer number.

{\em Note.} In order to solve this, you probably want to define a
recurrent sequence for $b_n$ and
find $b_{15}$. People sometimes use characteristic functions for such problems as well:
see \url{https://bit.ly/2Qu4Re4}. Then they can solve some variations of this
problem (what happens, if you have limited number of \$5 bills, etc.), but they need to use
infinite power series and other calculus techniques.

\vspace{10pt}
{\bf Question 3.}
Consider a recurrent sequence:
$$\left\{ \begin{array}{l}
a_0 = 0,\\
a_1 = 1, \\
a_n = 2a_{n-1} + 2a_{n-2},\;n\geq 2.\\
\end{array} \right.$$
Find both roots of the characteristic equation $r_1,r_2$.

In you answer write two real numbers, round them to the nearest thousandth.

\vspace{10pt}
{\bf Question 4}
There is a sequence $a(n)$ such that $a(0) = 0$, $a(1) = 0$, $a(2)=1$, but its
characteristic equation is $(r-1)^2(r-2) = 0$. (See \url{https://bit.ly/3a72Ps0} where
the characteristic equations with repeated roots are explained.)
Find the value $a(8)$.

In your answer write a number.

\vspace{10pt}
{\bf Question 5}
Write the following expression:\\
{\tt ((A / (B - (C + D))) * E) - (F + (G + H))}\\
in prefix (Polish) notation and also in the postfix (reverse-Polish) notation.

In your answer separate both expressions with a comma.

\vspace{10pt}
{\bf Question 6}
Find the number of ways to parenthesize the following expression:\\
{\tt A / B - C + D * E - F + G + H}\\
You should not assume any associativity for the operations.
For example {\tt (F + G) + H} and {\tt F + (G + H)} are two
different ways to insert parentheses. On the other hand
{\tt (F + G) + H} and {\tt ((F + (G)) + H)} is the same way, since
the order of execution in both is the same.

In your answer write an integer number.

\vspace{10pt}
{\bf Question 7.}
Suppose $f(n) = 3f(n/3) + 2n$, $f(1) = 1$. Find $f(3^8)$.

In your answer write an integer number.

\newpage

\subsection{Answers}

\vspace{4pt}
{\bf Question 1.} Answer: {\tt a(n)=a(n-1)+a(n-2)}\\
Notice that the leftmost two squares in the $2 \times n$
rectangle can be filled in two different ways:\\
{\bf Alternative 1:} They can be filled by a single vertical domino.
In this case the remaining rectangle $2 \times (n-1)$ can be
filled in $a(n-1)$ ways.\\
{\bf Alternative 2:} They can be filled by two horizontal dominoes.
In this case the remaining rectangle $2 \times (n-2)$ can be filled
in $a(n-2)$ ways.\\
The total number of ways is obtained by adding $a(n-1)$ and $a(n-2)$.

{\em Note.} The sequence $a(n)$ is a shifted Fibonacci sequence.
We can easily verify that $a(n) = F_{n+1}$ for $n \geq 0$.
(We define $F_0 = 0$, $F_1 = 1$ and $F_{n} = F_{n-1} + F_{n-2}$
is the regular Fibonacci sequence.)

\vspace{6pt}
{\bf Question 2.} Answer: {\tt 527383}\\
Let us define the sequence $b_n$ (in how many ways you can
insert \$1 coins, \$1 bills, \$2 bills and \$5 bills into a vending
machine so that it adds up to $n$ dollars).\\
But before that we consider a simpler sequence $a_n$ (in how many ways you can
insert \$1 coins, \$1 bills, \$2 bills into a vending machine to pay $n$ dollars \textendash{}
i.e.\ you do not use \$5 bills at all).

Sequence $a_n$ was already discussed in the {\em Sample Quiz 9}, Problem 2.
It is defined as a recurrent sequence:
$$\left\{ \begin{array}{l}
a_1 = 2, \\
a_2 = 5, \\
a_{n} = 2a_{n-1} + a_{n-2},\;n \geq 3.\\
\end{array} \right.$$

If you wish, you can also define $a_0 = 1$ (there is exactly one way how to pay \$0 \textendash{}
use zero instances of every coin and bill). Compute the initial members of this sequence:
$$(a_1,a_2,a_3,a_4) = (2,5,12,29).$$

Notice that the sequence $b_n$ (where we also allow \$5 bills) would have exactly same
members up to $b_4$ (because sums up to $4$ dollars cannot use any \$5 bills anyway).
Further members of $b_n$ can be defined recursively:
$$\left\{ \begin{array}{l}
b_0 = 1,\\
b_1 = 2,\\
b_2 = 5,\\
b_3 = 12,\\
b_4 = 29,\\
b_n = 2b_{n-1} + b_{n-2} + b_{n-5},\;n \geq 5.\\
\end{array} \right.$$

The last (recurrent) line means that $b_n$ ($n \geq 5$) is a total of four different kinds of sequences:
\begin{itemize}
\item Some sequences start from a \$1 coin; the rest is paid in $b_{n-1}$ different ways.
\item Some sequences start from a \$1 bill; the rest is paid in $b_{n-1}$ different ways.
\item Some sequences start from a \$2 bill; the rest is paid in $b_{n-2}$ different ways.
\item Some sequences start from a \$5 bill; the rest is paid in $b_{n-5}$ different ways.
\end{itemize}

Here are the first members $b_0,\ldots,b_{15}$ of this sequence:

$1,\; 2,\; 5,\; 12,\; 29,\; 71,\; 173,\; 422,\; 1029,\; 2509,\; 6118,$
$14918,\; 36376,\; 88699,\; 216283,\; 527383$.

\vspace{6pt}
{\bf Question 3.} Answer:\\ {\tt 2.732,-0.732} or
{\tt -0.732,2.732} \\
The characteristic equation is
$$r^2 - 2r - 2 = 0.$$
And the roots of this square equation are
$r_{1,2} = 1 \pm \sqrt{3}$.
By rounding them to the nearest thousandth, we get
the answer.

{\em Note.} By the way, we can also
find the formula for $a_n$. (See {\em Sample Quiz 9},
Problem 3, {\bf (B)}.)

\vspace{6pt}
{\bf Question 4} Answer: {\tt 247}\\
Rewrite the characteristic equation:
\begin{align}
(r-1)^2(r-2) & = (r^2 - 2r + 1)(r-2) = \nonumber \\
 & = r^3 - 2r^2 + r - 2r^2 + 4r - 2 = \nonumber \\
 & = r^3 - 4r^2 + 5r - 2 = 0. \nonumber
\end{align}
We can restore the recurrent relationship from here:
$$a_{n} = 4a_{n-1} - 5a_{n-2} + 2a_{n-3}.$$

\begin{tabular}{|c|r|r|r|r|r|r|r|r|r|} \hline
$n$   & 0 & 1 & 2 & 3 & 4  & 5  & 6  & 7   & 8 \\ \hline
$a_n$ & 0 & 0 & 1 & 4 & 11 & 26 & 57 & 120 & 247 \\ \hline
\end{tabular}

\vspace{6pt}
{\bf Question 5} Answer:\\
{\tt -*/A-B+CDE+F+GH, ABCD+-/E*FGH++-}\\
In order to transform infix notation into postfix notation
we can do this step by step. We start with the last/outermost operation
(minus in our case). And leave both subexpressions in
the infix form. Then we find the last/outermost operation
the subexpressions and so on.

{\tt ((A/(B-(C+D)))*E) - (F+(G+H))}\\
{\tt \textcolor{red}{-} ((A/(B-(C+D)))*E) (F+(G+H))}\\
{\tt \textcolor{red}{- *} (A/(B-(C+D))) E (F+(G+H))}\\
{\tt \textcolor{red}{- * /} A (B-(C+D)) E (F+(G+H))}\\
{\tt \textcolor{red}{- * /} A \textcolor{red}{-} B (C+D) E (F+(G+H))}\\
{\tt \textcolor{red}{- * /} A \textcolor{red}{-} B \textcolor{red}{+} C D E (F+(G+H))}\\
{\tt \textcolor{red}{- * /} A \textcolor{red}{-} B \textcolor{red}{+} C D E \textcolor{red}{+} F (G+H)}\\
{\tt \textcolor{red}{- * /} A \textcolor{red}{-} B \textcolor{red}{+} C D E \textcolor{red}{+} F \textcolor{red}{+} G H}\\

In these expressions the regular (infix) arithmetic operations are shown in black, but
prefix arithmetic operations are shown in red. Postfix transformation is very similar.

\vspace{6pt}
{\bf Question 6} Answer: {\tt 429}\\
The expression {\tt A/B-C+D*E-F+G+H} contains
$7$ operations and $8$ operands/letters. It can
be parenthesized in $C_7 = 429$ ways, where
$C_n$ is the sequence of {\em Catalan numbers}
defined recursively:
$$\left\{ \begin{array}{l}
C_0 = 1, \\
C_{n+1}=\sum\limits_{i=0}^{n} C_i \cdot C_{n-i}
\end{array} \right.$$

Here are the first few members:\\
$C_0=1,\; C_1=1,\; C_2=2,\; C_3=5,\; C_4=14,\; C_5=42,$\\
$C_6=132,\; C_7=429,\; C_8=1430,\; C_9=4862,$\\
$C_{10}=16796.$

\vspace{6pt}
{\bf Question 7} Answer: {\tt 111537}\\
We can compute the subsequent values, using the recursive formula.

\begin{tabular}{|l|l|} \hline
$n$ & $f(n)$ \\ \hline
$3^0$ & $1$ \\ \hline
$3^1$ & $9 = 3 \cdot 3$ \\ \hline
$3^2$ & $45 = 5 \cdot 9$ \\ \hline
$3^3$ & $189 = 7 \cdot 27$ \\ \hline
$3^4$ & $729 = 9 \cdot 81$ \\ \hline
$3^5$ & $2673 = 11 \cdot 243$ \\ \hline
$3^6$ & $9477 = 13 \cdot 729$ \\ \hline
$3^7$ & $32805 = 15 \cdot 2187$ \\ \hline
$3^8$ & $111537 = 17 \cdot 6561$ \\ \hline
\end{tabular}

It is possible to prove by induction that\\ $f(n) = (2n+1) \cdot 3^n$.\\
We can also apply this theorem:

{\bf Master Theorem:} Let $f$ be an increasing function that
satisfies the recurrence relation
$$f(n) = af(n/b) + cn^d$$
whenever $n = b^k$, where $k$ is a positive integer greater than
$1$, and $c$  and $d$ are real numbers with $c$ positive
and $d$ nonnegative. Then
$$f(n)\;\text{is}\;\left\{ \begin{array}{ll}
O\left(n^d\right) & \text{if}\;a<b^d \\
O\left(n^d \log n \right) & \text{if}\;a=b^d \\
O\left(n^{\log_b a}\right) & \text{if}\;a>b^d \\
\end{array} \right.$$

In our case $a = 3$, $b = 3$, $c=2$ and $d = 1$.
Observe that $a = b^d$, therefore we get that $f(n)$ is in
$O(n \log n)$.\\

For example, if $n = 3^8 = 6561$, then $f(n) = 6561 \cdot 17$.
We clearly see both factors: $6561$ grows as $O(n)$, but
$17 = 2 \cdot \left( \log_3 6561 \right) +1$ grows as $O(\log n)$ (we do not care about the
base of a logarithm in the Big-O notation). So their product
$f(n)$ grows as $O(n \log n)$.

\end{document}


%!TEX root = forallx.tex

%ZL fordítása kezdet
\chapter{Quantified logic}
Predikátum logika
\label{ch.QL}

This chapter introduces a logical language called QL. It is a version of \emph{quantified logic}, because it allows for quantifiers like \emph{all} and \emph{some}. Quantified logic is also sometimes called \emph{predicate logic}, because the basic units of the language are predicates and terms.
A fejezet bemutatja az úgynevezett QL logika nyelvet. Ez egy fajtája a predikátum logikának, mert engedélyezi az predikátumokat, mint a mind, és a néhány. A predikátum logika, alapegységei predikátumok, és feltételek.

\section{From sentences to predicates}
Mondatoktól prediátumokig
Consider the following argument, which is obviously valid in English:
Figyelembe véve a következő érvet, ami a magyarban nyilvánvalóan érvényes:
\begin{quote}
If everyone knows logic, then either no one will be confused or everyone will. Everyone will be confused only if we try to believe a contradiction. This is a logic class, so everyone knows logic.\\
\therefore\ If we don't try to believe a contradiction, then no one will be confused.
\end{quote}
Ha mindenki ismeri a logikát, akkor vagy senki nem lesz zavarban vagy mindenki. Mindenki csak akkor lesz zavarban, ha megpróbáljuk elhinni az ellentmondást. Ez egy logikai osztály, tehát mindenki ismeri a logikát. Ha nem próbáljuk meg elhinni az ellentmondást, akkor senki sem lesz zavarban.
In order to symbolize this in SL, we will need a symbolization key.
Annak érdekében, hogy tudjuk ezt szimbolizálni SL-ben, szükségünk lesz egy szimbolizációs kulcsra.
\begin{ekey}
\item[L:] Everyone knows logic.
L: Mindenki ismeri a logikát.
\item[N:] No one will be confused.
N: Senki sem lesz zavarban.
\item[E:] Everyone will be confused.
E: Mindenki zavarban lesz.
\item[B:] We try to believe a contradiction.
B: Megpróbáljuk elhinni az ellentmondást.
\end{ekey}
Notice that $N$ and $E$ are both about people being confused, but they are two separate sentence letters. We could not replace $E$ with $\enot N$. Why not? $\enot N$ means `It is not the case that no one will be confused.' This would be the case if even one person were confused, so it is a long way from saying that \emph{everyone} will be confused.
Vegyük észre, hogy N, és E egyaránt, a zavarról szól, de mindkettő különálló mondat betű. Nem helyetesíthetjük az E-t ¬N-el.  Miért nem?  ¬N az jelenti  ‘Ez nem az az eset, hogy senki sem lesz zavarban.’ Ez az az eset lenne, hogy ha egyáltalan egy ember zavarban lenne, tehát ez messze van attól, hogy azt mondjuk, hogy mindenki zavarban lesz.

%ZL fordítása vége

%HD fordítása kezdet

Once we have separate sentence letters for $N$ and $E$, however, we erase any connection between the two. They are just two atomic sentences which might be true or false independently. In English, it could never be the case that both no one and everyone was confused. As sentences of SL, however, there is a truth-value assignment for which $N$ and $E$ are both true.

Expressions like `no one', `everyone', and `anyone' are called \emph{quantifiers}. By translating $N$ and $E$ as separate atomic sentences, we leave out the \emph{quantifier structure} of the sentences. Fortunately, the quantifier structure is not what makes this argument valid. As such, we can safely ignore it. To see this, we translate the argument to SL:
\begin{earg}
\item[]$L \eif (N \eor E)$
\item[]$E \eif B$
\item[]$L$
\item[\therefore]$\enot B \eif N$
\end{earg}
This is a valid argument in SL. (You can do a truth table to check this.)

Now consider another argument. This one is also valid in English.

\begin{quote}
\label{willard1}
Willard is a logician. All logicians wear funny hats.\\
\therefore\ Willard wears a funny hat.
\end{quote}

To symbolize it in SL, we define a symbolization key:
\begin{ekey}
\item[L:] Willard is a logician.
\item[A:] All logicians wear funny hats.
\item[F:] Willard wears a funny hat.
\end{ekey}

Now we symbolize the argument:
\begin{earg}
\item[]$L$
\item[]$A$
\item[\therefore] $F$
\end{earg}

This is \emph{invalid} in SL. (Again, you can confirm this with a truth table.) There is something very wrong here, because this is clearly a valid argument in English. The symbolization in SL leaves out all the important structure. Once again, the translation to SL overlooks quantifier structure: The sentence `All logicians wear funny hats' is about both logicians and hat-wearing. By not translating this structure, we lose the connection between Willard's being a logician and Willard's wearing a hat.

Some arguments with quantifier structure can be captured in SL, like the first example, even though SL ignores the quantifier structure. Other arguments are completely botched in SL, like the second example. Notice that the problem is not that we have made a mistake while symbolizing the second argument. These are the best symbolizations we can give for these arguments \emph{in SL}.

%HD fordítása vége

Generally, if an argument containing quantifiers comes out \emph{valid in SL}, then the English language argument is valid. If it comes out \emph{invalid in SL}, then we cannot say the English language argument is invalid. The argument might be valid because of quantifier structure which the natural language argument has and which the argument in SL lacks.

\nix{Is this true? Is it possible to exploit the independence of N and E?}

Similarly, if a sentence with quantifiers comes out as a \emph{tautology in SL}, then the English sentence is logically true. If it comes out as \emph{contingent in SL}, then this might be because of the structure of the quantifiers that gets removed when we translate into the formal language.

In order to symbolize arguments that rely on quantifier structure, we need to develop a different logical language. We will call this language quantified logic, QL.

\section{Building blocks of QL}

Just as sentences were the basic unit of sentential logic, predicates will be the basic unit of quantified logic. A predicate is an expression like `is a dog.' This is not a sentence on its own. It is neither true nor false. In order to be true or false, we need to specify something: Who or what is it that is a dog?

The details of this will be explained in the rest of the chapter, but here is the basic idea: In QL, we will represent predicates with capital letters. For instance, we might let $D$ stand for `\blank\ is a dog.' We will use lower-case letters as the names of specific things. For instance, we might let $b$ stand for Bertie. The expression $Db$ will be a sentence in QL. It is a translation of the sentence `Bertie is a dog.'

In order to represent quantifier structure, we will also have symbols that represent quantifiers. For instance, `$\exists$' will mean `There is some\blank.' So to say that there is a dog, we can write $\exists x Dx$; that is: There is some $x$ such that $x$ is a dog.

That will come later. We start by defining singular terms and predicates.

\subsection{Singular Terms}
In English, a \define{singular term} is a word or phrase that refers to a \emph{specific} person, place, or thing. The word `dog' is not a singular term, because there are a great many dogs. The phrase `Philip's dog Bertie' is a singular term, because it refers to a specific little terrier.

A \define{proper name} is a singular term that picks out an individual without describing it. The name `Emerson' is a proper name, and the name alone does not tell you anything about Emerson. Of course, some names are traditionally given to boys and other are traditionally given to girls. If `Jack Hathaway' is used as a singular term, you might guess that it refers to a man. However, the name does not necessarily mean that the person referred to is a man--- or even that the creature referred to is a person. Jack might be a giraffe for all you could tell just from the name. There is a great deal of philosophical action surrounding this issue, but the important point here is that a name is a singular term because it picks out a single, specific individual.

Other singular terms more obviously convey information about the thing to which they refer. For instance, you can tell without being told anything further that `Philip's dog Bertie' is a singular term that refers to a dog. A \define{definite description} picks out an individual by means of a unique description. In English, definite descriptions are often phrases of the form `the such-and-so.' They refer to \emph{the} specific thing that matches the given description. For example, `the tallest member of Monty Python' and `the first emperor of China' are definite descriptions. A description that does not pick out a specific individual is not a definite description. `A member of Monty Python' and `an emperor of China' are not definite descriptions.

We can use proper names and definite descriptions to pick out the same thing. The proper name `Mount Rainier' names the location picked out by the definite description `the highest peak in Washington state.' The expressions refer to the same place in different ways. You learn nothing from my saying that I am going to Mount Rainier, unless you already know some geography. You could guess that it is a mountain, perhaps, but even this is not a sure thing; for all you know it might be a college, like Mount Holyoke. Yet if I were to say that I was going to the highest peak in Washington state, you would know immediately that I was going to a mountain in Washington state.

In English, the specification of a singular term may depend on context; `Willard' means a specific person and not just someone named Willard; `P.D. Magnus' as a logical singular term means \emph{me} and not the other P.D. Magnus. We live with this kind of ambiguity in English, but it is important to keep in mind that singular terms in QL must refer to just one specific thing.

In QL, we will symbolize singular terms with lower-case letters $a$ through $w$. We can add subscripts if we want to use some letter more than once. So $a,b,c,\ldots w, a_1, f_{32}, j_{390}$, and $m_{12}$ are all terms in QL.

Singular terms are called \define{constants} because they pick out specific individuals. Note that $x, y$, and $z$ are not constants in QL. They will be \define{variables}, letters which do not stand for any specific thing. We will need them when we introduce quantifiers.

\subsection{Predicates}
The simplest predicates are properties of individuals. They are things you can say about an object. `\blank\ is a dog' and `\blank\ is a member of Monty Python' are both predicates. In translating English sentences, the term will not always come at the beginning of the sentence: `A piano fell on \blank' is also a predicate. Predicates like these are called \define{one-place} or \define{monadic}, because there is only one blank to fill in. A one-place predicate and a singular term combine to make a sentence.

Other predicates are about the \emph{relation} between two things. For instance, `\blank\ is bigger than \blank', `\blank\ is to the left of \blank', and `\blank\ owes money to \blank.' These are \define{two-place} or \define{dyadic} predicates, because they need to be filled in with two terms in order to make a sentence.

In general, you can think about predicates as schematic sentences that need to be filled out with some number of terms. Conversely, you can start with sentences and make predicates out of them by removing terms. Consider the sentence, `Vinnie borrowed the family car from Nunzio.' By removing a singular term, we can recognize this sentence as using any of three different monadic predicates:
\begin{center}
\blank borrowed the family car from Nunzio.\\
Vinnie borrowed \blank from Nunzio.\\
Vinnie borrowed the family car from \blank.
\end{center}

By removing two singular terms, we can recognize three different dyadic predicates:
\begin{center}
Vinnie borrowed \blank\ from \blank.\\
\blank\ borrowed the family car from \blank.\\
\blank\ borrowed \blank\ from Nunzio.
\end{center}

By removing all three singular terms, we can recognize one \define{three-place} or \define{triadic} predicate:
\begin{center}
\blank\ borrowed \blank\ from \blank.
\end{center}

If we are translating this sentence into QL, should we translate it with a one-, two-, or three-place predicate? It depends on what we want to be able to say. If the only thing that we will discuss being borrowed is the family car, then the generality of the three-place predicate is unnecessary. If the only borrowing we need to symbolize is different people borrowing the family car from Nunzio, then a one-place predicate will be enough.

In general, we can have predicates with as many places as we need. Predicates with more than one place are called \define{polyadic}. Predicates with $n$ places, for some number $n$, are called \define{n-place} or \define{n-adic}.

In QL, we symbolize predicates with capital letters $A$ through $Z$, with or without subscripts. When we give a symbolization key for predicates, we will not use blanks; instead, we will use variables. By convention, constants are listed at the end of the key. So we might write a key that looks like this:
\begin{ekey}
\item[Ax:] $x$ is angry.
\item[Hx:] $x$ is happy.
\item[T$_1$xy:] $x$ is as tall or taller than $y$.
\item[T$_2$xy:] $x$ is as tough or tougher than $y$.
\item[Bxyz:] $y$ is between $x$ and $z$.
\item[d:] Donald
\item[g:] Gregor
\item[m:] Marybeth
\end{ekey}

We can symbolize sentences that use any combination of these predicates and terms. For example:
\begin{earg}
\nix{I am inclined to change these to Cordelia, Hamlet, and Macbeth}
\item[\ex{terms1}] Donald is angry.
\item[\ex{terms2}] If Donald is angry, then so are Gregor and Marybeth.
\item[\ex{terms3}] Marybeth is at least as tall and as tough as Gregor.
\item[\ex{terms4}] Donald is shorter than Gregor.
\item[\ex{terms5}] Gregor is between Donald and Marybeth.
\end{earg}

Sentence \ref{terms1} is straightforward: $Ad$. The `$x$' in the key entry `$Ax$' is just a placeholder; we can replace it with other terms when translating.

Sentence \ref{terms2} can be paraphrased as, `If $Ad$, then $Ag$ and $Am$.' QL has all the truth-functional connectives of SL, so we translate this as $Ad \eif (Ag \eand Am)$.

Sentence \ref{terms3} can be translated as $T_1mg \eand T_2mg$.

Sentence \ref{terms4} might seem as if it requires a new predicate. If we only needed to symbolize this sentence, we could define a predicate like $Sxy$ to mean `$x$ is shorter than $y$.' However, this would ignore the logical connection between `shorter' and `taller.' Considered only as symbols of QL, there is no connection between $S$ and $T_1$. They might mean anything at all. Instead of introducing a new predicate, we paraphrase sentence \ref{terms4} using predicates already in our key: `It is not the case that Donald is as tall or taller than Gregor.' We can translate it as $\enot T_1dg$.

Sentence \ref{terms5} requires that we pay careful attention to the order of terms in the key. It becomes $Bdgm$.

\section{Quantifiers}
We are now ready to introduce quantifiers. Consider these sentences:
\begin{earg}
\item[\ex{q.a}] Everyone is happy.
\item[\ex{q.ac}] Everyone is at least as tough as Donald.
\item[\ex{q.e}] Someone is angry.
\end{earg}

It might be tempting to translate sentence \ref{q.a} as $Hd \eand Hg \eand Hm$. Yet this would only say that Donald, Gregor, and Marybeth are happy. We want to say that \emph{everyone} is happy, even if we have not defined a constant to name them. In order to do this, we introduce the `$\forall$' symbol. This is called the \define{universal quantifier}.

A quantifier must always be followed by a variable and a formula that includes that variable. We can translate sentence \ref{q.a} as $\forall x Hx$. Paraphrased in English, this means `For all $x$, $x$ is happy.'
%\nix{This may be too soon:}
We call $\forall x$ an \emph{x-quantifier}. The formula that follows the quantifier is called the \emph{scope} of the quantifier. We will give a formal definition of scope later, but intuitively it is the part of the sentence that the quantifier quantifies over. In $\forall x Hx$, the scope of the universal quantifier is $Hx$.

Sentence \ref{q.ac} can be paraphrased as, `For all $x$, $x$ is at least as tough as Donald.' This translates as $\forall x T_2xd$.

In these quantified sentences, the variable $x$ is serving as a kind of placeholder. The expression $\forall x$ means that you can pick anyone and put them in as $x$. There is no special reason to use $x$ rather than some other variable. The sentence $\forall x Hx$ means exactly the same thing as $\forall y Hy$, $\forall z Hz$, and $\forall x_5 Hx_5$.

To translate sentence \ref{q.e}, we introduce another new symbol: the \define{existential quantifier}, $\exists$. Like the universal quantifier, the existential quantifier requires a variable. Sentence \ref{q.e} can be translated as $\exists x Ax$. This means that there is some $x$ which is angry. More precisely, it means that there is \emph{at least one} angry person. Once again, the variable is a kind of placeholder; we could just as easily have translated sentence \ref{q.e} as $\exists z Az$.

Consider these further sentences:
\begin{earg}
\item[\ex{q.ne}] No one is angry.
\item[\ex{q.en}] There is someone who is not happy.
\item[\ex{q.na}] Not everyone is happy.
\end{earg}

Sentence \ref{q.ne} can be paraphrased as, `It is not the case that someone is angry.' This can be translated using negation and an existential quantifier: $\enot \exists x Ax$. Yet sentence \ref{q.ne} could also be paraphrased as, `Everyone is not angry.' With this in mind, it can be translated using negation and a universal quantifier: $\forall x \enot Ax$. Both of these are acceptable translations, because they are logically equivalent. The critical thing is whether the negation comes before or after the quantifier.

In general, $\forall x\script{A}$ is logically equivalent to $\enot\exists x\enot\script{A}$. This means that any sentence which can be symbolized with a universal quantifier can be symbolized with an existential quantifier, and vice versa. One translation might seem more natural than the other, but there is no logical difference in translating with one quantifier rather than the other. For some sentences, it will simply be a matter of taste.

Sentence \ref{q.en} is most naturally paraphrased as, `There is some $x$ such that $x$ is not happy.' This becomes $\exists x \enot Hx$. Equivalently, we could write $\enot\forall x Hx$.

Sentence \ref{q.na} is most naturally translated as $\enot\forall xHx$. This is logically equivalent to sentence \ref{q.en} and so could also be translated as $\exists x \enot Hx$.

Although we have two quantifiers in QL, we could have an equivalent formal language with only one quantifier. We could proceed with only the universal quantifier, for instance, and treat the existential quantifier as a notational convention. We use square brackets [ ] to make some sentences more readable, but we know that these are really just parentheses ( ). In the same way, we could write `$\exists x$' knowing that this is just shorthand for `$\enot \forall x \enot$.' There is a choice between making logic formally simple and making it expressively simple. With QL, we opt for expressive simplicity. Both $\forall$ and $\exists$ will be symbols of QL.

\subsection{Universe of Discourse}
Given the symbolization key we have been using, $\forall xHx$ means `Everyone is happy.' Who is included in this \emph{everyone}? When we use sentences like this in English, we usually do not mean everyone now alive on the Earth. We certainly do not mean everyone who was ever alive or who will ever live. We mean something more modest: everyone in the building, everyone in the class, or everyone in the room.

In order to eliminate this ambiguity, we will need to specify a \define{universe of discourse}--- abbreviated UD. The UD is the set of things that we are talking about. So if we want to talk about people in Chicago, we define the UD to be people in Chicago. We write this at the beginning of the symbolization key, like this:
\begin{ekey}
\item[UD:] people in Chicago
\end{ekey}
The quantifiers \emph{range over} the universe of discourse. Given this UD, $\forall x$ means `Everyone in Chicago' and $\exists x$ means `Someone in Chicago.' Each constant names some member of the UD, so we can only use this UD with the symbolization key above if Donald, Gregor, and Marybeth are all in Chicago. If we want to talk about people in places besides Chicago, then we need to include those people in the UD.

In QL, the UD must be \emph{non-empty}; that is, it must include at least one thing. It is possible to construct formal languages that allow for empty UDs, but this introduces complications.

Even allowing for a UD with just one member can produce some strange results. Suppose we have this as a symbolization key:
\begin{ekey}
\item[UD:] the Eiffel Tower
\item[Px:] $x$ is in Paris.
\end{ekey}
The sentence $\forall x Px$ might be paraphrased in English as `Everything is in Paris.' Yet that would be misleading. It means that everything \emph{in the UD} is in Paris. This UD contains only the Eiffel Tower, so with this symbolization key $\forall x Px$ just means that the Eiffel Tower is in Paris.

\subsection{Non-referring terms}
In QL, each constant must pick out exactly one member of the UD. A constant cannot refer to more than one thing--- it is a \emph{singular} term. Each constant must still pick out \emph{something}. This is connected to a classic philosophical problem: the so-called problem of non-referring terms.

Medieval philosophers typically used sentences about the \emph{chimera} to exemplify this problem. Chimera is a mythological creature; it does not really exist. Consider these two sentences:
\begin{earg}
\item[\ex{chimera1}] Chimera is angry.
\item[\ex{chimera2}] Chimera is not angry.
\end{earg}
It is tempting just to define a constant to mean `chimera.' The symbolization key would look like this:
\begin{ekey}
\item[UD:] creatures on Earth
\item[Ax:] $x$ is angry.
\item[c:] chimera
\end{ekey}
We could then translate sentence \ref{chimera1} as $Ac$ and sentence \ref{chimera2} as $\enot Ac$.

Problems will arise when we ask whether these sentences are true or false.

One option is to say that sentence \ref{chimera1} is not true, because there is no chimera. If sentence \ref{chimera1} is false because it talks about a non-existent thing, then sentence \ref{chimera2} is false for the same reason. Yet this would mean that $Ac$ and $\enot Ac$ would both be false. Given the truth conditions for negation, this cannot be the case.

Since we cannot say that they are both false, what should we do? Another option is to say that sentence \ref{chimera1} is \emph{meaningless} because it talks about a non-existent thing. So $Ac$ would be a meaningful expression in QL for some interpretations but not for others. Yet this would make our formal language hostage to particular interpretations. Since we are interested in logical form, we want to consider the logical force of a sentence like $Ac$ apart from any particular interpretation. If $Ac$ were sometimes meaningful and sometimes meaningless, we could not do that.

This is the \emph{problem of non-referring terms}, and we will return to it later (see p.~\pageref{subsec.defdesc}.) The important point for now is that each constant of QL \emph{must} refer to something in the UD, although the UD can be any set of things that we like. If we want to symbolize arguments about mythological creatures, then we must define a UD that includes them. This option is important if we want to consider the logic of stories. We can translate a sentence like `Sherlock Holmes lived at 221B Baker Street' by including fictional characters like Sherlock Holmes in our UD.

\section{Translating to QL}
We now have all of the pieces of QL. Translating more complicated sentences will only be a matter of knowing the right way to combine predicates, constants, quantifiers, variables, and connectives. Consider these sentences:
\begin{earg}
\item[\ex{quan1}] Every coin in my pocket is a quarter.
\item[\ex{quan2}] Some coin on the table is a dime.
\item[\ex{quan3}] Not all the coins on the table are dimes.
\item[\ex{quan4}] None of the coins in my pocket are dimes.
\end{earg}
In providing a symbolization key, we need to specify a UD. Since we are talking about coins in my pocket and on the table, the UD must at least contain all of those coins. Since we are not talking about anything besides coins, we let the UD be all coins. Since we are not talking about any specific coins, we do not need to define any constants. So we define this key:
\begin{ekey}
\item[UD:] all coins
\item[Px:] $x$ is in my pocket.
\item[Tx:] $x$ is on the table.
\item[Qx:] $x$ is a quarter.
\item[Dx:] $x$ is a dime.
\end{ekey}
Sentence \ref{quan1} is most naturally translated with a universal quantifier. The universal quantifier says something about everything in the UD, not just about the coins in my pocket. Sentence \ref{quan1} means that (for any coin) \emph{if} that coin is in my pocket, \emph{then} it is a quarter. So we can translate it as $\forall x(Px \eif Qx)$.

Since sentence \ref{quan1} is about coins that are both in my pocket \emph{and} that are quarters, it might be tempting to translate it using a conjunction. However, the sentence $\forall x(Px \eand Qx)$ would mean that everything in the UD is both in my pocket and a quarter: All the coins that exist are quarters in my pocket. This would be a crazy thing to say, and it means something very different than sentence \ref{quan1}.

Sentence \ref{quan2} is most naturally translated with an existential quantifier. It says that there is some coin which is both on the table and which is a dime. So we can translate it as $\exists x(Tx \eand Dx)$.

Notice that we needed to use a conditional with the universal quantifier, but we used a conjunction with the existential quantifier. What would it mean to write $\exists x(Tx \eif Dx)$? Probably not what you think. It means that there is some member of the UD which would satisfy the subformula; roughly speaking, there is some $a$ such that $(Ta \eif Da)$ is true. In SL, $\script{A} \eif \script{B}$ is logically equivalent to $\enot\script{A} \eor \script{B}$, and this will also hold in QL. So $\exists x(Tx \eif Dx)$ is true if there is some $a$ such that $(\enot Ta \eor Da)$; i.e., it is true if some coin is \emph{either} not on the table \emph{or} is a dime. Of course there is a coin that is not on the table--- there are coins in lots of other places. So $\exists x(Tx \eif Dx)$ is trivially true. A conditional will usually be the natural connective to use with a universal quantifier, but a conditional within the scope of an existential quantifier can do very strange things. As a general rule, do not put conditionals in the scope of existential quantifiers unless you are sure that you need one.

Sentence \ref{quan3} can be paraphrased as, `It is not the case that every coin on the table is a dime.' So we can translate it as $\enot \forall x(Tx \eif Dx)$. You might look at sentence \ref{quan3} and paraphrase it instead as, `Some coin on the table is not a dime.' You would then translate it as $\exists x(Tx \eand \enot Dx)$. Although it is probably not obvious, these two translations are logically equivalent. (This is due to the logical equivalence between $\enot\forall x\script{A}$ and $\exists x\enot\script{A}$, along with the equivalence between $\enot(\script{A}\eif\script{B})$ and $\script{A}\eand\enot\script{B}$.)

Sentence \ref{quan4} can be paraphrased as, `It is not the case that there is some dime in my pocket.' This can be translated as $\enot\exists x(Px \eand Dx)$. It might also be paraphrased as, `Everything in my pocket is a non-dime,' and then could be translated as $\forall x(Px \eif \enot Dx)$. Again the two translations are logically equivalent. Both are correct translations of sentence \ref{quan4}.

We can now translate the argument from p.~\pageref{willard1}, the one that motivated the need for quantifiers:
\begin{quote}
Willard is a logician. All logicians wear funny hats.\\
\therefore\ Willard wears a funny hat.
\end{quote}
\begin{ekey}
\item[UD:] people
\item[Lx:] $x$ is a logician.
\item[Fx:] $x$ wears a funny hat.
\item[w:] Willard
\end{ekey}
Translating, we get:
\begin{earg}
\item[] $Lw$
\item[] $\forall x(Lx \eif Fx)$
\item[\therefore] $Fw$
\end{earg}

This captures the structure that was left out of the SL translation of this argument, and this is a valid argument in QL.

\nix{What does $(\forall x) Oxi$ mean? [Wait.] `Ryan and I owe me money.' It might be true (although slightly odd), but it would be very different than the same formal sentence with a UD of all people.}

\subsection{Empty predicates}
A predicate need not apply to anything in the UD. A predicate that applies to nothing in the UD is called an \define{empty} predicate.

Suppose we want to symbolize these two sentences:
\begin{earg}
\item[\ex{monkey1}]Every monkey knows sign language.
\item[\ex{monkey2}]Some monkey knows sign language.
\end{earg}
It is possible to write the symbolization key for these sentences in this way:
\begin{ekey}
\item[UD:] animals
\item[Mx:] $x$ is a monkey.
\item[Sx:] $x$ knows sign language.
\end{ekey}

Sentence \ref{monkey1} can now be translated as $\forall x(Mx \eif Sx)$.

Sentence \ref{monkey2} becomes $\exists x(Mx \eand Sx)$.

It is tempting to say that sentence \ref{monkey1} entails sentence \ref{monkey2}; that is: if every monkey knows sign language, then it must be that some monkey knows sign language. This is a valid inference in Aristotelean logic: All $M$s are $S$, \therefore\ some $M$ is $S$. However, the entailment does not hold in QL. It is possible for the sentence $\forall x(Mx \eif Sx)$ to be true even though the sentence $\exists x(Mx \eand Sx)$ is false.

How can this be? The answer comes from considering whether these sentences would be true or false \emph{if there were no monkeys}.

We have defined $\forall$ and $\exists$ in such a way that $\forall\script{A}$ is equivalent to $\enot \exists\enot \script{A}$. As such, the universal quantifier doesn't involve the existence of anything--- only non-existence. If sentence \ref{monkey1} is true, then there are \emph{no} monkeys who don't know sign language. If there were no monkeys, then $\forall x(Mx \eif Sx)$ would be true and $\exists x(Mx \eand Sx)$ would be false.

We allow empty predicates because we want to be able to say things like, `I do not know if there are any monkeys, but any monkeys that there are know sign language.' That is, we want to be able to have predicates that do not (or might not) refer to anything.

%Third, consider: $(\forall x)(Px \eif Px)$. This should be a tautology. But if sentence \ref{monkey1} implied sentence \ref{monkey2}, then this would imply $(\exists x)(Px \eand Px)$. It would become a logical truth that for any predicate there is something that satisfies that predicate.

What happens if we add an empty predicate $R$ to the interpretation above? For example, we might define $Rx$ to mean `$x$ is a refrigerator.' Now the sentence $\forall x(Rx \eif Mx)$ will be true. This is counterintuitive, since we do not want to say that there are a whole bunch of refrigerator monkeys. It is important to remember, though, that $\forall x(Rx \eif Mx)$ means that any member of the UD which is a refrigerator is a monkey. Since the UD is animals, there are no refrigerators in the UD and so the sentence is trivially true.

If you were actually translating the sentence `All refrigerators are monkeys', then you would want to include appliances in the UD. Then the predicate $R$ would not be empty and the sentence $\forall x(Rx \eif Mx)$ would be false.

\begin{table}[h!]
\factoidbox{
\begin{itemize}
\item A UD must have \emph{at least} one member.
\item A predicate may apply to some, all, or no members of the UD.
\item A constant must pick out \emph{exactly} one member of the UD.

 A member of the UD may be picked out by one constant, many constants, or none at all.
\end{itemize}
}
\end{table}

\subsection{Picking a Universe of Discourse}
The appropriate symbolization of an English language sentence in QL will depend on the symbolization key. In some ways, this is obvious: It matters whether $Dx$ means `$x$ is dainty' or `$x$ is dangerous.' The meaning of sentences in QL also depends on the UD.

Let $Rx$ mean `$x$ is a rose,' let $Tx$ mean `$x$ has a thorn,' and consider this sentence:
\begin{earg}
\item[\ex{pickUDrose}] Every rose has a thorn.
\end{earg}

It is tempting to say that sentence \ref{pickUDrose} should be translated as $\forall x(Rx \eif Tx)$. If the UD contains all roses, that would be correct. Yet if the UD is merely \emph{things on my kitchen table}, then $\forall x(Rx \eif Tx)$ would only mean that every rose on my kitchen table has a thorn. If there are no roses on my kitchen table, the sentence would be trivially true.

The universal quantifier only ranges over members of the UD, so we need to include all roses in the UD in order to translate sentence \ref{pickUDrose}. We have two options. First, we can restrict the UD to include all roses but \emph{only} roses. Then sentence \ref{pickUDrose} becomes $\forall x Tx$. This means that everything in the UD has a thorn; since the UD just is the set of roses, this means that every rose has a thorn. This option can save us trouble if every sentence that we want to translate using the symbolization key is about roses.

Second, we can let the UD contain things besides roses: rhododendrons, rats, rifles, and whatall else. Then sentence \ref{pickUDrose} must be $\forall x(Rx \eif Tx)$.

If we wanted the universal quantifier to mean \emph{every} thing, without restriction, then we might try to specify a UD that contains everything. This would lead to problems. Does `everything' include things that have only been imagined, like fictional characters? On the one hand, we want to be able to symbolize arguments about Hamlet or Sherlock Holmes. So we need to have the option of including fictional characters in the UD. On the other hand, we never need to talk about every thing that does not exist. That might not even make sense. There are philosophical issues here that we will not try to address. We can avoid these difficulties by always specifying the UD. For example, if we mean to talk about plants, people, and cities, then the UD might be `living things and places.'

Suppose that we want to translate sentence \ref{pickUDrose} and, with the same symbolization key, translate these sentences:

\begin{earg}
\item[\ex{pickUDhair}] Esmerelda has a rose in her hair.
\item[\ex{pickUDcross}] Everyone is cross with Esmerelda.
\end{earg}

We need a UD that includes roses (so that we can symbolize sentence \ref{pickUDrose}) and a UD that includes people (so we can translate sentence \ref{pickUDhair}--\ref{pickUDcross}.) Here is a suitable key:
\begin{ekey}
\item[UD:] people and plants
\item[Px:] $x$ is a person.
\item[Rx:] $x$ is a rose.
\item[Tx:] $x$ has a thorn.
\item[Cxy:] $x$ is cross with $y$.
\item[Hxy:] $x$ has $y$ in their hair.
\item[e:] Esmerelda
\end{ekey}

Since we do not have a predicate that means `$\ldots$ has a rose in her hair', translating sentence \ref{pickUDhair} will require paraphrasing. The sentence says that there is a rose in Esmerelda's hair; that is, there is something which is both a rose and is in Esmerelda's hair. So we get: $\exists x(Rx \eand Hex)$.

It is tempting to translate sentence \ref{pickUDcross} as $\forall x Cxe$. Unfortunately, this would mean that every member of the UD is cross with Esmerelda--- both people and plants. It would mean, for instance, that the rose in Esmerelda's hair is cross with her. Of course, sentence \ref{pickUDcross} does not mean that.

`Everyone' means every person, not every member of the UD. So we can paraphrase sentence \ref{pickUDcross} as, `Every person is cross with Esmerelda.' We know how to translate sentences like this: $\forall x(Px \eif Cxe)$

In general, the universal quantifier can be used to mean `everyone' if the UD contains only people. If there are people and other things in the UD, then `everyone' must be treated as `every person.'

\subsection{Translating pronouns}
When translating to QL, it is important to understand the structure of the sentences you want to translate. What matters is the final translation in QL, and sometimes you will be able to move from an English language sentence directly to a sentence of QL. Other times, it helps to paraphrase the sentence one or more times. Each successive paraphrase should move from the original sentence closer to something that you can translate directly into QL.

For the next several examples, we will use this symbolization key:

\begin{ekey}
\item[UD:] people
\item[Gx:] $x$ can play guitar.
\item[Rx:] $x$ is a rock star.
\item[l:] Lemmy
\end{ekey}

Now consider these sentences:

\begin{earg}
\item[\ex{pronoun1}] If Lemmy can play guitar, then he is a rock star.
\item[\ex{pronoun2}] If a person can play guitar, then he is a rock star.
\end{earg}

Sentence \ref{pronoun1} and sentence \ref{pronoun2} have the same consequent (`$\ldots$ he is a rock star'), but they cannot be translated in the same way. It helps to paraphrase the original sentences, replacing pronouns with explicit references.

Sentence \ref{pronoun1} can be paraphrased as, `If Lemmy can play guitar, then \emph{Lemmy} is a rockstar.' This can obviously be translated as $Gl \eif Rl$.

Sentence \ref{pronoun2} must be paraphrased differently: `If a person can play guitar, then \emph{that person} is a rock star.' This sentence is not about any particular person, so we need a variable. Translating halfway, we can paraphrase the sentence as, `For any person $x$, if $x$ can play guitar, then $x$ is a rockstar.' Now this can be translated as $\forall x (Gx \eif Rx)$. This is the same as, `Everyone who can play guitar is a rock star.'

Consider these further sentences:

\begin{earg}
\item[\ex{anyone1}] If anyone can play guitar, then Lemmy can.
\item[\ex{anyone2}] If anyone can play guitar, then he or she is a rock star.
\end{earg}

These two sentences have the same antecedent (`If anyone can play guitar$\ldots$'), but they have different logical structures.

Sentence \ref{anyone1} can be paraphrased, `If someone can play guitar, then Lemmy can play guitar.' The antecedent and consequent are separate sentences, so it can be symbolized with a conditional as the main logical operator: $\exists x Gx \eif Gl$.

Sentence \ref{anyone2} can be paraphrased, `For anyone, if that one can play guitar, then that one is a rock star.' It would be a mistake to symbolize this with an existential quantifier, because it is talking about everybody. The sentence is equivalent to `All guitar players are rock stars.' It is best translated as $\forall x(Gx \eif Rx)$.

The English words `any' and `anyone' should typically be translated using quantifiers. As these two examples show, they sometimes call for an existential quantifier (as in sentence \ref{anyone1}) and sometimes for a universal quantifier (as in sentence \ref{anyone2}). If you have a hard time determining which is required, paraphrase the sentence with an English language sentence that uses words besides `any' or `anyone.'

\subsection{Quantifiers and scope}

In the sentence $\exists x Gx \eif Gl$, the scope of the existential quantifier is the expression $Gx$. Would it matter if the scope of the quantifier were the whole sentence? That is, does the sentence $\exists x (Gx \eif Gl)$ mean something different?

With the key given above, $\exists x Gx \eif Gl$ means that if there is some guitarist, then Lemmy is a guitarist. $\exists x (Gx \eif Gl)$ would mean that there is some person such that if that person were a guitarist, then Lemmy would be a guitarist. Recall that the conditional here is a material conditional; the conditional is true if the antecedent is false. Let the constant $p$ denote the author of this book, someone who is certainly not a guitarist. The sentence $Gp \eif Gl$ is true because $Gp$ is false. Since someone (namely $p$) satisfies the sentence, then $\exists x (Gx \eif Gl)$ is true. The sentence is true because there is a non-guitarist, regardless of Lemmy's skill with the guitar.

Something strange happened when we changed the scope of the quantifier, because the conditional in QL is a material conditional. In order to keep the meaning the same, we would have to change the quantifier: $\exists x Gx \eif Gl$ means the same thing as $\forall x (Gx \eif Gl)$, and $\exists x (Gx \eif Gl)$ means the same thing as $\forall x Gx \eif Gl$.

This oddity does not arise with other connectives or if the variable is in the consequent of the conditional. For example, $\exists x Gx \eand Gl$ means the same thing as $\exists x (Gx \eand Gl)$, and $Gl \eif \exists x Gx$ means the same things as $\exists x(Gl \eif Gx)$.

\subsection{Ambiguous predicates}

Suppose we just want to translate this sentence:
\begin{earg}
\item[\ex{surgeon1}] Adina is a skilled surgeon.
\end{earg}
Let the UD be people, let $Kx$ mean `$x$ is a skilled surgeon', and let $a$ mean Adina. Sentence \ref{surgeon1} is simply $Ka$.

Suppose instead that we want to translate this argument:
\begin{quote}
The hospital will only hire a skilled surgeon. All surgeons are greedy. Billy is a surgeon, but is not skilled. Therefore, Billy is greedy, but the hospital will not hire him.
\end{quote}
We need to distinguish being a \emph{skilled surgeon} from merely being a \emph{surgeon}. So we define this symbolization key:
\begin{ekey}
\item[UD:] people
\item[Gx:] $x$ is greedy.
\item[Hx:] The hospital will hire $x$.
\item[Rx:] $x$ is a surgeon.
\item[Kx:] $x$ is skilled.
\item[b:] Billy
\end{ekey}

Now the argument can be translated in this way:
\begin{earg}
\label{surgeon2}
\item[] $\forall x\bigl[\enot (Rx \eand Kx) \eif \enot Hx\bigr]$
\item[] $\forall x(Rx \eif Gx)$
\item[] $Rb \eand \enot Kb$
\item[\therefore] $Gb \eand \enot Hb$
\end{earg}

Next suppose that we want to translate this argument:
\begin{quote}
\label{surgeon3}
Carol is a skilled surgeon and a tennis player. Therefore, Carol is a skilled tennis player.
\end{quote}
If we start with the symbolization key we used for the previous argument, we could add a predicate (let $Tx$ mean `$x$ is a tennis player') and a constant (let $c$ mean Carol). Then the argument becomes:
\begin{earg}
\item[] $(Rc \eand Kc) \eand Tc$
\item[\therefore] $Tc \eand Kc$
\end{earg}
This translation is a disaster! It takes what in English is a terrible argument and translates it as a valid argument in QL. The problem is that there is a difference between being \emph{skilled as a surgeon} and \emph{skilled as a tennis player}. Translating this argument correctly requires two separate predicates, one for each type of skill. If we let $K_1x$ mean `$x$ is skilled as a surgeon' and $K_2x$ mean `$x$ is skilled as a tennis player,' then we can symbolize the argument in this way:
\begin{earg}
\label{surgeon3correct}
\item[] $(Rc \eand K_1c) \eand Tc$
\item[\therefore] $Tc \eand K_2c$
\end{earg}
Like the English language argument it translates, this is invalid. %\nix{Notice that there is no logical connection between $K_1c$ and $Rc$. As symbols of QL, they might be any one-place predicates. In English there is a connection between being a \emph{surgeon} and being a \emph{skilled surgeon}: Every skilled surgeon is a surgeon. In order to capture this connection, we symbolize `Carol is a skilled surgeon' as $Rc \eand K_1c$. This means: `Carol is a surgeon and is skilled as a surgeon.'}

The moral of these examples is that you need to be careful of symbolizing predicates in an ambiguous way. Similar problems can arise with predicates like \emph{good}, \emph{bad}, \emph{big}, and \emph{small}. Just as skilled surgeons and skilled tennis players have different skills, big dogs, big mice, and big problems are big in different ways.

Is it enough to have a predicate that means `$x$ is a skilled surgeon', rather than two predicates `$x$ is skilled' and `$x$ is a surgeon'? Sometimes. As sentence \ref{surgeon1} shows, sometimes we do not need to distinguish between skilled surgeons and other surgeons.

Must we always distinguish between different ways of being skilled, good, bad, or big? No. As the argument about Billy shows, sometimes we only need to talk about one kind of skill. If you are translating an argument that is just about dogs, it is fine to define a predicate that means `$x$ is big.' If the UD includes dogs and mice, however, it is probably best to make the predicate mean `$x$ is big for a dog.'

\subsection{Multiple quantifiers}
Consider this following symbolization key and the sentences that follow it:
\begin{ekey}
\item{UD:} People and dogs
\item{Dx:} $x$ is a dog.
\item{Fxy:} $x$ is a friend of $y$.
\item{Oxy:} $x$ owns $y$.
\item{f:} Fifi
\item{g:} Gerald
\end{ekey}

\begin{earg}
\item[\ex{dog1}] Fifi is a dog.
\item[\ex{dog2}] Gerald is a dog owner.
\item[\ex{dog3}] Someone is a dog owner.
\item[\ex{dog4}] All of Gerald's friends are dog owners.
\item[\ex{dog5}] Every dog owner is the friend of a dog owner.
\end{earg}

Sentence \ref{dog1} is easy: $Df$.

Sentence \ref{dog2} can be paraphrased as, `There is a dog that Gerald owns.' This can be translated as $\exists x(Dx \eand Ogx)$.

Sentence \ref{dog3} can be paraphrased as, `There is some $y$ such that $y$ is a dog owner.' The subsentence `$y$ is a dog owner' is just like sentence \ref{dog2}, except that it is about $y$ rather than being about Gerald. So we can translate sentence \ref{dog3} as $\exists y \exists x(Dx \eand Oyx)$.
%(Although we could swap the $x$s and $y$s, it is important that we use two different variables here.)

Sentence \ref{dog4} can be paraphrased as, `Every friend of Gerald is a dog owner.' Translating part of this sentence, we get $\forall x(Fxg \eif\mbox{`$x$ is a dog owner'})$. Again, it is important to recognize that `$x$ is a dog owner' is structurally just like sentence \ref{dog2}. Since we already have an x-quantifier, we will need a different variable for the existential quantifier. Any other variable will do. Using $z$, sentence \ref{dog4} can be translated as $\forall x\bigl[Fxg \eif\exists z(Dz \eand Oxz)\bigr]$.

Sentence \ref{dog5} can be paraphrased as `For any $x$ that is a dog owner, there is a dog owner who is $x$'s friend.' Partially translated, this becomes $$\forall x\bigl[\mbox{$x$ is a dog owner}\eif\exists y(\mbox{$y$ is a dog owner}\eand Fxy)\bigr].$$ Completing the translation, sentence \ref{dog5} becomes $$\forall x\bigl[\exists z(Dz \eand Oxz)\eif\exists y\bigl(\exists z(Dz \eand Oyz)\eand Fxy\bigr)\bigr].$$

Consider this symbolization key and these sentences:
\begin{ekey}
\item[UD:] people
\item[Lxy:] $x$ likes $y$.
\item[i:] Imre.
\item[k:] Karl.
\end{ekey}
\begin{earg}
\item[\ex{likes1}]Imre likes everyone that Karl likes.
\item[\ex{likes2}]There is someone who likes everyone who likes everyone that he likes.
\end{earg}

Sentence \ref{likes1} can be partially translated as $\forall x(\mbox{Karl likes $x$}\eif\mbox{Imre likes $x$})$. This becomes $\forall x(Lkx\eif Lix)$.

Sentence \ref{likes2} is almost a tongue-twister. There is little hope of writing down the whole translation immediately, but we can proceed by small steps. An initial, partial translation might look like this: $$\exists x\ \mbox{everyone who likes everyone that $x$ likes is liked by $x$}$$
The part that remains in English is a universal sentence, so we translate further: $$\exists x\forall y(\mbox{$y$ likes everyone that $x$ likes}\eif\mbox{$x$ likes $y$}).$$
The antecedent of the conditional is structurally just like sentence \ref{likes1}, with $y$ and $x$ in place of Imre and Karl. So sentence \ref{likes2} can be completely translated in this way $$\exists x\forall y\bigl[\forall z(Lxz \eif Lyz) \eif Lxy\bigr]$$

When symbolizing sentences with multiple quantifiers, it is best to proceed by small steps. Paraphrase the English sentence so that the logical structure is readily symbolized in QL. Then translate piecemeal, replacing the daunting task of translating a long sentence with the simpler task of translating shorter formulae.

\section{Sentences of QL}

In this section, we provide a formal definition for a \emph{well-formed formula} (wff) and \emph{sentence} of QL.

\subsection{Expressions}
There are six kinds of symbols in QL:

\begin{center}
\begin{tabular}{|c|c|}
\hline
predicates & $A,B,C,\ldots,Z$\\
with subscripts, as needed & $A_1, B_1,Z_1,A_2,A_{25},J_{375},\ldots$\\
\hline
constants & $a,b,c,\ldots,w$\\
with subscripts, as needed & $a_1, w_4, h_7, m_{32},\ldots$\\
\hline
variables & $x,y,z$\\
with subscripts, as needed & $x_1, y_1, z_1, x_2,\ldots$\\
\hline
connectives & \enot,\eand,\eor,\eif,\eiff\\
\hline
parentheses&( , )\\
\hline
quantifiers& $\forall, \exists$\\
\hline
\end{tabular}
\end{center}

%copied from the definition for SL
We define an \define{expression of QL} as any string of symbols of QL. Take any of the symbols of QL and write them down, in any order, and you have an expression.

\subsection{Well-formed formulae}

By definition, a \define{term of QL} is either a constant or a variable.

An \define{atomic formula of QL} is an n-place predicate followed by $n$ terms.

Just as we did for SL, we will give a \emph{recursive} definition for a wff of QL. In fact, most of the definition will look like the definition of for a wff of SL: Every atomic formula is a wff, and you can build new wffs by applying the sentential connectives.

We could just add a rule for each of the quantifiers and be done with it. For instance: If \script{A} is a wff, then $\forall x\script{A}$ and $\exists x\script{A}$ are wffs. However, this would allow for bizarre sentences like $\forall x\exists x Dx$ and $\forall x Dw$. What could these possibly mean? We could adopt some interpretation of such sentences, but instead we will write the definition of a wff so that such abominations do not even count as well-formed.

In order for $\forall x\script{A}$ to be a wff, \script{A} must contain the variable $x$ and must not already contain an x-quantifier. $\forall x Dw$ will not count as a wff because `$x$' does not occur in $Dw$, and $\forall x \exists x Dx$ will not count as a wff because $\exists x Dx$ contains an x-quantifier

\begin{enumerate}
\item Every atomic formula is a wff.
\item If \script{A} is a wff, then $\enot\script{A}$ is a wff.
\item If \script{A} and \script{B} are wffs, then $(\script{A}\eand\script{B})$, is a wff.
\item If \script{A} and \script{B} are wffs, $(\script{A}\eor\script{B})$ is a wff.
\item If \script{A} and \script{B} are wffs, then $(\script{A}\eif\script{B})$ is a wff.
\item If \script{A} and \script{B} are wffs, then $(\script{A}\eiff\script{B})$ is a wff.
\item If \script{A} is a wff, \script{x} is a variable, \script{A} contains at least one occurrence of \script{x}, and \script{A} contains no \script{x}-quantifiers, then $\forall\script{x}\script{A}$ is a wff.
\item If \script{A} is a wff, \script{x} is a variable, \script{A} contains at least one occurrence of \script{x}, and \script{A} contains no \script{x}-quantifiers, then $\exists\script{x}\script{A}$ is a wff.
\item All and only wffs of QL can be generated by applications of these rules.
\end {enumerate}

Notice that the `\script{x}' that appears in the definition above is not the variable $x$. It is a \emph{meta-variable} that stands in for any variable of QL. So $\forall xAx$ is a wff, but so are $\forall yAy$, $\forall zAz$, $\forall x_4Ax_4$, and $\forall z_9Az_9$.

We can now give a formal definition for scope: The \define{scope} of a quantifier is the subformula for which the quantifier is the main logical operator.

%\nix{
%Consider the expression $\forall x(\exists y(Dy \eif Ex) \eand \exists y Ey)$. Is it a wff?

%The main logical operator of this expression is the universal quantifier $\forall x$. The scope of the universal quantifier is the subformula $(\exists y(Dy \eif Ex) \eand \enot\exists y Ey)$. It contains one occurrence of $x$ and no x-quantifier, so by rule 7 the entire thing is a wff if this subformula is.

%The main logical operator of the subformula is conjunction. By rule 3, it is a wff if both $\exists y(Dy \eif Ex)$ and $\exists y Ey$ are wffs.

%Consider just $\exists y Ey$. The main logical operator is the existential quantifier $\exists y$, and its scope is $Ey$. Since $Ey$ contains at least one occurrence of $y$ and no y-quantifier, $\exists y Ey$ is a wff by rule 8 if $Ey$ is a wff. Assuming that E is a one-place predicate, $Ey$ is a wff by rule 1.

%We have shown that $\exists y Ey$ is a wff. By similarly reasoning, we can show that $\exists y(Dy \eif Ex)$ is a wff. So, the whole expression is a wff.
%}

\subsection{Sentences}

A {sentence} is something that can be either true or false. In SL, every wff was a sentence. This will not be the case in QL. Consider the following symbolization key:
\begin{ekey}
\item[UD:] people
\item[Lxy:] $x$ loves $y$
\item[b:] Boris
\end{ekey}
Consider the expression $Lzz$. It is an atomic forumula: a two-place predicate followed by two terms. All atomic formula are wffs, so $Lzz$ is a wff. Does it mean anything? You might think that it means that $z$ loves himself, in the same way that $Lbb$ means that Boris loves himself. Yet $z$ is a variable; it does not name some person the way a constant would. The wff $Lzz$ does not tell us how to interpret $z$. Does it mean everyone? anyone? someone? If we had a z-quantifier, it would tell us how to interpret $z$. For instance, $\exists zLzz$ would mean that someone loves themselves.

Some formal languages treat a wff like $Lzz$ as implicitly having a universal quantifier in front. We will not do this for QL. If you mean to say that everyone loves themself, then you need to write the quantifier: $\forall zLzz$

In order to make sense of a variable, we need a quantifier to tell us how to interpret that variable. The scope of an x-quantifier, for instance, is the part of the formula where the quantifier tells how to interpret $x$.

In order to be precise about this, we define a \define{bound variable} to be an occurrence of a variable \script{x} that is within the scope of an \script{x}-quantifier. A \define{free variable} is an occurance of a variable that is not bound.

For example, consider the wff $\forall x(Ex \eor Dy) \eif \exists z(Ex \eif Lzx)$. The scope of the universal quantifier $\forall x$ is $(Ex \eor Dy)$, so the first $x$ is bound by the universal quantifier but the second and third $x$s are free. There is not y-quantifier, so the $y$ is free. The scope of the existential quantifier $\exists z$ is $(Ex \eif Lzx)$, so both occurrences of $z$ are bound by it.

We define a \define{sentence} of QL as a wff of QL that contains no free variables.

\subsection{Notational conventions}

We will adopt the same notational conventions that we did for SL (p.~\pageref{SLconventions}.) First, we may leave off the outermost parentheses of a formula. Second, we will use square brackets `[' and `]' in place of parentheses to increase the readability of formulae. Third, we will leave out parentheses between each pair of conjuncts when writing long series of conjunctions. Fourth, we will leave out parentheses between each pair of disjuncts when writing long series of disjunctions.

\section{Identity}
\label{sec.identity}

Consider this sentence:
\begin{earg}
\item[\ex{else1}] Pavel owes money to everyone else.
\end{earg}
Let the UD be people; this will allow us to translate `everyone' as a universal quantifier. Let $Oxy$ mean `$x$ owes money to $y$', and let $p$ mean Pavel. Now we can symbolize sentence \ref{else1} as $\forall x Opx$. Unfortunately, this translation has some odd consequences. It says that Pavel owes money to every member of the UD, including Pavel; it entails that Pavel owes money to himself. However, sentence \ref{else1} does not say that Pavel owes money to himself; he owes money to everyone \emph{else}. This is a problem, because $\forall x Opx$ is the best translation we can give of this sentence into QL.

The solution is to add another symbol to QL. The symbol `$=$' is a two-place predicate. Since it has a special logical meaning, we write it a bit differently: For two terms $t_1$ and $t_2$, $t_1=t_2$ is an atomic formula.

The predicate $x=y$ means `$x$ is identical to $y$.' This does not mean merely that $x$ and $y$ are indistinguishable or that all of the same predicates are true of them. Rather, it means that $x$ and $y$ are the very same thing.

When we write $x \neq y$, we mean that $x$ and $y$ are not identical. There is no reason to introduce this as an additional predicate. Instead, $x \neq y$ is an abbreviation of $\enot(x = y)$.

Now suppose we want to symbolize this sentence:
\begin{earg}
\item[\ex{else2}] Pavel is Mister Checkov.
\end{earg}
Let the constant $c$ mean Mister Checkov. Sentence \ref{else2} can be symbolized as $p=c$. This means that the constants $p$ and $c$ both refer to the same guy.

This is all well and good, but how does it help with sentence \ref{else1}? That sentence can be paraphrased as, `Everyone who is not Pavel is owed money by Pavel.' This is a sentence structure we already know how to symbolize: `For all $x$, if $x$ is not Pavel, then $x$ is owed money by Pavel.' In QL with identity, this becomes $\forall x (x\neq p \eif Opx)$.

In addition to sentences that use the word `else', identity will be helpful when symbolizing some sentences that contain the words `besides' and `only.' Consider these examples:

\begin{earg}
\item[\ex{else3}] No one besides Pavel owes money to Hikaru.
\item[\ex{else4}] Only Pavel owes Hikaru money.
\end{earg}

We add the constant $h$, which means Hikaru.

Sentence \ref{else3} can be paraphrased as, `No one who is not Pavel owes money to Hikaru.' This can be translated as $\enot\exists x(x\neq p \eand Oxh)$.

Sentence \ref{else4} can be paraphrased as, `Pavel owes Hikaru \emph{and} no one besides Pavel owes Hikaru money.' We have already translated one of the conjuncts, and the other is straightforward. Sentence \ref{else4} becomes $Oph \eand \enot\exists x(x\neq p \eand Oxh)$.

\subsection{Expressions of quantity}
We can also use identity to say how many things there are of a particular kind. For example, consider these sentences:
\begin{earg}
\item[\ex{atleast1}] There is at least one apple on the table.
\item[\ex{atleast2}] There are at least two apples on the table.
\item[\ex{atleast3}] There are at least three apples on the table.
\end{earg}
Let the UD be \emph{things on the table}, and let $Ax$ mean `$x$ is an apple.'

Sentence \ref{atleast1} does not require identity. It can be translated adequately as $\exists x Ax$: There is some apple on the table--- perhaps many, but at least one.

It might be tempting to also translate sentence \ref{atleast2} without identity. Yet consider the sentence $\exists x \exists y(Ax \eand Ay)$. It means that there is some apple $x$ in the UD and some apple $y$ in the UD. Since nothing precludes $x$ and $y$ from picking out the same member of the UD, this would be true even if there were only one apple. In order to make sure that there are two \emph{different} apples, we need an identity predicate. Sentence \ref{atleast2} needs to say that the two apples that exist are not identical, so it can be translated as $\exists x \exists y(Ax \eand Ay \eand x\neq y)$.

Sentence \ref{atleast3} requires talking about three different apples. It can be translated as $\exists x \exists y\exists z(Ax \eand Ay \eand Az \eand x\neq y \eand y\neq z \eand x \neq z)$.

Continuing in this way, we could translate `There are at least $n$ apples on the table.' There is a summary of how to symbolize sentences like these on p.~\pageref{summary.atleast}.

Now consider these sentences:
\begin{earg}
\item[\ex{atmost1}] There is at most one apple on the table.
\item[\ex{atmost2}] There are at most two apples on the table.
\end{earg}

Sentence \ref{atmost1} can be paraphrased as, `It is not the case that there are at least \emph{two} apples on the table.' This is just the negation of sentence \ref{atleast2}: $$\enot \exists x \exists y(Ax \eand Ay \eand x\neq y)$$
Sentence \ref{atmost1} can also be approached in another way. It means that any apples that there are on the table must be the selfsame apple, so it can be translated as $\forall x\forall y\bigl[(Ax \eand Ay) \eif x=y\bigr]$. The two translations are logically equivalent, so both are correct.

In a similar way, sentence \ref{atmost2} can be translated in two equivalent ways. It can be paraphrased as, `It is not the case that there are \emph{three} or more distinct apples', so it can be translated as the negation of sentence \ref{atleast3}. Using universal quantifiers, it can also be translated as
$$\forall x\forall y\forall z\bigl[(Ax \eand Ay \eand Az) \eif (x=y \eor x=z \eor y=z)\bigr].$$

See p.~\pageref{summary.atmost} for the general case.

The examples above are sentences about apples, but the logical structure of the sentences translates mathematical inequalities like $a\geq 3$, $a \leq 2$, and so on. We also want to be able to translate statements of equality which say exactly how many things there are. For example:
\begin{earg}
\item[\ex{exactly1}] There is exactly one apple on the table.
\item[\ex{exactly2}] There are exactly two apples on the table.
\end{earg}

Sentence \ref{exactly1} can be paraphrased as, `There is \emph{at least} one apple on the table, and there is \emph{at most} one apple on the table.' This is just the conjunction of sentence \ref{atleast1} and sentence \ref{atmost1}: $\exists x Ax \eand \forall x\forall y\bigl[(Ax \eand Ay) \eif x=y\bigr]$. This is a somewhat complicated way of going about it. It is perhaps more straightforward to paraphrase sentence \ref{exactly1} as, `There is a thing which is the only apple on the table.' Thought of in this way, the sentence can be translated $\exists x\bigl[Ax \eand \enot\exists y(Ay \eand x\neq y)\bigr]$.

Similarly, sentence \ref{exactly2} may be paraphrased as, `There are two different apples on the table, and these are the only apples on the table.' This can be translated as $\exists x\exists y\bigl[Ax \eand Ay \eand x\neq y \eand \enot\exists z(Az \eand x\neq z \eand y\neq z)\bigr]$.

Finally, consider this sentence:
\begin{earg}
\item[\ex{atmost2inUD}] There are at most two things on the table.
\end{earg}
It might be tempting to add a predicate so that $Tx$ would mean `$x$ is a thing on the table.' However, this is unnecessary. Since the UD is the set of things on the table, all members of the UD are on the table. If we want to talk about a \emph{thing on the table}, we need only use a quantifier. Sentence \ref{atmost2inUD} can be symbolized like sentence \ref{atmost2} (which said that there were at most two apples), but leaving out the predicate entirely. That is, sentence \ref{atmost2inUD} can be translated as $\forall x \forall y \forall z(x=y \eor x=z \eor y=z)$.

Techniques for symbolizing expressions of quantity (`at most', `at least', and `exactly') are summarized on p.~\pageref{summary.atleast}.

\subsection{Definite descriptions}
\label{subsec.defdesc}
Recall that a constant of QL must refer to some member of the UD. This constraint allows us to avoid the problem of non-referring terms. Given a UD that included only actually existing creatures but a constant $c$ that meant `chimera' (a mythical creature), sentences containing $c$ would become impossible to evaluate.

The most widely influential solution to this problem was introduced by Bertrand Russell in 1905. Russell asked how we should understand this sentence:
\begin{earg}
\item[\ex{defdesc1}] The present king of France is bald.
\end{earg}
The phrase `the present king of France' is supposed to pick out an individual by means of a definite description. However, there was no king of France in 1905 and there is none now. Since the description is a non-referring term, we cannot just define a constant to mean `the present king of France' and translate the sentence as $Kf$.

Russell's idea was that sentences that contain definite descriptions have a different logical structure than sentences that contain proper names, even though they share the same grammatical form. What do we mean when we use an unproblematic, referring description, like `the highest peak in Washington state'? We mean that there is such a peak, because we could not talk about it otherwise. We also mean that it is the only such peak. If there was another peak in Washington state of exactly the same height as Mount Rainier, then Mount Rainier would not be \emph{the} highest peak.

According to this analysis, sentence \ref{defdesc1} is saying three things. First, it makes an \emph{existence} claim: There is some present king of France. Second, it makes a \emph{uniqueness} claim: This guy is the only present king of France. Third, it makes a claim of \emph{predication}: This guy is bald.

In order to symbolize definite descriptions in this way, we need the identity predicate. Without it, we could not translate the uniqueness claim which (according to Russell) is implicit in the definite description.

Let the UD be \emph{people actually living}, let $Fx$ mean `$x$ is the present king of France', and let $Bx$ mean `$x$ is bald.' Sentence \ref{defdesc1} can then be translated as $\exists x\bigl[Fx \eand \enot\exists y(Fy \eand x\neq y) \eand Bx\bigr]$. This says that there is some guy who is the present king of France, he is the only present king of France, and he is bald.

Understood in this way, sentence \ref{defdesc1} is meaningful but false. It says that this guy exists, but he does not.

The problem of non-referring terms is most vexing when we try to translate negations. So consider this sentence:
\begin{earg}
\item[\ex{defdesc2}] The present king of France is not bald.
\end{earg}
According to Russell, this sentence is ambiguous in English. It could mean either of two things:
\begin{earg}
\item[\ref{defdesc2}a.] It is not the case that the present king of France is bald.
\item[\ref{defdesc2}b.] The present king of France is non-bald.
\end{earg}
Both possible meanings negate sentence \ref{defdesc1}, but they put the negation in different places.

Sentence \ref{defdesc2}a is called a \define{wide-scope negation}, because it negates the entire sentence. It can be translated as $\enot\exists x\bigl[Fx \eand \enot\exists y(Fy \eand x\neq y) \eand Bx\bigr]$. This does not say anything about the present king of France, but rather says that some sentence about the present king of France is false. Since sentence \ref{defdesc1} if false, sentence \ref{defdesc2}a is true.

Sentence \ref{defdesc2}b says something about the present king of France. It says that he lacks the property of baldness. Like sentence \ref{defdesc1}, it makes an existence claim and a uniqueness claim; it just denies the claim of predication. This is called \define{narrow-scope negation}. It can be translated as $\exists x\bigl[Fx \eand \enot\exists y(Fy \eand x\neq y) \eand \enot Bx\bigr]$. Since there is no present king of France, this sentence is false.

Russell's theory of definite descriptions resolves the problem of non-referring terms and also explains why it seemed so paradoxical. Before we distinguished between the wide-scope and narrow-scope negations, it seemed that sentences like \ref{defdesc2} should be both true and false. By showing that such sentences are ambiguous, Russell showed that they are true understood one way but false understood another way.

For a more detailed discussion of Russell's theory of definite descriptions, including objections to it, see Peter Ludlow's entry `descriptions' in \emph{The Stanford Encyclopedia of Philosophy}: Summer 2005 edition, edited by Edward N. Zalta, \url{http://plato.stanford.edu/archives/sum2005/entries/descriptions/}

%\fix{glossary?}
%free variable
%bound variable
%scope

\practiceproblems

%\solutions
%\problempart
%\label{pr.wiffQL}
%For each of the following: (a) Is it a wff of QL, allowing for notational conventions? (b) Is it a sentence of QL?
%\begin{earg}
%\item $\forall x\forall y[(Rxy \eand Ryx) \eif \exists zRzz]$
%\end{earg}

%\problempart
%\begin{earg}
%\item Are there any wffs of QL that contain more than one x-quantifier? If your answer is yes, give an example.
%\end{earg}

\solutions
\problempart
\label{pr.QLalligators}
Using the symbolization key given, translate each English-language sentence into QL.
\begin{ekey}
\item[UD:] all animals
\item[Ax:] $x$ is an alligator.
\item[Mx:] $x$ is a monkey.
\item[Rx:] $x$ is a reptile.
\item[Zx:] $x$ lives at the zoo.
\item[Lxy:] $x$ loves $y$.
\item[a:] Amos
\item[b:] Bouncer
\item[c:] Cleo
\end{ekey}
\begin{earg}
\item Amos, Bouncer, and Cleo all live at the zoo.
\item Bouncer is a reptile, but not an alligator.
\item If Cleo loves Bouncer, then Bouncer is a monkey.
\item If both Bouncer and Cleo are alligators, then Amos loves them both.
\item Some reptile lives at the zoo.
\item Every alligator is a reptile.
\item Any animal that lives at the zoo is either a monkey or an alligator.
\item There are reptiles which are not alligators.
\item Cleo loves a reptile.
\item Bouncer loves all the monkeys that live at the zoo.
\item All the monkeys that Amos loves love him back.
\item If any animal is a reptile, then Amos is.
\item If any animal is an alligator, then it is a reptile.
\item Every monkey that Cleo loves is also loved by Amos.
\item There is a monkey that loves Bouncer, but sadly Bouncer does not reciprocate this love.
\end{earg}

\problempart
\label{pr.BarbaraEtc}
These are syllogistic figures identified by Aristotle and his successors, along with their medieval names. Translate each argument into QL.
\begin{description}
\item[Barbara] All $B$s are $C$s. All $A$s are $B$s.
	\therefore\  All $A$s are $C$s.
\item[Baroco] All $C$s are $B$s. Some $A$ is not $B$.
	\therefore\  Some $A$ is not $C$.
\item[Bocardo] Some $B$ is not $C$. All $A$s are $B$s.
	\therefore\  Some $A$ is not $C$.
\item[Celantes] No $B$s are $C$s. All $A$s are $B$s.
	\therefore\  No $C$s are $A$s.
\item[Celarent] No $B$s are $C$s. All $A$s are $B$s.
	\therefore\  No $A$s are $C$s.
\item[Cemestres] No $C$s are $B$s. No $A$s are $B$s.
	\therefore\  No $A$s are $C$s.
\item[Cesare] No $C$s are $B$s. All $A$s are $B$s.
	\therefore\  No $A$s are $C$s.
\item[Dabitis] All $B$s are $C$s. Some $A$ is $B$.
	\therefore\  Some $C$ is $A$.
\item[Darii] All $B$s are $C$s. Some $A$ is $B$.
	\therefore\  Some $A$ is $C$.
\item[Datisi] All $B$s are $C$s. All $A$ is $C$.
	\therefore\  Some $A$ is $C$.
\item[Disamis] Some $A$ is $B$. All $A$s are $C$s.
	\therefore\  Some $B$ is $C$.
\item[Ferison] No $B$s are $C$s. Some $A$ is $B$.
	\therefore\  Some $A$ is not $C$.
\item[Ferio] No $B$s are $C$s. Some $A$ is $B$.
	\therefore\  Some $A$ is not $C$.
\item[Festino] No $C$s are $B$s. Some $A$ is $B$.
	\therefore\  Some $A$ is not $C$.
\item[Baralipton] All $B$s are $C$s. All $A$s are $B$s.
	\therefore\  Some $C$ is $A$.
\item[Frisesomorum] Some $B$ is $C$. No $A$s are $B$s.
	\therefore\  Some $C$ is not $A$.
\end{description}

\problempart Using the symbolization key given, translate each English-language sentence into QL.
\begin{ekey}
\item[UD:] all animals
\item[Dx:] $x$ is a dog.
\item[Sx:] $x$ likes samurai movies.
\item[Lxy:] $x$ is larger than $y$.
\item[b:] Bertie
\item[e:] Emerson
\item[f:] Fergis
\end{ekey}
\begin{earg}
\item Bertie is a dog who likes samurai movies.
\item Bertie, Emerson, and Fergis are all dogs.
\item Emerson is larger than Bertie, and Fergis is larger than Emerson.
\item All dogs like samurai movies.
\item Only dogs like samurai movies.
\item There is a dog that is larger than Emerson.
\item If there is a dog larger than Fergis, then there is a dog larger than Emerson.
\item No animal that likes samurai movies is larger than Emerson.
\item No dog is larger than Fergis.
\item Any animal that dislikes samurai movies is larger than Bertie.
\item There is an animal that is between Bertie and Emerson in size.
\item There is no dog that is between Bertie and Emerson in size.
\item No dog is larger than itself.
\item For every dog, there is some dog larger than it.
\item There is an animal that is smaller than every dog.
\item If there is an animal that is larger than any dog, then that animal does not like samurai movies.
\end{earg}

\problempart
\label{pr.QLarguments}
For each argument, write a symbolization key and translate the argument into QL.
\begin{earg}
\item Nothing on my desk escapes my attention. There is a computer on my desk. As such, there is a computer that does not escape my attention.
\item All my dreams are black and white. Old TV shows are in black and white. Therefore, some of my dreams are old TV shows.
\item Neither Holmes nor Watson has been to Australia. A person could see a kangaroo only if they had been to Australia or to a zoo. Although Watson has not seen a kangaroo, Holmes has. Therefore, Holmes has been to a zoo.
\item No one expects the Spanish Inquisition. No one knows the troubles I've seen. Therefore, anyone who expects the Spanish Inquisition knows the troubles I've seen.
\item An antelope is bigger than a bread box. I am thinking of something that is no bigger than a bread box, and it is either an antelope or a cantaloupe. As such, I am thinking of a cantaloupe.
\item All babies are illogical. Nobody who is illogical can manage a crocodile. Berthold is a baby. Therefore, Berthold is unable to manage a crocodile.
\end{earg}

\solutions
\problempart
\label{pr.QLcandies}
Using the symbolization key given, translate each English-language sentence into QL.
\begin{ekey}
\item[UD:] candies
\item[Cx:] $x$ has chocolate in it.
\item[Mx:] $x$ has marzipan in it.
\item[Sx:] $x$ has sugar in it.
\item[Tx:] Boris has tried $x$.
\item[Bxy:] $x$ is better than $y$.
\end{ekey}
\begin{earg}
\item Boris has never tried any candy.
\item Marzipan is always made with sugar.
\item Some candy is sugar-free.
\item The very best candy is chocolate.
\item No candy is better than itself.
\item Boris has never tried sugar-free chocolate.
\item Boris has tried marzipan and chocolate, but never together.
%\item Boris has tried nothing that is better than sugar-free marzipan.
\item Any candy with chocolate is better than any candy without it.
\item Any candy with chocolate and marzipan is better than any candy that lacks both.
\end{earg}

\problempart
Using the symbolization key given, translate each English-language sentence into QL.
\begin{ekey}
\item[UD:] people and dishes at a potluck
\item[Rx:] $x$ has run out.
\item[Tx:] $x$ is on the table.
\item[Fx:] $x$ is food.
\item[Px:] $x$ is a person.
\item[Lxy:] $x$ likes $y$.
\item[e:] Eli
\item[f:] Francesca
\item[g:] the guacamole
\end{ekey}
\begin{earg}
\item All the food is on the table.
\item If the guacamole has not run out, then it is on the table.
\item Everyone likes the guacamole.
\item If anyone likes the guacamole, then Eli does.
\item Francesca only likes the dishes that have run out.
\item Francesca likes no one, and no one likes Francesca.
\item Eli likes anyone who likes the guacamole.
\item Eli likes anyone who likes the people that he likes.
\item If there is a person on the table already, then all of the food must have run out.
\end{earg}

\solutions
\problempart
\label{pr.QLballet}
Using the symbolization key given, translate each English-language sentence into QL.
\begin{ekey}
\item[UD:] people
\item[Dx:] $x$ dances ballet.
\item[Fx:] $x$ is female.
\item[Mx:] $x$ is male.
\item[Cxy:] $x$ is a child of $y$.
\item[Sxy:] $x$ is a sibling of $y$.
\item[e:] Elmer
\item[j:] Jane
\item[p:] Patrick
\end{ekey}
\begin{earg}
\item All of Patrick's children are ballet dancers.
\item Jane is Patrick's daughter.
\item Patrick has a daughter.
\item Jane is an only child.
\item All of Patrick's daughters dance ballet.
\item Patrick has no sons.
\item Jane is Elmer's niece.
\item Patrick is Elmer's brother.
\item Patrick's brothers have no children.
\item Jane is an aunt.
\item Everyone who dances ballet has a sister who also dances ballet.
\item Every man who dances ballet is the child of someone who dances ballet.
\end{earg}

\problempart
\label{pr.freeQL}
Identify which variables are bound and which are free.
\begin{earg}
\item $\exists x Lxy \eand \forall y Lyx$
\item $\forall x Ax \eand Bx$
\item $\forall x (Ax \eand Bx) \eand \forall y(Cx \eand Dy)$
\item $\forall x\exists y[Rxy \eif (Jz \eand Kx)] \eor Ryx$
\item $\forall x_1(Mx_2 \eiff Lx_2x_1) \eand \exists x_2 Lx_3x_2$
\end{earg}

\problempart
Using the symbolization key given, translate each English-language sentence into QL with identity. The last sentence is ambiguous and can be translated two ways; you should provide both translations. (Hint: Identity is only required for the last four sentences.)
\begin{ekey}
\item[UD:] people
\item[Kx:] $x$ knows the combination to the safe.
\item[Sx:] $x$ is a spy.
\item[Vx:] $x$ is a vegetarian.
\item[Txy:] $x$ trusts $y$.
\item[h:] Hofthor
\item[i:] Ingmar
\end{ekey}
\begin{earg}
\item Hofthor is a spy, but no vegetarian is a spy.
\item No one knows the combination to the safe unless Ingmar does.
\item No spy knows the combination to the safe.
\item Neither Hofthor nor Ingmar is a vegetarian.
\item Hofthor trusts a vegetarian.
\item Everyone who trusts Ingmar trusts a vegetarian.
\item Everyone who trusts Ingmar trusts someone who trusts a vegetarian.
\item Only Ingmar knows the combination to the safe.
\item Ingmar trusts Hofthor, but no one else.
\item The person who knows the combination to the safe is a vegetarian.
\item The person who knows the combination to the safe is not a spy.
\end{earg}

\solutions
\problempart
\label{pr.QLcards}
Using the symbolization key given, translate each English-language sentence into QL with identity. The last two sentences are ambiguous and can be translated two ways; you should provide both translations for each.
\begin{ekey}
\item[UD:] cards in a standard deck
\item[Bx:] $x$ is black.
\item[Cx:] $x$ is a club.
\item[Dx:] $x$ is a deuce.
\item[Jx:] $x$ is a jack.
\item[Mx:] $x$ is a man with an axe.
\item[Ox:] $x$ is one-eyed.
\item[Wx:] $x$ is wild.
\end{ekey}
\begin{earg}
\item All clubs are black cards.
\item There are no wild cards.
\item There are at least two clubs.
\item There is more than one one-eyed jack.
\item There are at most two one-eyed jacks.
\item There are two black jacks.
\item There are four deuces.
\item The deuce of clubs is a black card.
\item One-eyed jacks and the man with the axe are wild.
\item If the deuce of clubs is wild, then there is exactly one wild card.
\item The man with the axe is not a jack.
\item The deuce of clubs is not the man with the axe.
\end{earg}

\problempart Using the symbolization key given, translate each English-language sentence into QL with identity. The last two sentences are ambiguous and can be translated two ways; you should provide both translations for each.
\begin{ekey}
\item[UD:] animals in the world
\item[Bx:] $x$ is in Farmer Brown's field.
\item[Hx:] $x$ is a horse.
\item[Px:] $x$ is a Pegasus.
\item[Wx:] $x$ has wings.
\end{ekey}
\begin{earg}
\item There are at least three horses in the world.
\item There are at least three animals in the world.
\item There is more than one horse in Farmer Brown's field.
\item There are three horses in Farmer Brown's field.
\item There is a single winged creature in Farmer Brown's field; any other creatures in the field must be wingless.
\item The Pegasus is a winged horse.
\item The animal in Farmer Brown's field is not a horse.
\item The horse in Farmer Brown's field does not have wings.
\end{earg}


\documentclass[11pt,a4paper]{article}

% These are extra packages that you might need for writing the equations:
\usepackage{amsmath}
\usepackage{amsfonts}
\usepackage{amssymb}
\usepackage{booktabs}
\usepackage{hyperref}
\usepackage{listings}
\usepackage{xcolor}
\usepackage{graphicx}
\usepackage{subfig}
\usepackage{float}
\usepackage{outlines}

\lstset {language=C++,
		 basicstyle=\ttfamily,
         keywordstyle=\color{blue}\ttfamily,
         stringstyle=\color{red}\ttfamily,
         commentstyle=\color{purple}\ttfamily,
         morecomment=[l][\color{magenta}]{\#},
       	 basicstyle=\tiny}

% You need the following package in order to include figures in your report:
\usepackage{graphicx}

% With this package you can set the size of the margins manually:
\usepackage[left=2cm,right=2cm,top=2cm,bottom=2cm]{geometry}

\begin{document}

% Enter the exercise number, your name and date here:
\noindent\parbox{\linewidth}{
 \parbox{.25\linewidth}{ \large ICP, Exercise 07 }\hfill
 \parbox{.5\linewidth}{\begin{center} \large Beat Hubmann \end{center}}\hfill
 \parbox{.2\linewidth}{\begin{flushright} \large Nov 11, 2018 \end{flushright}}
}
\noindent\rule{\linewidth}{2pt}

\section{Introduction}

A limited diffusion aggregation (DLA) algorithm was implemented on a 2D lattice.
The aggregation behaviour for different simulation parameters was observed.

\section{Algorithm Description}
The algorithm was implemented in continuous space with wraparound borders and a central aggregation seed.
Random walking particles change heading and speed at each step. Their coordinates get projected to the lattice only
when checking for coalescence. Particles enter the system at a random location on the lattice border (i.e. on any of the
four sides). To limit simulation time, particle lifetime is a simulation parameter; if no contact with the aggregating cluster
is made after this set amount of steps, the particle expires and a new one is launched.\\
The algorithm works along the following principle:
\begin{outline}
    \1 for $n$ particles do:
     \2 randomly pick starting site along lattice boundary
     \2 randomly pick starting heading
     \2 while not in direct vicinity of aggreggating cluster and while age smaller than lifetime do:
        \3 randomly change heading
        \3 randomly change velocity
        \3 walk one timestep to new position
        \3 check and record cluster vicinity
        \3 increase age
    \1 draw final lattice state

\end{outline}

\section{Results}

The program was implemented as described above and submitted with this report.
As expected, the cluster grows outward from the seed in random tree-like structures. The occupation probability grows
as the cluster grows toward the lattice edges containing the release points (see figure~\ref{fig:1} as an example).\\

Applying 'noise reduction' by requiring $m$ visits to a site before the site gets occupied makes the cluster denser with
increasing $m$ (see figure~\ref{fig:2}).

\begin{figure}
\begin{center}
\includegraphics[scale=0.4]{fig_1.png}
\end{center}
\caption{DLA cluster on 2D lattice with side length $L=400$, particle lifetime $100000$ steps, particle count $20000$, noise reduction $m=0$, center seed.}
\label{fig:1}
\end{figure}

\begin{figure}
    \begin{center}
    \begin{tabular}{cc}
    \subfloat[m=2]{\includegraphics[width = 2.0in]{fig_2_0.png}} &
    \subfloat[m=4]{\includegraphics[width = 2.0in]{fig_2_1.png}} \\
    \subfloat[m=6]{\includegraphics[width = 2.0in]{fig_2_2.png}} &
    \subfloat[m=8]{\includegraphics[width = 2.0in]{fig_2_3.png}}
    \end{tabular}
\end{center}
    \caption{Different noise reduction parameters $m$ for DLA cluster on 2D lattice with side length $L=200$, particle lifetime $100000$ steps, particle count $10000$, center seed.}
\label{fig:2}
\end{figure}

\section{Discussion}
In general, the algorithm yields the results expected from theory. As I wanted to go for 'true' randomness and not inject
particles near the cluster boundary as suggested by the task statement to improve runtime, rather long lifetimes were necessary for particles to be
reasonbly likely to make it to the center seed.

\pagebreak
\begin{thebibliography}{99}

\bibitem{herrmann}
	Herrmann, H. J.,
	Singer, H. M.,
	Mueller L.,
	Buchmann, M.-A.,\\
	\emph{Introduction to Computational Physics - Lecture Notes},\\
	ETH Zurich,\\
	2017.

\end{thebibliography}

\end{document}