%% LyX 1.1 created this file.  For more info, see http://www.lyx.org/.
%% Do not edit unless you really know what you are doing.
\documentclass[english]{article}
\usepackage[T1]{fontenc}
\usepackage[latin1]{inputenc}
\usepackage{amsmath}
\usepackage{babel}
\usepackage{amssymb}

\makeatletter

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% LyX specific LaTeX commands.
\providecommand{\LyX}{L\kern-.1667em\lower.25em\hbox{Y}\kern-.125emX\@}

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% User specified LaTeX commands.
\usepackage{ccfonts}
\usepackage{fullpage}
\usepackage{endnotes}
\renewcommand{\bfseries}{\scshape}
\renewcommand{\footnote}{\endnote}

\makeatother
\begin{document}

\title{CSC165H, Mathematical expression and reasoning for computer science\\
week 4}

\maketitle
Gary Baumgartner and Danny Heap

heap@cs.toronto.edu

SF4306A

416-978-5899

http://www.cs.toronto.edu/\textasciitilde{}heap/165/S2005/index.shtml


\section*{Those superscripts}

In these course summaries you'll often find superscripts.%
\footnote{Like this.
} These often indicate answers to questions worked out in lecture,
and through the wonders of word processing, those answers are formatted
as endnotes (at the end of the document). My motivation isn't so much
to give you whiplash moving your gaze between the question and the
answer, as to allow you to form your own answer before looking at
my version.


\section*{Multiple quantifiers}

Many sentences we want to reason about have a mixture of predicates.
For example

\begin{description}
\item [Claim~1:]Some female employee makes more than 25,000.
\end{description}
We can make a few definitions, so let \( E \) be the set of employees,
\( \mathbf{Z} \) be the integers, \( \mathbf{sm}(e,k) \) be \( e \)
makes a salary of more than \( k \), and \( \mathbf{f}(e) \) be
\( e \) is female. Now I could rewrite:

\begin{description}
\item [Claim~1':]\( \exists e\in E,\mathbf{f}(x)\wedge \mathbf{sm}(e,25000) \).
\end{description}
It seems a bit inflexible to combine \( e \) making a salary, and
an inequality comparing that salary to 25000, particularly since we
already have a vocabulary of predicates for comparing numbers. We
can refine the above expression so that we let \( \mathbf{s}(e,k) \)
be \( e \) makes salary \( k \). Now I can rewrite again:

\begin{description}
\item [Claim~1'':]\( \exists e\in E,\exists k\in \mathbf{Z},\, \, \mathbf{f}(x)\wedge \mathbf{s}(e,k)\wedge k>25000 \).
\end{description}
Notice that the following are all equivalent to Claim~1''%
\footnote{\begin{eqnarray*}
\exists k\in \mathbf{Z},\, \, \exists e\in E,\mathbf{f}(e)\wedge \mathbf{s}(e,k)\wedge k>25000 & \\
\exists e\in E,\, \, \mathbf{f}(e)\wedge (\exists k\in \mathbf{Z},\mathbf{s}(e,k)\wedge k>25000) &  & \\
\exists e\in E,\, \, \mathbf{f}(e)\wedge (\exists k\in \mathbf{Z},\, \, \mathbf{s}(e,k)\wedge k>25000) &  & 
\end{eqnarray*}

}:

So \( \wedge  \) is commutative and associative, and the two existential
quantifiers commute.


\section*{And}

We use \( \wedge  \) ({}``and'') to combine two sentences into
a new sentence that claims that both of the original sentences are
true. In our employee database:

\begin{description}
\item [Claim~2:]The employee makes less than 75,000 and more than 25,000.
\end{description}
Claim 2 is true for Al (who makes 60,000), but false for Betty (who
makes 500). If we identify the sentences with predicates that test
whether objects are members of sets, then the new \( \wedge  \) predicate
tests whether somebody is in both the set of employees who makes less
than 75,000 and the set of employees who make more than 25,000 ---
in other words, in the intersection. Is it a coincidence that \( \wedge  \)
resembles \( \cap  \)(only more pointy)?

We need to be careful with everyday language where the conjunction
{}``and'' is used not only to join sentences, but also to {}``smear''
a subject over a compound predicate. In the following sentence the
subject {}``There'' is smeared over {}``pen'' and {}``telephone:''

\begin{description}
\item [Claim~3:]There is a pen and a telephone.
\end{description}
If we let \( O \) be the set of objects, \( p(x) \) mean \( x \)
is a pen, and \( t(x) \) mean \( x \) is a telephone, then the obvious
meaning of Claim~3 is%
\footnote{\( \exists x\in O,\, \, p(x)\wedge \exists x\in O,\, \, t(x) \),
or even \( \exists x\in O,\, \exists y\in O,\, p(x)\wedge q(x) \).
} (There is a pen and there is a telephone). But a pedant who has been
observing the trend where phones become increasingly smaller and difficult
to use might think Claim~3 means:%
\footnote{\( \exists x\in O,\, \, p(x)\wedge t(x) \)
} (There is a pen-phone).

Here's another example whose ambiguity is all the more striking since
it appears in a context (mathematics) where one would expect ambiguity
to be sharply restricted.

\begin{quote}
The solutions are:

\( x<10 \) and \( x>20 \)

\( x>10 \) and \( x<20 \)
\end{quote}
In the first case the author means the union of two sets in the first
case, and the intersection in the second. We use \( \wedge  \) in
the second case, and disjunction \( \vee  \) ({}``or'') in the
first case.


\section*{Or}

The disjunction {}``or'' (written symbolically as \( \vee  \))
joins two sentence into one that claims that at least one of the sentences
is true. For example

\begin{quote}
The employee is female or makes less than 45,000.
\end{quote}
This sentence is true for Flo (she makes 20,000 and is female), for
Carlos (who makes less than 45,000), but false for Al (he's neither
female, nor does he make less than 45,000). If we viewed this {}``or'ed''
sentence as a predicate testing whether somebody belonged to at least
one of {}``the set of employees who are female'' or {}``the set
of employees who earn less than 45,000,'' then it corresponds to
the union. As a mnemonic, the symbols \( \vee  \) and \( \cup  \)
resemble each other.

We use \( \vee  \) to include the case where more than one of the
properties is true, that is we use an inclusive or. In everyday English
we sometimes say {}``and/or'' to specify the same thing that this
course uses {}``or'' for, since the meaning of {}``or'' can vary
in English. The sentence {}``Either we play the game my way, or I'm
taking my ball and going home now,'' doesn't include both possibilities. 


\section*{DeMorgan's Laws}

These laws can be verified either by a truth table, or by representing
the sentences as Venn diagrams and taking the complement.

Sentence \( s_{1}\wedge s_{2} \) is false exactly when at least one
of \( s_{1} \) or \( s_{2} \) is false. Symbolically:%
\footnote{\( \neg (s_{1}\wedge s_{2})\Leftrightarrow (\neg s_{1}\vee \neg s_{2}) \)
}

Sentence \( s_{1}\vee s_{2} \) is false exactly when both \( s_{1} \)
and \( s_{2} \) are false. Symbolically:%
\footnote{\( \neg (s_{1}\vee s_{2})\Leftrightarrow (\neg s_{1}\wedge \neg s_{2}) \)
} By using the associativity of \( \wedge  \) and \( \vee  \), you
can extend this to conjunctions and disjunctions of more than two
sentences.


\section*{Logical arithmetic}

If we identify \( \wedge  \) and \( \vee  \) with set intersection
and union, it is clear that they are associative and commutative,
so

\begin{quote}
\( P\wedge Q\Leftrightarrow Q\wedge P \) and \( P\vee Q\Leftrightarrow Q\vee P \)

\( P\wedge (Q\wedge R)\Leftrightarrow (P\wedge Q)\wedge R \) and
\( P\vee (Q\vee R)\Leftrightarrow (P\vee Q)\vee R \)
\end{quote}
Maybe a bit more surprising is that we have distributive laws for
each operation over the other:

\begin{quote}
\( P\wedge (Q\vee R)\Leftrightarrow (P\wedge Q)\vee (P\wedge R) \)

\( P\vee (Q\wedge R)\Leftrightarrow (P\vee Q)\wedge (P\vee R) \)
\end{quote}
We can also simplify expressions using \textbf{identity} and \textbf{idempotency}
laws:

\begin{description}
\item [identity:]\( P\wedge (Q\vee \neg Q)\Leftrightarrow P\Leftrightarrow P\vee (Q\wedge \neg Q) \).
\item [idempotency:]\( P\wedge P\Leftrightarrow P\Leftrightarrow P\vee P \)
\end{description}

\section*{Mixed quantifiers}

If you mix the order of existential and universal quantifiers, you
may change the meaning of a sentence. Consider the table below that
shows who respects who

{\centering \begin{tabular}{|c|c|c|c|c|c|c|}
\hline 
&
\textbf{A}&
\textbf{B}&
\textbf{C}&
\textbf{D}&
\textbf{E}&
\textbf{F}\\
\hline
\hline 
\textbf{A}&
\( \diamond  \)&
&
&
&
&
\\
\hline 
\textbf{B}&
&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)\\
\hline 
\textbf{C}&
&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)\\
\hline 
\textbf{D}&
&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
\\
\hline 
\textbf{E}&
&
\( \diamond  \)&
\( \diamond  \)&
\( \diamond  \)&
&
\\
\hline 
\textbf{F}&
&
\( \diamond  \)&
\( \diamond  \)&
&
&
\\
\hline
\end{tabular}\par}

If we want to discuss this table symbolically, we can denote the domain
of people by \( P \), and the predicate {}``\( x \) respects \( y \)''
by \( r(x,y) \). Consider the following open sentence:

\begin{description}
\item [Claim~4:]\( \exists x\in P,\, \, r(x,y) \), that is {}``y is respected
by somebody.''
\end{description}
If we pre-pended the universal quantifier \( \forall y\in P \) to
Claim 4, would it be true? As usual, check each element of the domain,
column-wise, to see that it is%
\footnote{True, theres a diamond in every column.
} Symbolically 

\begin{description}
\item [Claim~5:]\( \forall y\in P,\exists x\in P,r(x,y) \),
\end{description}
or {}``Everybody has somebody who respects him/her.'' You can have
different \( x \)'s depending on the \( y \), so although every
column has a diamond in some row, it need not be the same row for
each column. What would the predicate be that claims that some row
works for each column, that a row is full of diamonds?%
\footnote{If we were thinking of the row corresponding to \( x \), then \( \forall y\in P,\, r(x,y) \).
} Now we have to check whether there is someone who respects everyone:

\begin{description}
\item [Claim~6:]\( \exists x\in P,\forall y\in P,\, \, r(x,y) \)
\end{description}
You will find no such row. The only difference between Claim~5 and
Claim~6 is the order of the quantifiers. The convention we follow
is to read quantifiers from left to right. The existential quantifier
involves making a choice, and the choice may vary according to the
quantifiers we have already parsed. As we move right, we have the
opportunity to tailor our choice with an existential quantifier (but
we aren't obliged to).


\section*{Implication, bi-implication, with \protect\( \neg ,\vee ,\protect \)
and \protect\( \wedge \protect \)}

If we shade a Venn diagram so that the largest possible portion of
it is shaded without contradicting the implication \( P\Rightarrow Q \),
we gain some insight into how to express implication in terms of negation
and union. The region that we can choose object \( x \) from so that
\( P(x)\Rightarrow Q(x) \) is \( \neg P\cup Q \) (if we interpret
\( \neg P \) as the complement of \( P \)), and this easily translates
to \( \neg P\vee Q \). This gives us an equivalence:

\begin{quote}
\( (P\Rightarrow Q)\Leftrightarrow (\neg P\vee Q) \)
\end{quote}
Now use DeMorgan's law to negate the implication:

\begin{quote}
\( \neg (P\Rightarrow Q)\Leftrightarrow \neg (\neg P\vee Q)\Leftrightarrow (\neg \neg P\wedge \neg Q)\Leftrightarrow (P\wedge \neg Q) \)
\end{quote}
You can use a Venn diagram or some of the laws introduced earlier
to show that bi-implication can be written with \( \wedge \,\vee  \),
and \( \neg  \):

\begin{quote}
\( (P\Leftrightarrow Q)\Leftrightarrow ((P\wedge Q)\vee (\neg P\wedge \neg Q)) \)
\end{quote}
DeMorgan's law tells us how to negate this:

\begin{quote}
\( \neg (P\Leftrightarrow Q)\Leftrightarrow \neg ((P\wedge Q)\vee (\neg P\wedge \neg Q))\Leftrightarrow \cdots \Leftrightarrow ((\neg P\wedge Q)\vee (P\wedge \neg Q)) \)
\end{quote}

\section*{Moving negation in}

Sometimes things become clearer when negation applies directly to
the simplest predicates we are discussing. Consider

\begin{description}
\item [Claim~6:]\( \forall x,\exists y,P(x,y) \)
\end{description}
What does it mean for Claim 6 to be false, i.e. \( \neg (\forall x,\exists y,P(x,y)) \)?
It means there is some \( x \) for which the remainder of the sentence
is false:

\begin{quote}
\( \neg (\forall x,\exists y,P(x,y)\Leftrightarrow \exists x,\neg \exists y,P(x,y) \)
\end{quote}
So now what does the negated sub-sentence mean? It means there are
no \( y \)'s for which the remainder of the sentence is true:

\begin{quote}
\( \exists x,\neg \exists y,P(x,y)\Leftrightarrow \exists x,\forall y,\neg P(x,y) \)
\end{quote}
There is some \( x \) that for every \( y \) makes \( P(x,y) \)
false. As negation (\( \neg ) \) move from left to right, it flips
universal quantification to existential quantification, and vice versa.
Try it on the symmetrical counterpart \( \exists x,\forall y,P(x,y) \),
and consider

\begin{quote}
\( \neg (\exists x,\forall y,P(x,y))\Leftrightarrow \forall x,\neg \forall y,P(x,y) \)
\end{quote}
If it's not true that there exists an \( x \) such that the remainder
of the sentence is true, then for all \( x \) the remainder of the
sentence is false. Considering the remaining subsentence, if it's
not true that for all \( y \) the remainder of the subsentence is
true, then there is some \( y \) for which it is false:

\begin{quote}
\( \neg (\exists x,\forall y,P(x,y))\Leftrightarrow \forall x,\exists y,\neg P(x,y) \)
\end{quote}
For every \( x \) there is some \( y \) that makes \( P(x,y) \)
false.

Try combining this with implication, using the rule we discussed earlier,
plus DeMorgan's law:

\begin{quote}
\( \neg (\exists x,\forall y(P(x)\Rightarrow Q(x)))\Leftrightarrow \neg (\exists x,\forall y(\neg P(x)\vee Q(y))) \)
\end{quote}
\newpage

\begingroup

\setlength{\parindent}{0pt}

\setlength{\parskip}{2ex}

\renewcommand{\enotesize}{\normalsize}

\theendnotes\endgroup
\end{document}

