%!TEX root = forallxcam.tex
\part{Truth tables}
\label{ch.TruthTables}

\chapter{Characteristic truth tables}\label{s:CharacteristicTruthTables}
Any non-atomic sentence of TFL is composed of atomic sentences with sentential connectives. The truth value of the compound sentence depends only on the truth value of the atomic sentences that comprise it. In order to know the truth value of `$(D \eand E)$', for instance, you only need to know the truth value of `$D$' and the truth value of `$E$'.

I introduced five connectives in chapter \ref{ch.TFL}. So I just need to explain how they map between truth values. For convenience, I abbreviate `True' with `T' and `False' with `F'. (But, to be clear, the two truth values are True and False; the truth values are not \emph{letters}!)

\paragraph{Negation.} For any sentence \meta{A}: If \meta{A} is true, then \enot\meta{A} is false; and if \enot\meta{A} is true, then \meta{A} is false. We can summarize this in the \emph{characteristic truth table} for negation:
\begin{center}
\begin{tabular}{c|c}
\meta{A} & \enot\meta{A}\\
\hline
T & F\\
F & T
\end{tabular}
\end{center}

\paragraph{Conjunction.} For any sentences \meta{A} and \meta{B}, \meta{A}\eand\meta{B} is true if and only if both \meta{A} and \meta{B} are true. We can summarize this in the {characteristic truth table} for conjunction:
\begin{center}
\begin{tabular}{c c |c}
\meta{A} & \meta{B} & $\meta{A}\eand\meta{B}$\\
\hline
T & T & T\\
T & F & F\\
F & T & F\\
F & F & F
\end{tabular}
\end{center}
Note that conjunction is \emph{symmetrical}. The truth value for $\meta{A} \eand \meta{B}$ is always the same as the truth value for $\meta{B} \eand \meta{A}$.

\paragraph{Disjunction.} Recall that `$\eor$' always represents inclusive or. So, for any sentences \meta{A} and \meta{B}, $\meta{A}\eor \meta{B}$ is true if and only if either \meta{A} or \meta{B} is true. We can summarize this in the {characteristic truth table} for disjunction:
\begin{center}
\begin{tabular}{c c|c}
\meta{A} & \meta{B} & $\meta{A}\eor\meta{B}$ \\
\hline
T & T & T\\
T & F & T\\
F & T & T\\
F & F & F
\end{tabular}
\end{center}
Like conjunction, disjunction is symmetrical.

\paragraph{Conditional.} I'm just going to come clean and admit it: conditionals are a big old mess in TFL. Exactly how much of a mess they are is a matter of \emph{philosophical} contention. I shall discuss a few of the subtleties  in \S\S\ref{s:IndicativeSubjunctive} and \ref{s:ParadoxesOfMaterialConditional}. For now, I am going to stipulate the following: $\meta{A}\eif\meta{B}$ is false if and only if \meta{A} is true and \meta{B} is false. We can summarize this with a characteristic truth table for the conditional.
\begin{center}
\begin{tabular}{c c|c}
\meta{A} & \meta{B} & $\meta{A}\eif\meta{B}$\\
\hline
T & T & T\\
T & F & F\\
F & T & T\\
F & F & T
\end{tabular}
\end{center}
The conditional is \emph{asymmetrical}. You cannot swap the antecedent and consequent without changing the meaning of the sentence; $\meta{A}\eif\meta{B}$ and $\meta{B} \eif \meta{A}$ have different truth tables.

\paragraph{Biconditional.} Since a biconditional is to be the same as the conjunction of a conditional running in both directions, the truth table for the biconditional should be:
\begin{center}
\begin{tabular}{c c|c}
\meta{A} & \meta{B} & $\meta{A}\eiff\meta{B}$\\
\hline
T & T & T\\
T & F & F\\
F & T & F\\
F & F & T
\end{tabular}
\end{center}
Unsurprisingly, the biconditional is symmetrical.

\chapter{Truth-functional connectives}\label{s:TruthFunctionality}

\section{The idea of truth-functionality}
I want to introduce an important idea.
	\factoidbox{
		A connective is \define{truth-functional} iff the truth value of a sentence with that connective as its main logical operator is uniquely determined by the truth value(s) of the constituent sentence(s).
	}
Every connective in TFL is truth-functional. The truth value of a negation is uniquely determined by the truth value of the unnegated sentence. The truth value of a conjunction is uniquely determined by the truth value of both conjuncts. The truth value of a disjunction is uniquely determined by the truth value of both disjuncts. And so on. To determine the truth value of some TFL sentence, we only need to know the truth value of its components.

This is what gives TFL its name: it is \emph{truth-functional logic}.

Many languages use connectives that are not truth-functional. In English, for example, we can form a new sentence from any simpler sentence by prefixing it with `It is necessarily the case that\ldots'. The truth value of this new sentence is not fixed solely by the truth value of the original sentence. For consider two true sentences:
	\begin{earg}
		\item $2 + 2 = 4$
		\item Shostakovich wrote fifteen string quartets
	\end{earg}
Whereas it is necessarily the case that $2 + 2 = 4$, it is not \emph{necessarily} the case that Shostakovich wrote fifteen string quartets. If Shostakovich had died earlier, he would have failed to finish Quartet no.\ 15; if he had lived longer, he might have written a few more. So `It is necessarily the case that\ldots' is not \emph{truth-functional}.

\section{Symbolising versus translating}
All of the connectives of TFL are truth-functional. But more than that: they really do nothing \emph{but} map us between truth values.

When we symbolise a sentence or an argument in TFL, we ignore everything \emph{besides} the contribution that the truth values of a component might make to the truth value of the whole. There are subtleties to our ordinary claims that far outstrip their mere truth values. Sarcasm; poetry; snide implicature; emphasis; these are important parts of everyday discourse. But none of this is retained in TFL. As remarked in \S\ref{s:TFLConnectives}, TFL cannot capture the subtle differences between the following English sentences:
	\begin{earg}
		\item Jon is fat and Jon is quick
		\item Although Jon is fat, Jon is quick
		\item Despite being fat, Jon is quick
		\item Jon is quick, albeit fat
		\item Jon's fatness notwithstanding, he is quick
	\end{earg}
All of the above sentences will be symbolised with the same TFL sentence, perhaps `$F \eand Q$'.

Now, I keep saying that we use TFL sentences to \emph{symbolise} English sentences. Many other textbooks talk about \emph{translating} English sentences into TFL. But a good translation should preserve certain facets of meaning, and---as we just saw---TFL cannot do that. This is why I speak of \emph{symbolising} English sentences, rather than of \emph{translating} them.

This affects how you should understand symbolisation keys. Consider a key like:
	\begin{ekey}
		\item[F] Jon is fat.
		\item[Q] Jon is quick.
	\end{ekey}
Other textbooks will understand this as a stipulation that the TFL sentence `$F$' should \emph{mean} that Jon is fat, and that the TFL sentence `$Q$' should \emph{mean} that Jon is quick. But TFL just is totally unequipped to deal with \emph{meaning}. The preceding symbolisation key is doing no more nor less than stipulating truth values for the TFL sentences `$F$'  and `$Q$'. We are laying down that `$F$' should be true if Jon is fat (and false otherwise), and that `$Q$' should be true if Jon is quick (and false otherwise.)
	\factoidbox{
		When we treat a TFL sentence as \emph{symbolising} some English sentence, we are simply stipulating a truth value for that TFL sentence.
	}

\section{Indicative versus subjunctive conditionals}\label{s:IndicativeSubjunctive}
To bring home the point that TFL can \emph{only} deal with truth functions, I want to say a little bit about conditionals. When I introduced the characteristic truth table for the material conditional in \S\ref{s:CharacteristicTruthTables}, I did not say anything to justify it. Let me now offer a justification, which follows Dorothy Edgington.\footnote{Dorothy Edgington, `Conditionals', 2014, in the \emph{Stanford Encyclopedia of Philosophy} (\url{http://plato.stanford.edu/entries/conditionals/}).}

Suppose that Lara has drawn some shapes on a piece of paper, and coloured some of them in. I have not seen them, but I claim:
	\begin{quote}
		If any shape is grey, then that shape is also circular.
	\end{quote}
As it happens, Lara has drawn the following:
\begin{center}
\begin{tikzpicture}
	\node[circle, grey_shape] (cat1) {A};
	\node[right=10pt of cat1, diamond, phantom_shape] (cat2)  { } ;
	\node[right=10pt of cat2, circle, white_shape] (cat3)  {C} ;
	\node[right=10pt of cat3, diamond, white_shape] (cat4)  {D};
\end{tikzpicture}
\end{center}
In this case, my claim is surely true.  Shapes C and D are not grey, and so can hardly present \emph{counterexamples} to my claim. Shape A \emph{is} grey, but fortunately it is also circular. So my claim has no counterexamples. It must be true. And that means that each of the following \emph{instances} of my claim must be true too:
	\begin{ebullet}
		\item If A is grey, then it is circular \hfill (true antecedent, true consequent)
		\item If C is grey, then it is circular\hfill (false antecedent, true consequent)
		\item If D is grey, then it is circular \hfill (false antecedent, false consequent)
	\end{ebullet}
However, if Lara had drawn a fourth shape, thus:
\begin{center}
\begin{tikzpicture}
	\node[circle, grey_shape] (cat1) {A};
	\node[right=10pt of cat1, diamond, grey_shape] (cat2)  {B};
	\node[right=10pt of cat2, circle, white_shape] (cat3)  {C};
	\node[right=10pt of cat3, diamond, white_shape] (cat4)  {D};
\end{tikzpicture}
\end{center}
then my claim would have been false. So this claim must also be false:
	\begin{ebullet}
		\item If B is grey, then it is a circular \hfill (true antecedent, false consequent)
	\end{ebullet}
Now, recall that every connective of TFL has to be truth-functional. This means that the mere truth value of the antecedent and consequent must uniquely determine the truth value of the conditional as a whole. Thus, from the truth values of our four claims---which provide us with all possible combinations of truth and falsity in antecedent and consequent---we can read off the truth table for the material conditional.

What this argument shows is that `$\eif$' is the \emph{only} candidate for a truth-functional conditional. Otherwise put, \emph{it is the best conditional that TFL can provide}. But is it any good, as a surrogate for the conditionals we use in everyday language? Consider two sentences:
	\begin{earg}
		\item[\ex{brownwins1}] If Hillary Clinton had won the 2016 US election, then she would have been the first female president of the US.
		\item[\ex{brownwins2}] If Hillary Clinton had won the 2016 US election, then she would have turned into a helium-filled balloon and floated away into the night sky.
	\end{earg}
Sentence \ref{brownwins1} is true; sentence \ref{brownwins2} is false. But both have false antecedents and false consequents. (Hillary did not win; she did not become the first female president of the US; and she did not fill with helium and float away.) So the truth value of the whole sentence is not uniquely determined by the truth value of the parts.

The crucial point is that sentences \ref{brownwins1} and \ref{brownwins2} employ \emph{subjunctive} conditionals, rather than \emph{indicative} conditionals. They ask us to imagine something contrary to fact---after all, Hillary Clinton lost the 2016 election---and then ask us to evaluate what \emph{would} have happened in that case. Such considerations simply cannot be tackled using `$\eif$'.

I shall say more about the difficulties with conditionals in \S\ref{s:ParadoxesOfMaterialConditional}. For now, I shall content myself with the observation that `$\eif$' is the only candidate for a truth-functional conditional, but that many English conditionals cannot be represented adequately using `$\eif$'. TFL is an intrinsically limited language. And you should not blithely assume that you can adequately symbolise an English `if\ldots, then\ldots' with TFL's `$\eif$'.

\chapter{Complete truth tables}\label{s:CompleteTruthTables}
So far, I have used symbolisation keys to assign truth values to TFL sentences \emph{indirectly}. For example, we might say that the TFL sentence `$B$' is to be true iff Big Ben is in London. Since Big Ben \emph{is} in London, this symbolisation would make `$B$' true. But we can also assign truth values \emph{directly}. We can simply stipulate that `$B$' is to be true, or stipulate that it is to be false. Such stipulations are called \emph{valuations}:
	\factoidbox{
		A \define{valuation} is any assignment of truth values to particular atomic sentences of TFL.
	}
The power of truth tables lies in the following. Each row of a truth table represents a possible valuation. The complete truth table represents all possible valuations. And the truth table provides us with a means to calculate the truth value of complex sentences, on each possible valuation. But all of this is easiest to explain by example.

\section{A worked example}
Consider the sentence `$(H\eand I)\eif H$'. There are four possible ways to assign True and False to the atomic sentence `$H$' and `$I$'---four valuations---which we can represent as follows:
\begin{center}
\begin{tabular}{c c|d e e e f}
$H$&$I$&$(H$&\eand&$I)$&\eif&$H$\\
\hline
 T & T\\
 T & F\\
 F & T\\
 F & F
\end{tabular}
\end{center}
To calculate the truth value of the entire sentence `$(H \eand I) \eif H$', we first copy the truth values for the atomic sentences and write them underneath the letters in the sentence:
\begin{center}
\begin{tabular}{c c|d e e e f}
$H$&$I$&$(H$&\eand&$I)$&\eif&$H$\\
\hline
 T & T & {T} & & {T} & & {T}\\
 T & F & {T} & & {F} & & {T}\\
 F & T & {F} & & {T} & & {F}\\
 F & F & {F} & & {F} & & {F}
\end{tabular}
\end{center}
Now consider the subsentence `$(H\eand I)$'. This is a conjunction, $(\meta{A}\eand\meta{B})$, with `$H$' as \meta{A} and with `$I$' as \meta{B}. The characteristic truth table for conjunction gives the truth conditions for \emph{any} sentence of the form $(\meta{A}\eand\meta{B})$, whatever $\meta{A}$ and $\meta{B}$ might be. It summarises the point that a conjunction is true iff both conjuncts are true. In this case, our conjuncts are just `$H$' and `$I$'. They are both true on (and only on) the first line of the truth table. Accordingly, we can calculate the truth value of the conjunction on all four rows.
\begin{center}
\begin{tabular}{c c|d e e e f}
 & & \meta{A} & \eand & \meta{B} & & \\
$H$&$I$&$(H$&\eand&$I)$&\eif&$H$\\
\hline
 T & T & T & {T} & T & & T\\
 T & F & T & {F} & F & & T\\
 F & T & F & {F} & T & & F\\
 F & F & F & {F} & F & & F
\end{tabular}
\end{center}
Now, the entire sentence that we are dealing with is a conditional, $\meta{A}\eif\meta{B}$, with `$(H \eand I)$' as \meta{A} and with `$H$' as \meta{B}. On the second row, for example, `$(H\eand I)$' is false and `$H$' is true. Since a conditional is true when the antecedent is false, we write a `T' in the second row underneath the conditional symbol. We continue for the other three rows and get this:
\begin{center}
\begin{tabular}{c c| d e e e f}
 & &  & \meta{A} &  &\eif &\meta{B} \\
$H$&$I$&$(H$&\eand&$I)$&\eif&$H$\\
\hline
 T & T &  & {T} &  &{T} & T\\
 T & F &  & {F} &  &{T} & T\\
 F & T &  & {F} &  &{T} & F\\
 F & F &  & {F} &  &{T} & F
\end{tabular}
\end{center}
The conditional is the main logical connective of the sentence. And the column of `T's underneath the conditional tells us that the sentence `$(H \eand I)\eif H$' is true regardless of the truth values of `$H$' and `$I$'. They can be true or false in any combination, and the compound sentence still comes out true. Since we have considered all four possible assignments of truth and falsity to `$H$' and `$I$'---since, that is, we have considered all the different \emph{valuations}---we can say that `$(H \eand I)\eif H$' is true on every valuation.

In this example, I have not repeated all of the entries in every column in every successive table. When actually writing truth tables on paper, however, it is impractical to erase whole columns or rewrite the whole table for every step. Although it is more crowded, the truth table can be written in this way:
\begin{center}
\begin{tabular}{c c| d e e e f}
$H$&$I$&$(H$&\eand&$I)$&\eif&$H$\\
\hline
 T & T & T & {T} & T & \TTbf{T} & T\\
 T & F & T & {F} & F & \TTbf{T} & T\\
 F & T & F & {F} & T & \TTbf{T} & F\\
 F & F & F & {F} & F & \TTbf{T} & F
\end{tabular}
\end{center}
Most of the columns underneath the sentence are only there for bookkeeping purposes. The column that matters most is the column underneath the \emph{main logical operator} for the sentence, since this tells you the truth value of the entire sentence. I have emphasised this, by putting this column in bold. When you work through truth tables yourself, you should similarly emphasise it (perhaps by underlining).

\section{Building complete truth tables}
A \define{complete truth table} has a line for every possible assignment of True and False to the relevant atomic sentences. Each line represents a \emph{valuation}, and a complete truth table has a line for all the different valuations.

The size of the complete truth table depends on the number of different atomic sentences in the table. A sentence that contains only one atomic sentence requires only two rows, as in the characteristic truth table for negation. This is true even if the same letter is repeated many times, as in the sentence
`$[(C\eiff C) \eif C] \eand \enot(C \eif C)$'.
The complete truth table requires only two lines because there are only two possibilities: `$C$' can be true or it can be false. The truth table for this sentence looks like this:
\begin{center}
\begin{tabular}{c| d e e e e e e e e e e e e e e f}
$C$&$[($&$C$&\eiff&$C$&$)$&\eif&$C$&$]$&\eand&\enot&$($&$C$&\eif&$C$&$)$\\
\hline
 T &    & T &  T  & T &   & T  & T & &\TTbf{F}&  F& &   T &  T  & T &   \\
 F &    & F &  T  & F &   & F  & F & &\TTbf{F}&  F& &   F &  T  & F &   \\
\end{tabular}
\end{center}
Looking at the column underneath the main logical operator, we see that the sentence is false on both rows of the table; i.e., the sentence is false regardless of whether `$C$' is true or false. It is false on every valuation.

There will be four lines in the complete truth table for a sentence containing two atomic sentences, as in the characteristic truth tables, or the truth table for `$(H \eand I)\eif H$'.

There will be eight lines in the complete truth table for a sentence containing three atomic sentences, e.g.:
\begin{center}
\begin{tabular}{c c c|d e e e f}
$M$&$N$&$P$&$M$&\eand&$(N$&\eor&$P)$\\
\hline
%           M        &     N   v   P
T & T & T & T & \TTbf{T} & T & T & T\\
T & T & F & T & \TTbf{T} & T & T & F\\
T & F & T & T & \TTbf{T} & F & T & T\\
T & F & F & T & \TTbf{F} & F & F & F\\
F & T & T & F & \TTbf{F} & T & T & T\\
F & T & F & F & \TTbf{F} & T & T & F\\
F & F & T & F & \TTbf{F} & F & T & T\\
F & F & F & F & \TTbf{F} & F & F & F
\end{tabular}
\end{center}
From this table, we know that the sentence `$M\eand(N\eor P)$' can be true or false, depending on the truth values of `$M$', `$N$', and `$P$'.

A sentence containing four different atomic sentences needs a truth table with 16 lines. Five atomic sentences, 32 lines. Six atomic sentences, 64 lines. And so on. To be perfectly general: a complete truth table with $n$ atomic sentences must have $2^n$ lines.

In order to fill in the columns of a complete truth table, begin with the right-most atomic sentence and alternate between `T' and `F'. In the next column to the left, write two `T's, write two `F's, and repeat. For the third atomic sentence, write four `T's followed by four `F's. This yields an eight line truth table like the one above. For a 16 line truth table, the next column of atomic sentences should have eight `T's followed by eight `F's. For a 32 line table, the next column would have 16 `T's followed by 16 `F's. And so on.

\section{More bracketing conventions}\label{s:MoreBracketingConventions}
Consider these two sentences:
	\begin{align*}
		((A \eand B) \eand C)\\
		(A \eand (B \eand C))
	\end{align*}
These have the same truth table. Consequently, it will never make any difference from the perspective of truth value---which is all that TFL cares about (see \S\ref{s:TruthFunctionality})---which of the two sentences we assert (or deny). And since the order of the brackets does not matter, I shall allow us to drop them.  In short, we can save some ink and some eyestrain by writing:
	\begin{align*}
		A \eand B \eand C
	\end{align*}
The general point is that, if we just have a long list of conjunctions, we can drop the inner brackets. (I already allowed us to drop outermost brackets in \S\ref{s:TFLSentences}.) The same observation holds for disjunctions. Since the following sentences have exactly the same truth table:
	\begin{align*}
		((A \eor B) \eor C)\\
		(A \eor (B \eor C))
	\end{align*}
we can simply write:
	\begin{align*}
		A \eor B \eor C
	\end{align*}
And generally, if we just have a long list of disjunctions, we can drop the inner brackets. \emph{But be careful}. These two sentences have \emph{different} truth tables:
	\begin{align*}
		((A \eif B) \eif C)\\
		(A \eif (B \eif C))
	\end{align*}
So if we were to write:
	\begin{align*}
		A \eif B \eif C
	\end{align*}
it would be dangerously ambiguous. So we must not do the same with conditionals. Equally, these sentences have different truth tables:
	\begin{align*}
		((A \eor B) \eand C)\\
		(A \eor (B \eand C))
	\end{align*}
So if we were to write:
	\begin{align*}
		A \eor B \eand C
	\end{align*}
it would be dangerously ambiguous. \emph{Never write this.} The moral is: you can drop brackets when dealing with a long list of conjunctions, or when dealing with a long list of disjunctions. But that's it.

\practiceproblems
\problempart
Offer complete truth tables for each of the following:
\begin{earg}
\item $A \eif A$ %taut
\item $C \eif\enot C$ %contingent
\item $(A \eiff B) \eiff \enot(A\eiff \enot B)$ %tautology
\item $(A \eif B) \eor (B \eif A)$ % taut
\item $(A \eand B) \eif (B \eor A)$  %taut
\item $\enot(A \eor B) \eiff (\enot A \eand \enot B)$ %taut
\item $\bigl[(A\eand B) \eand\enot(A\eand B)\bigr] \eand C$ %contradiction
\item $[(A \eand B) \eand C] \eif B$ %taut
\item $\enot\bigl[(C\eor A) \eor B\bigr]$ %contingent
\end{earg}
\problempart
Check all the claims made in introducing the new notational conventions in \S\ref{s:MoreBracketingConventions}, i.e.\ show that:
\begin{earg}
	\item `$((A \eand B) \eand C)$' and `$(A \eand (B \eand C))$' have the same truth table
	\item `$((A \eor B) \eor C)$' and `$(A \eor (B \eor C))$' have the same truth table
	\item `$((A \eor B) \eand C)$' and `$(A \eor (B \eand C))$' do not have the same truth table
	\item `$((A \eif B) \eif C)$' and `$(A \eif (B \eif C))$' do not have the same truth table
\end{earg}
Also, check whether:
\begin{earg}
	\item[5.] `$((A \eiff B) \eiff C)$' and `$(A \eiff (B \eiff C))$' have the same truth table
\end{earg}
If you want additional practice, you can construct truth tables for any of the sentences and arguments in the exercises for the previous chapter.

\chapter{Semantic concepts}\label{s:semanticconcepts}
In the previous section, I introduced the idea of a valuation and showed how to determine the truth value of any TFL sentence, on any valuation, using a truth table. In this section, I shall introduce some related ideas, and show how to use truth tables to test whether or not they apply.

\section{Tautologies and contradictions}
In \S\ref{s:BasicNotions}, I explained \emph{necessary truth} and \emph{necessary falsity}. Both notions have surrogates in TFL. We shall start with a surrogate for necessary truth.
	\factoidbox{
	A sentence is a \define{tautology} iff it is true on every valuation.
	}
We can use truth tables to decide whether a sentence is a tautology. If the sentence is true on every line of its complete truth table, then it is true on every valuation, so it is a tautology. In the example of \S\ref{s:CompleteTruthTables}, `$(H \eand I) \eif H$' is a tautology.

This is only, though, a surrogate for necessary truth. There are some necessary truths that we cannot adequately symbolise in TFL. One example is `$2 + 2 = 4$'. This \emph{must} be true, but if we try to symbolise it in TFL, the best we can offer is an atomic sentence, and no atomic sentence is a tautology. Still, if we can adequately symbolise some English sentence using a TFL sentence which is a tautology, then that English sentence expresses a necessary truth.

We have a similar surrogate for necessary falsity:
	\factoidbox{
		A sentence is a \define{contradiction} iff it is false on every valuation.
	}
We can use truth tables to decide whether a sentence is a contradiction. If the sentence is false on every line of its complete truth table, then it is false on every valuation, so it is a contradiction. In the example of \S\ref{s:CompleteTruthTables}, `$[(C\eiff C) \eif C] \eand \enot(C \eif C)$' is a contradiction.

\section{Tautological equivalence}
Here is a similar, useful notion:
	\factoidbox{
		Sentences are \define{tautologically equivalent} iff they have the same truth value on every valuation.
	}
We have already made use of this notion, in effect, in \S\ref{s:MoreBracketingConventions}; the point was that `$(A \eand B) \eand C$' and  `$A \eand (B \eand C)$' are tautologically equivalent. Again, it is easy to test for tautological equivalence using truth tables. Consider the sentences `$\enot(P \eor Q)$' and `$\enot P \eand \enot Q$'. Are they tautologically equivalent? To find out, we construct a truth table.
\begin{center}
\begin{tabular}{c c|d e e f |d e e e f}
$P$&$Q$&\enot&$(P$&\eor&$Q)$&\enot&$P$&\eand&\enot&$Q$\\
\hline
 T & T & \TTbf{F} & T & T & T & F & T & \TTbf{F} & F & T\\
 T & F & \TTbf{F} & T & T & F & F & T & \TTbf{F} & T & F\\
 F & T & \TTbf{F} & F & T & T & T & F & \TTbf{F} & F & T\\
 F & F & \TTbf{T} & F & F & F & T & F & \TTbf{T} & T & F
\end{tabular}
\end{center}
Look at the columns for the main logical operators; negation for the first sentence, conjunction for the second. On the first three rows, both are false. On the final row, both are true. Since they match on every row, the two sentences are tautologically equivalent.

\section{Consistency}
In \S\ref{s:BasicNotions}, I said that sentences are jointly consistent iff it is possible for all of them to be true at once. We can offer a surrogate for this notion too:
	\factoidbox{
	Sentences are \define{jointly tautologically consistent} iff there is some valuation which makes them all true.
	}
Derivatively, sentences are jointly tautologically inconsistent iff no valuation makes them all true. Again, it is easy to test for joint tautological consistency using truth tables.

\section{Tautological entailment and validity}
The following idea is closely related to that of joint consistency:
	\factoidbox{
		$\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n$ \define{tautologically entail}  $\meta{C}$ iff no valuation of the relevant atomic sentences makes all of $\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n$ true and $\meta{C}$ false.
	}
Again, it is easy to test this with a truth table. To check whether `$\enot L \eif (J \eor L)$' and `$\enot L$' tautologically entail `$J$', we simply need to check whether there is any valuation which makes both `$\enot L \eif (J \eor L)$' and `$\enot L$' true whilst making `$J$' false. So we use a truth table:
\begin{center}
\begin{tabular}{c c|d e e e e f|d f| c}
$J$&$L$&\enot&$L$&\eif&$(J$&\eor&$L)$&\enot&$L$&$J$\\
\hline
%J   L   -   L      ->     (J   v   L)
 T & T & F & T & \TTbf{T} & T & T & T & \TTbf{F} & T & \TTbf{T}\\
 T & F & T & F & \TTbf{T} & T & T & F & \TTbf{T} & F & \TTbf{T}\\
 F & T & F & T & \TTbf{T} & F & T & T & \TTbf{F} & T & \TTbf{F}\\
 F & F & T & F & \TTbf{F} & F & F & F & \TTbf{T} & F & \TTbf{F}
\end{tabular}
\end{center}
The only row on which both`$\enot L \eif (J \eor L)$' and `$\enot L$' are true is the second row, and that is a row on which `$J$' is also true. So `$\enot L \eif (J \eor L)$' and `$\enot L$' tautologically entail `$J$'.

The notion of tautological entailment is deeply connected to the notion of validity:\footnote{Recall from \S\ref{s:UseMention} the use of `$\therefore$'; here. Without it, the information in this box could be written as follows. If $\meta{A}_1, \ldots, \meta{A}_n$ tautologically entail $\meta{C}$, then the argument with premises $\meta{A}_1, \ldots, \meta{A}_n$ and conclusion $\meta{C}$ is valid.}
	\factoidbox{
		If $\meta{A}_1, \ldots, \meta{A}_n$ tautologically entail $\meta{C}$, then $\meta{A}_1, \ldots, \meta{A}_n \therefore \meta{C}$ is valid.
	}
Here's why. If $\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n$ tautologically entail $\meta{C}$, then no valuation makes all of $\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n$ true whilst making $\meta{C}$ false. So it is \emph{logically impossible} for $\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n$ all to be true whilst $\meta{C}$ is false. And this guarantees the validity of the argument with premises $\meta{A}_1, \ldots, \meta{A}_n$ and conclusion $\meta{C}$.

In short, we have a way to test for the validity of English arguments. First, we symbolise them in TFL; then we test for tautological entailment using truth tables.

\section{The limits of these tests}\label{s:ParadoxesOfMaterialConditional}
This is an important milestone: a test for the validity of arguments! But, we should not get carried away just yet. It is important to understand the \emph{limits} of our achievement. I shall illustrate these limits with three examples.

First, consider the argument:
	\begin{earg}
		\item Daisy has four legs. So Daisy has more than two legs.
	\end{earg}
To symbolise this argument in TFL, we would have to use two different atomic sentences -- perhaps `$F$'  and `$T$' -- for the premise and the conclusion respectively. Now, it is obvious that `$F$' does not tautologically entail `$T$'. But the English argument is surely valid!

Second, consider the sentence:
	\begin{earg}
\setcounter{eargnum}{1}
		\item\label{n:JanBald} Jan is neither bald nor not-bald.
	\end{earg}
To symbolise this sentence in TFL, we would offer something like `$\enot J \eand \enot \enot J$'. This a contradiction (check this with a truth-table). But sentence \ref{n:JanBald} does not itself seem like a contradiction; for we might have happily added `Jan is on the borderline of baldness'!

Third, consider the following sentence:
	\begin{earg}
\setcounter{eargnum}{2}
		\item\label{n:GodParadox}	It's not the case that, if God exists, then She answers malevolent prayers.
	\end{earg}
Symbolising this in TFL, we would offer something like `$\enot (G \eif M)$'. Now, `$\enot (G \eif M)$' tautologically entails `$G$' (again, check this with a truth table). So if we symbolise sentence \ref{n:GodParadox} in TFL, it seems to entail that God exists. But that's strange: surely even the atheist can accept sentence \ref{n:GodParadox}, without contradicting herself!

In different ways, these three examples highlight some of the limits of working with a language (like TFL) that can \emph{only} handle truth-functional connectives. Moreover, these limits give rise to some interesting questions in philosophical logic. The case of Jan's baldness (or otherwise) raises the general question of what logic we should use when dealing with \emph{vague} discourse. The case of the atheist raises the question of how to deal with the (so-called) \emph{paradoxes of material implication}. Part of the purpose of this course is to equip you with the tools to explore these questions of \emph{philosophical logic}. But we have to walk before we can run; we have to become proficient in using TFL, before we can adequately discuss its limits, and consider alternatives.

\section{The double-turnstile}
In what follows, we will use the notion of tautological entailment rather often. It will help us, then, to introduce a symbol that abbreviates it. Rather than saying that the TFL sentences $\meta{A}_1, \meta{A}_2, \ldots$ and $\meta{A}_n$ together tautologically entail $\meta{C}$, we shall abbreviate this by:
	$$\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n \entails \meta{C}$$
The symbol `$\entails$' is known as \emph{the double-turnstile}, since it looks like a turnstile with two horizontal beams.

Let me be very clear about something. `$\entails$' is not a symbol of TFL. Rather, it is a symbol of our metalanguage, augmented English (recall the difference between object language and metalanguage from \S\ref{s:UseMention}). So the metalanguage sentence:
	\begin{ebullet}
		\item $P, P \eif Q \entails Q$
	\end{ebullet}
is \emph{just} an abbreviation for this metalanguage sentence:
	\begin{ebullet}
		\item The TFL sentences `$P$' and `$P \eif Q$' tautologically entail `$Q$'
	\end{ebullet}
Note that there is no limit on the number of TFL sentences that can be mentioned before the symbol `$\entails$'. Indeed, we can even consider the limiting case:
	$$\phantom{\meta{A}}\entails \meta{C}$$
This says that there is no valuation which makes all the sentences mentioned on the left side of `$\entails$' true whilst making $\meta{C}$ false. Since \emph{no} sentences are mentioned on the left side of `$\entails$' in this case, this just means that there is no valuation which makes $\meta{C}$ false. Otherwise put, it says that every valuation makes $\meta{C}$ true. Otherwise put, it says that $\meta{C}$ is a tautology. Equally, to say that $\meta{A}$ is a contradiction, we can write:
	$$\meta{A} \entails\phantom{\meta{C}}$$
For this says that no valuation makes $\meta{A}$ true.

Sometimes, we will want to deny that there is a tautological entailment, and say something of this shape:
\begin{center}
	it is \emph{not} the case that $\meta{A}_1, \ldots, \meta{A}_n \entails \meta{C}$
\end{center}
In that case, we can just slash the turnstile through, and write:
$$\meta{A}_1, \meta{A}_2, \ldots, \meta{A}_n \nentails\meta{C}$$
This means that \emph{some} valuation makes all of $\meta{A}_1, \ldots, \meta{A}_n$ true whilst making $\meta{C}$ false. (But note that it does \emph{not} immediately follow that $\meta{A}_1,\ldots, \meta{A}_n \entails \enot \meta{C}$, for that would mean that \emph{every} valuation makes all of $\meta{A}_1, \ldots, \meta{A}_n$ true whilst making $\meta{C}$ false.)

\section{`$\entails$' versus `$\eif$'}
I now want to compare and contrast `$\entails$' and `$\eif$'.

Observe: $\meta{A} \entails \meta{C}$ iff no valuation of the atomic sentences makes $\meta{A}$ true and $\meta{C}$ false.

Observe: $\meta{A} \eif \meta{C}$ is a tautology iff no valuation of the atomic sentences  makes $\meta{A} \eif \meta{C}$ false. Since a conditional is true except when its antecedent is true and its consequent false, $\meta{A} \eif \meta{C}$ is a tautology iff no valuation makes $\meta{A}$ true and $\meta{C}$ false.

Combining these two observations, we see that $\meta{A} \eif \meta{C}$  is a tautology iff  $\meta{A} \entails \meta{C}$. But there is a really, really important difference between `$\entails$' and `$\eif$':
	\factoidbox{`$\eif$' is a sentential connective of TFL.\\ `$\entails$' is a symbol of augmented English.
	}
Indeed, when `$\eif$' is flanked with two TFL sentences, the result is a longer TFL sentence. By contrast, when we use `$\entails$', we form a metalinguistic sentence that \emph{mentions} the surrounding TFL sentences.

\practiceproblems
\problempart
Revisit your answers to \S\ref{s:CompleteTruthTables}\textbf{A}. Determine which sentences were tautologies, which were contradictions, and which were neither tautologies nor contradictions.

\

\problempart
Use truth tables to determine whether these sentences are jointly consistent, or jointly inconsistent:
\begin{earg}
\item $A\eif A$, $\enot A \eif \enot A$, $A\eand A$, $A\eor A$ %consistent
\item $A\eor B$, $A\eif C$, $B\eif C$ %consistent
\item $B\eand(C\eor A)$, $A\eif B$, $\enot(B\eor C)$  %inconsistent
\item $A\eiff(B\eor C)$, $C\eif \enot A$, $A\eif \enot B$ %consistent
\end{earg}

\problempart
Use truth tables to assess the following:
\begin{earg}
\item $A\eif A \therefore A$ %invalid
\item $A\eif(A\eand\enot A) \therefore \enot A$ %valid
\item $A\eor(B\eif A) \therefore\enot A \eif \enot B$ %valid
\item $A\eor B, B\eor C, \enot A \therefore B \eand C$ %invalid
\item $(B\eand A)\eif C, (C\eand A)\eif B \therefore (C\eand B)\eif A$ %invalid
\end{earg}

\problempart
Answer each of the questions below and justify your answer.
\begin{earg}
\item Suppose that \meta{A} and \meta{B} are tautologically equivalent. What can you say about $\meta{A}\eiff\meta{B}$?
%\meta{A} and \meta{B} have the same truth value on every line of a complete truth table, so $\meta{A}\eiff\meta{B}$ is true on every line. It is a tautology.
\item Suppose that $(\meta{A}\eand\meta{B})\eif\meta{C}$ is neither a tautology nor a contradiction. What can you say about this: $\meta{A}, \meta{B} \entails\meta{C}$?
%The sentence is false on some line of a complete truth table. On that line, \meta{A} and \meta{B} are true and \meta{C} is false. So the argument is invalid.
\item Suppose that $\meta{A}$, $\meta{B}$ and $\meta{C}$  are jointly tautologically inconsistent. What can you say about this: $(\meta{A}\eand\meta{B}\eand\meta{C})$?
\item Suppose that \meta{A} is a contradiction. What can you say about this: $\meta{A}, \meta{B} \therefore \meta{C}$?
%Since \meta{A} is false on every line of a complete truth table, there is no line on which \meta{A} and \meta{B} are true and \meta{C} is false. So the argument is valid.
\item Suppose that \meta{C} is a tautology. What can you say about this: $\meta{A}, \meta{B}\entails \meta{C}$?
%Since \meta{C} is true on every line of a complete truth table, there is no line on which \meta{A} and \meta{B} are true and \meta{C} is false. So the argument is valid.
\item Suppose that \meta{A} and \meta{B} are tautologically equivalent. What can you say about $(\meta{A}\eor\meta{B})$?
%Not much. $(\meta{A}\eor\meta{B})$ is a tautology if \meta{A} and \meta{B} are tautologies; it is a contradiction if they are contradictions; it is contingent if they are contingent.
\item Suppose that \meta{A} and \meta{B} are \emph{not} tautologically equivalent. What can you say about this: $(\meta{A}\eor\meta{B})$?
%\meta{A} and \meta{B} have different truth values on at least one line of a complete truth table, and $(\meta{A}\eor\meta{B})$ will be true on that line. On other lines, it might be true or false. So $(\meta{A}\eor\meta{B})$ is either a tautology or it is contingent; it is \emph{not} a contradiction.
\end{earg}
\problempart
Consider the following principle:
	\begin{ebullet}
		\item Suppose $\meta{A}$ and $\meta{B}$ are tautologically equivalent. Suppose an argument contains $\meta{A}$ (either as a premise, or as the conclusion). The validity of the argument would be unaffected, if we replaced $\meta{A}$ with $\meta{B}$.
	\end{ebullet}
Is this principle correct? Explain your answer.

\chapter{Truth table shortcuts}
With practice, you will quickly become adept at filling out truth tables. In this section, I want to provide (and justify) some shortcuts which will help you along the way.

\section{Working through truth tables}
You will quickly find that you do not need to copy the truth value of each atomic sentence, but can simply refer back to them. So you can speed things up by writing:
\begin{center}
\begin{tabular}{c c|d e e e e f}
$P$&$Q$&$(P$&\eor&$Q)$&\eiff&\enot&$P$\\
\hline
 T & T &  & T &  & \TTbf{F} & F\\
 T & F &  & T &  & \TTbf{F} & F\\
 F & T &  & T & & \TTbf{T} & T\\
 F & F &  & F &  & \TTbf{F} & T
\end{tabular}
\end{center}
You also know for sure that a disjunction is true whenever one of the disjuncts is true. So if you find a true disjunct, there is no need to work out the truth values of the other disjuncts. Thus you might offer:
\begin{center}
\begin{tabular}{c c|d e e e e e e f}
$P$&$Q$& $(\enot$ & $P$&\eor&\enot&$Q)$&\eor&\enot&$P$\\
\hline
 T & T & F & & F & F& & \TTbf{F} & F\\
 T & F &  F & & T& T& &  \TTbf{T} & F\\
 F & T & & &  & & & \TTbf{T} & T\\
 F & F & & & & & &\TTbf{T} & T
\end{tabular}
\end{center}
Equally, you know for sure that a conjunction is false whenever one of the conjuncts is false. So if you find a false conjunct, there is no need to work out the truth value of the other conjunct. Thus you might offer:
\begin{center}
\begin{tabular}{c c|d e e e e e e f}
$P$&$Q$&\enot &$(P$&\eand&\enot&$Q)$&\eand&\enot&$P$\\
\hline
 T & T &  &  & &  & & \TTbf{F} & F\\
 T & F &   &  &&  & & \TTbf{F} & F\\
 F & T & T &  & F &  & & \TTbf{T} & T\\
 F & F & T &  & F & & & \TTbf{T} & T
\end{tabular}
\end{center}
A similar short cut is available for conditionals. You immediately know that a conditional is true if either its consequent is true, or its antecedent is false. Thus you might present:
\begin{center}
\begin{tabular}{c c|d e e e e e f}
$P$&$Q$& $((P$&\eif&$Q$)&\eif&$P)$&\eif&$P$\\
\hline
 T & T & &  & & & & \TTbf{T} & \\
 T & F &  &  & && & \TTbf{T} & \\
 F & T & & T & & F & & \TTbf{T} & \\
 F & F & & T & & F & &\TTbf{T} &
\end{tabular}
\end{center}
So `$((P \eif Q) \eif P) \eif P$' is a tautology. In fact, it is an instance of \emph{Peirce's Law}, named after Charles Sanders Peirce.

\section{Testing for validity and entailment}
In \S\ref{s:semanticconcepts}, we saw how to use truth tables to test for validity. In that test, we look for \emph{bad} lines: lines where the premises are all true and the conclusion is false. Now:
\begin{earg}
	\item[\textbullet] If the conclusion is true on a line, then that line is not bad. (And we don't need to evaluate anything \emph{else} on that line to confirm this.)
	\item[\textbullet] If any premise is false on a line, then that line is not bad. (And we don't need to evaluate anything \emph{else} on that line to confirm this.)
\end{earg}
With this in mind, we can speed up our tests for validity quite considerably.

Let's consider how we might test the following:
$$\enot L \eif (J \eor L), \enot L \therefore J$$
The \emph{first} thing we should do is evaluate the conclusion. If we find that the conclusion is \emph{true} on some line, then that is not a bad line. So we can simply ignore the rest of the line. So, after our first stage, we are left with something like this:
\begin{center}
	\begin{tabular}{c c|d e e e e f |d f|c}
		$J$&$L$&\enot&$L$&\eif&$(J$&\eor&$L)$&\enot&$L$&$J$\\
		\hline
		%J   L   -   L      ->     (J   v   L)
		T & T & &&&&&&&& {T}\\
		T & F & &&&&&&&& {T}\\
		F & T & &&?&&&&?&& {F}\\
		F & F & &&?&&&&?&& {F}
	\end{tabular}
\end{center}
where the blanks indicate that we won't bother with any more investigation (since the line is not bad), and the question-marks indicate that we need to keep digging.

The easiest premise to evaluate is the second, so we do that next, and get:
\begin{center}
	\begin{tabular}{c c|d e e e e f |d f|c}
		$J$&$L$&\enot&$L$&\eif&$(J$&\eor&$L)$&\enot&$L$&$J$\\
		\hline
		%J   L   -   L      ->     (J   v   L)
		T & T & &&&&&&&& {T}\\
		T & F & &&&&&&&& {T}\\
		F & T & &&&&&&{F}&& {F}\\
		F & F & &&?&&&&{T}&& {F}
	\end{tabular}
\end{center}
Note that we no longer need to consider the third line on the table: it is certainly not bad, because some premise is false on that line. And finally, we complete the truth table:
\begin{center}
	\begin{tabular}{c c|d e e e e f |d f|c}
		$J$&$L$&\enot&$L$&\eif&$(J$&\eor&$L)$&\enot&$L$&$J$\\
		\hline
		%J   L   -   L      ->     (J   v   L)
		T & T & &&&&&&&& {T}\\
		T & F & &&&&&&&& {T}\\
		F & T & &&&&&&{F}& & {F}\\
		F & F & T &  & \TTbf{F} &  & F & & {T} & & {F}
	\end{tabular}
\end{center}
The truth table has no bad lines, so the argument is valid. Any valuation which makes every premise true makes the conclusion true.

It's probably worth illustrating the tactic again. Consider this argument:
$$A\eor B, \enot (B\eand C) \therefore (A \eor \enot C)$$
Again, we start by evaluating the conclusion. Since this is a disjunction, it is true whenever either disjunct is true, so we can speed things along a bit.
\begin{center}
\begin{tabular}[t]{c c c| c|c|d e e f }
$A$ & $B$ & $C$ & $A\eor B$ & $\enot (B \eand C)$ & $(A$ &$\eor $& $\enot $ & $C)$\\
\hline
T & T & T &  &  & & \TTbf{T} & & \\
T & T & F &  &  & & \TTbf{T} & & \\
T & F & T &  &  & & \TTbf{T} & & \\
T & F & F &  &  & & \TTbf{T} & & \\
F & T & T & ? & ? & & \TTbf{F} &F & \\
F & T & F &  &  && \TTbf{T} & T& \\
F & F & T & ? & ? && \TTbf{F} & F& \\
F & F & F &  &  & & \TTbf{T} & T& \\
\end{tabular}
\end{center}
 We can now ignore all but the two lines where the sentence after the turnstile is false. Evaluating the two sentences on the left of the turnstile, we get:
 \begin{center}
 	\begin{tabular}[t]{c c c| c|d e e f |d e e f }
 		$A$ & $B$ & $C$ & $A\eor B$ & $\enot ($&$B$&$ \eand$&$ C)$ & $(A$ &$\eor $& $\enot $ & $C)$\\
 		\hline
 		T & T & T &  & &&& & & \TTbf{T} & & \\
 		T & T & F &  & &&& & & \TTbf{T} & & \\
 		T & F & T &  & &&& & & \TTbf{T} & & \\
 		T & F & F &  & &&& & & \TTbf{T} & & \\
 		F & T & T & \textbf{T} & \textbf{F}&&T& & & \TTbf{F} &F & \\
 		F & T & F & &&& & && \TTbf{T} & T& \\
 		F & F & T & \textbf{F} & &&& & & \TTbf{F} & F& \\
 		F & F & F & &&&& && \TTbf{T} & T& \\
 	\end{tabular}
 \end{center}
So the entailment holds! And our shortcuts saved us a \emph{lot} of work.

I have been discussing shortcuts in testing for  validity. But exactly the same shortcuts can be used in testing for tautological entailment. By employing a similar notion of bad lines, you can save yourself a huge amount of work.

\practiceproblems
\problempart
Using shortcuts, check whether each sentence is a tautology, a contradiction, or neither.
\begin{earg}
	\item $\enot B \eand B$ %contra
	\item $\enot D \eor D$ %taut
	\item $(A\eand B) \eor (B\eand A)$ %contingent
	\item $\enot[A \eif (B \eif A)]$ %contra
	\item $A \eiff [A \eif (B \eand \enot B)]$ %contra
	\item $\enot(A\eand B) \eiff A$ %contingent
	\item $A\eif(B\eor C)$ %contingent
	\item $(A \eand\enot A) \eif (B \eor C)$ %tautology
	\item $(B\eand D) \eiff [A \eiff(A \eor C)]$%contingent
\end{earg}

\chapter{Partial truth tables}\label{s:PartialTruthTable}

Sometimes, we do not need to know what happens on every line of a truth table. Sometimes, just a single line or two will do.

\paragraph{Tautology.}
In order to show that a sentence is a tautology, we need to show that it is true on every valuation. That is to say, we need to know that it comes out true on every line of the truth table. So we need a complete truth table.

To show that a sentence is \emph{not} a tautology, however, we only need one line: a line on which the sentence is false. Therefore, in order to show that some sentence is not a tautology, it is enough to provide a single valuation---a single line of the truth table---which makes the sentence false.

Suppose that we want to show that the sentence `$(U \eand T) \eif (S \eand W)$' is \emph{not} a tautology. We set up a \define{partial truth table}:
\begin{center}
\begin{tabular}{c c c c |d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
   &   &   &   &    &   &    &\TTbf{F}&    &   &
\end{tabular}
\end{center}
I have only left space for one line, rather than 16, since we are only looking for one line, on which the sentence is false (hence, also, the `F').

The main logical operator of the sentence is a conditional. In order for the conditional to be false, the antecedent must be true and the consequent must be false. So we fill these in on the table:
\begin{center}
\begin{tabular}{c c c c |d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
   &   &   &   &    &  T  &    &\TTbf{F}&    &   F &
\end{tabular}
\end{center}
In order for the `$(U\eand T)$' to be true, both `$U$' and `$T$' must be true.
\begin{center}
\begin{tabular}{c c c c|d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
   & T & T &   &  T &  T  & T  &\TTbf{F}&    &   F &
\end{tabular}
\end{center}
Now we just need to make `$(S\eand W)$' false. To do this, we need to make at least one of `$S$' and `$W$' false. We can make both `$S$' and `$W$' false if we want. All that matters is that the whole sentence turns out false on this line. Making an arbitrary decision, we finish the table in this way:
\begin{center}
\begin{tabular}{c c c c|d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
 F & T & T & F &  T &  T  & T  &\TTbf{F}&  F &   F & F
\end{tabular}
\end{center}
So we now have a partial truth table, which shows that `$(U \eand T) \eif (S \eand W)$' is not a tautology. Put otherwise, we have shown that there is a valuation which makes `$(U \eand T) \eif (S \eand W)$' false, namely, the valuation which makes `$S$' false, `$T$' true, `$U$' true and `$W$' false.

\paragraph{Contradiction.}
Showing that something is a contradiction requires a complete truth table: we need to show that there is no valuation which makes the sentence true; that is, we need to show that the sentence is false on every line of the truth table.

However, to show that something is \emph{not} a contradiction, all we need to do is find a valuation which makes the sentence true, and a single line of a truth table will suffice. We can illustrate this with the same example.
\begin{center}
\begin{tabular}{c c c c|d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
  &  &  &  &   &   &   &\TTbf{T}&  &  &
\end{tabular}
\end{center}
To make the sentence true, it will suffice to ensure that the antecedent is false. Since the antecedent is a conjunction, we can just make one of them false. Making an arbitrary choice, let's make `$U$' false; we can then assign any truth value we like to the other atomic sentences.
\begin{center}
\begin{tabular}{c c c c|d e e e e e f}
$S$&$T$&$U$&$W$&$(U$&\eand&$T)$&\eif    &$(S$&\eand&$W)$\\
\hline
 F & T & F & F &  F &  F  & T  &\TTbf{T}&  F &   F & F
\end{tabular}
\end{center}

\paragraph{Tautological equivalence.}
To show that two sentences are tautologically equivalent, we must show that the sentences have the same truth value on every valuation. So this requires a  complete truth table.

To show that two sentences are \emph{not} tautologically equivalent, we only need to show that there is a valuation on which they have different truth values. So this requires only a one-line partial truth table: make the table so that one sentence is true and the other false.

\paragraph{Consistency.}
To show that some sentences are jointly consistent, we must show that there is a valuation which makes all of the sentence true. So this requires only a partial truth table with a single line.

To show that some sentences are jointly inconsistent, we must show that there is no valuation which makes all of the sentence true. So this requires a complete truth table: You must show that on every row of the table at least one of the sentences is false.

\paragraph{Validity/entailment.}
To show that an argument is valid, we must show that there is no valuation which makes all of the premises true and the conclusion false. So this  requires a complete truth table.  (Likewise for entailment.)

To show that argument is \emph{invalid}, we must show that there is a valuation which makes all of the premises true and the conclusion false. So this requires only a one-line partial truth table on which all of the premises are true and the conclusion is false. (Likewise for a failure of entailment.)

\
\\This table summarises what is required:

\begin{center}
\begin{tabular}{l l l}
%\cline{2-3}
 & \textbf{Yes} & \textbf{No}\\
 \hline
%\cline{2-3}
tautology? & complete truth table & one-line partial truth table\\
contradiction? &  complete truth table  & one-line partial truth table\\
equivalent? & complete truth table & one-line partial truth table\\
consistent? & one-line partial truth table & complete truth table\\
valid? & complete truth table & one-line partial truth table\\
entailment? & complete truth table & one-line partial truth table\\
\end{tabular}
\end{center}
\label{table.CompleteVsPartial}

\practiceproblems
\problempart
Use complete or partial truth tables (as appropriate) to determine whether these pairs of sentences are tautologically equivalent:
\begin{earg}
\item $A$, $\enot A$ %No
\item $A$, $A \eor A$ %Yes
\item $A\eif A$, $A \eiff A$ %Yes
\item $A \eor \enot B$, $A\eif B$ %No
\item $A \eand \enot A$, $\enot B \eiff B$ %Yes
\item $\enot(A \eand B)$, $\enot A \eor \enot B$ %Yes
\item $\enot(A \eif B)$, $\enot A \eif \enot B$ %No
\item $(A \eif B)$, $(\enot B \eif \enot A)$ %Yes
\end{earg}

\problempart
Use complete or partial truth tables (as appropriate) to determine whether these sentences are jointly tautologically consistent, or jointly tautologically inconsistent:
\begin{earg}
\item $A \eand B$, $C\eif \enot B$, $C$ %inconsistent
\item $A\eif B$, $B\eif C$, $A$, $\enot C$ %inconsistent
\item $A \eor B$, $B\eor C$, $C\eif \enot A$ %consistent
\item $A$, $B$, $C$, $\enot D$, $\enot E$, $F$ %consistent
\end{earg}

\problempart
Use complete or partial truth tables (as appropriate) to determine whether each argument is valid or invalid:
\begin{earg}
\item $A\eor\bigl[A\eif(A\eiff A)\bigr] \therefore A$ %invalid
\item $A\eiff\enot(B\eiff A) \therefore A$ %invalid
\item $A\eif B, B \therefore A$ %invalid
\item $A\eor B, B\eor C, \enot B \therefore A \eand C$ %valid
\item $A\eiff B, B\eiff C \therefore A\eiff C$ %valid
\end{earg}


\documentclass[journal,hidelinks]{IEEEtran}
\usepackage[utf8]{inputenc}
\usepackage[
  pdftitle={Assignment \#3},
  pdfauthor={Andrei Purcarus},
  pdfsubject={ECSE-543 -- Numerical Methods in EE}
]{hyperref}
\usepackage{graphicx}
\usepackage[all]{hypcap}
\usepackage{amsmath}
\usepackage{amssymb}
\usepackage{cleveref}
\usepackage{indentfirst}
\usepackage[per-mode=symbol]{siunitx}
\usepackage{listings}
\lstset{showstringspaces=false}

\title{ECSE-543 \\ Numerical Methods in EE \\ Assignment \#3}
\author{Andrei~Purcarus,~260631911,~\IEEEmembership{McGill~University}}

\begin{document}
\sloppy

\maketitle

\section*{Code Listings and Unit Testing}

The source code used for this assignment is listed in the appendices. In order to save space, we did not include the unit tests. For the full code, see the \href{https://github.com/Gripnook/ECSE543-F17-A3}{GitHub repository}.

\Cref{sec:main} defines the main function, which contains the core code that produces answers to the questions in this assignment. \Cref{sec:polynomial-h,sec:polynomial-cpp} define a polynomial class. \Cref{sec:interpolation-h,sec:interpolation-cpp} define functions that perform interpolation on data. \Cref{sec:solver-h,sec:solver-cpp} define nonlinear equation solvers. \Cref{sec:matrix} defines a matrix library. \Cref{sec:cholesky} defines functions that perform Cholesky decomposition using banded and non-banded methods. \Cref{sec:matrix-solver} defines a generic solver for systems of equations that have a positive-definite coefficient matrix. Finally, \Cref{sec:integral-h,sec:integral-cpp} define functions that perform numerical integration.

\section*{Question 1}

\subsection*{(a)}

We started by performing interpolation on the first $6$ points in the B-H data for M19 steel using a Lagrange polynomial on the entire domain. To do this, we used the Lagrange interpolation function defined in \Cref{sec:interpolation-h,sec:interpolation-cpp}. The result is shown in \Cref{fig:q1a}. From this figure, we can see that the interpolated curve matches the data well over this range, since it is monotonically increasing and does not have any significant ``wiggles''.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-1/q1a.eps}
  \caption{A Lagrange interpolation of the first $6$ points in the B-H data for M19 steel.}
  \label{fig:q1a}
\end{figure}

\subsection*{(b)}

Next, we performed the same Lagrange polynomial interpolation on the $6$ points at $B = \SI{0.0}{\tesla}$, $B = \SI{1.3}{\tesla}$, $B = \SI{1.4}{\tesla}$, $B = \SI{1.7}{\tesla}$, $B = \SI{1.8}{\tesla}$, and $B = \SI{1.9}{\tesla}$.  The results are shown in \Cref{fig:q1b}. From this figure, we can see that the result matches the data well for $B \ge \SI{1.3}{\tesla}$, but has a large deviation between $B = \SI{0.0}{\tesla}$ and $B = \SI{1.3}{\tesla}$ that does not seem plausible for the given data. This is likely to have occurred due to the lack of data in the latter range, as well as the high order polynomial we used to perform the interpolation.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-1/q1b.eps}
  \caption{A Lagrange interpolation of the $6$ points at $B = \SI{0.0}{\tesla}$, $B = \SI{1.3}{\tesla}$, $B = \SI{1.4}{\tesla}$, $B = \SI{1.7}{\tesla}$, $B = \SI{1.8}{\tesla}$, and $B = \SI{1.9}{\tesla}$ in the B-H data for M19 steel.}
  \label{fig:q1b}
\end{figure}

\subsection*{(c)}

As an alternative to full-domain Lagrange interpolation, we also used cubic Hermite interpolation on each of the $5$ sub-domains between the $6$ points used in the previous section. To do this, we used the Hermite interpolation function shown in \Cref{sec:interpolation-h,sec:interpolation-cpp}. However, to do this, we had to provide values for the derivatives of the function at the given points. The simplest approach to this is to provide a numerical estimate of the derivative using the given data. Therefore, we used the slope between the points immediately before and after a given point to estimate the derivative at that point. For $B = \SI{0.0}{\tesla}$ and $B = \SI{1.9}{\tesla}$, we instead used a one-sided estimate of the derivative since points were not available on both sides. The results of doing this are shown in \Cref{fig:q1c}. From this figure, we can see that the interpolation is better than the one using Lagrange polynomials. However, it still has some problems. Due to the large gap in data, the curve initially decreases below $\SI{0.0}{\ampere\per\meter}$, which is not a realistic scenario.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-1/q1c.eps}
  \caption{A piecewise cubic Hermite interpolation of the $6$ points at $B = \SI{0.0}{\tesla}$, $B = \SI{1.3}{\tesla}$, $B = \SI{1.4}{\tesla}$, $B = \SI{1.7}{\tesla}$, $B = \SI{1.8}{\tesla}$, and $B = \SI{1.9}{\tesla}$ in the B-H data for M19 steel.}
  \label{fig:q1c}
\end{figure}

\section*{Question 2}

\subsection*{(a)}

We started by deriving an equation for the flux $\Psi$ in the magnetic circuit. From Ampere's law, we have
\begin{equation}
N I = H_c l_c + H_g l_g
\end{equation}
Since the cross-sectional area $S$ is uniform in the solenoid, so are the magnetic flux $\Psi$ and the magnetic flux density $B$. Given that $H_c$ depends on $B$ according to the non-linear M19 steel data, and that $H_g$ depends on $B$ in a linear fashion, we can write
\begin{align}
N I &= H_c(B) l_c + B l_g / \mu_0 \\
N I &= H_c(\Psi / S) l_c + \Psi l_g / (\mu_0 S)
\end{align}
Thus, the equation to solve is $f(\Psi) = 0$, where
\begin{align}
f(\Psi) &= H_c(\Psi / S) l_c + \Psi l_g / (\mu_0 S) - N I \\
f'(\Psi) &= H_c'(\Psi / S) l_c / S + l_g / (\mu_0 S)
\end{align}

\subsection*{(b)}

With the equations derived in the previous section, we used the Newton-Raphson method to solve for the flux $\Psi$. The code that does this is shown in \Cref{sec:solver-h,sec:solver-cpp}. We used a piecewise linear interpolation for $H_c(B)$ and $H_c'(B)$. We then started the solver with $\Psi = \SI{0.0}{\tesla\meter^2}$ and stopped when $|f(\Psi) / f(0)| < 10^{-6}$. The resulting output of the program is shown in \Cref{fig:q2b}, which shows that the final result was $\Psi = \SI{0.000161269}{\tesla\meter^2}$, corresponding to a flux density of $B = \SI{1.61269}{\tesla}$. The figure also shows that convergence took only $3$ iterations.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{question-2/q2b.png}
  \caption{The output of the program for the magnetic circuit solver using the Newton-Raphson method.}
  \label{fig:q2b}
\end{figure}

\subsection*{(c)}

We next tried solving the same magnetic circuit using successive substitution. We first modified the equation to be in the form $\Psi = f(\Psi)$, as
\begin{align}
\Psi l_g / (\mu_0 S) &= N I - H_c(\Psi / S) l_c \\
\Psi &= \mu_0 S / l_g (N I - H_c(\Psi / S) l_c)
\end{align}

We tried using the successive substitution solver shown in \Cref{sec:solver-h,sec:solver-cpp}, but the problem failed to converge to a solution. In order to make the problem converge, we performed an inversion of the given equation, as
\begin{align}
H_c(\Psi / S) l_c &= N I - \Psi l_g / (\mu_0 S) \\
H_c(\Psi / S) &= (N I - \Psi l_g / (\mu_0 S)) / l_c \\
\Psi &= S H_c^{-1}((N I - \Psi l_g / (\mu_0 S)) / l_c)
\end{align}

This reformulation of the problem did converge using successive substitution, and the results are shown in \Cref{fig:q2c}. This figure shows that the solver converged to the same solution of $\Psi = \SI{0.000161269}{\tesla\meter^2}$, but said convergence was a lot slower, taking $14$ iterations.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=0.8\columnwidth]{question-2/q2c.png}
  \caption{The output of the program for the magnetic circuit solver using the successive substitution method.}
  \label{fig:q2c}
\end{figure}

\section*{Question 3}

\subsection*{(a)}

We next attempted to solve the non-linear electric circuit shown in \Cref{fig:q3-circuit} by using a node voltage method to derive a system of equations. We defined the node voltages $v_1$ and $v_2$ as shown in the figure, and derived the system $\boldsymbol{f}(\boldsymbol{v}) = \boldsymbol{0}$, where
\begin{align}
\boldsymbol{f}(\boldsymbol{v}) &=
\begin{bmatrix}
(v_1 - E) / R + I_{sA} (e^{(v_1 - v_2)/v_t} - 1) \\
-I_{sA} (e^{(v_1 - v_2)/v_t} - 1) + I_{sB} (e^{v_2/v_t} - 1) \\
\end{bmatrix}
\end{align}
Note that we used $v_t = kT/q = \SI{25}{\milli\volt}$.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=0.5\columnwidth]{question-3/q3-circuit.pdf}
  \caption{The non-linear electric circuit used in Question 3.}
  \label{fig:q3-circuit}
\end{figure}

\subsection*{(b)}

In order to solve the system of equations using the Newton-Raphson method, we also derived a formula for the Jacobian of $\boldsymbol{f}$ as
\begin{align}
\boldsymbol{J}(\boldsymbol{v}) &=
\begin{bmatrix}
\partial f_1 / \partial v_1 & \partial f_1 / \partial v_2 \\
\partial f_2 / \partial v_1 & \partial f_2 / \partial v_2 \\
\end{bmatrix}
\end{align}
where
\begin{align}
\partial f_1 / \partial v_1 &= 1 / R + I_{sA} e^{(v_1 - v_2)/v_t} / v_t \\
\partial f_1 / \partial v_2 &= -I_{sA} e^{(v_1 - v_2)/v_t} / v_t \\
\partial f_2 / \partial v_1 &= -I_{sA} e^{(v_1 - v_2)/v_t} / v_t \\
\partial f_2 / \partial v_2 &= I_{sA} e^{(v_1 - v_2)/v_t} / v_t + I_{sB} e^{v_2/v_t} / v_t
\end{align}

Since this Jacobian is positive definite, we used the Cholesky decomposition based solver we implemented in Assignment \#1 to solve the update equation given by
\begin{align}
\boldsymbol{J}(\boldsymbol{v}^{k}) \boldsymbol{v}^{k+1} = \boldsymbol{J}(\boldsymbol{v}^{k}) \boldsymbol{v}^{k} - \boldsymbol{f}(\boldsymbol{v}^{k})
\end{align}
The code that does this is shown in \Cref{sec:matrix-solver}. In addition, the Newton-Raphson solver for matrix equations is shown in \Cref{sec:solver-h,sec:solver-cpp}. We defined the error $\epsilon_k$ at each iteration as $\epsilon_k = \sum_{i} |f_i(\boldsymbol{v}^{k})| / \sum_{i} |f_i(\boldsymbol{v}^{0})|$, and stopped when $\epsilon_k < 10^{-6}$.

The results of the solver are shown in \Cref{fig:q3-voltages,fig:q3-residual,fig:q3-error,fig:q3-error-ratio}. In \Cref{fig:q3-voltages}, we can see that the voltages across the diodes converged to values of $V_A = \SI{0.1075633}{\volt}$ and $V_B = \SI{0.0905707}{\volt}$ in only $6$ iterations. \Cref{fig:q3-residual} shows the values of the function $\boldsymbol{f}$ across these $6$ iterations. Finally, \Cref{fig:q3-error} shows the error for each iteration.

In order to evaluate if the convergence was quadratic, we plotted $\epsilon_k / \epsilon_{k-1}^2$ in \Cref{fig:q3-error-ratio}. This figure shows that starting with iteration $2$, this ratio tended asymptotically towards a constant value. This indicates that the convergence is indeed quadratic after a few iterations. Unfortunately, the convergence of the function was so quick that we could not observe the effect in more detail.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-3/voltages.eps}
  \caption{Diode voltages vs. iteration for the Newton-Raphson solver used to solve the circuit in \Cref{fig:q3-circuit}.}
  \label{fig:q3-voltages}
\end{figure}

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-3/residual.eps}
  \caption{Residual vs. iteration for the Newton-Raphson solver used to solve the circuit in \Cref{fig:q3-circuit}.}
  \label{fig:q3-residual}
\end{figure}

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-3/error.eps}
  \caption{Error vs. iteration for the Newton-Raphson solver used to solve the circuit in \Cref{fig:q3-circuit}.}
  \label{fig:q3-error}
\end{figure}

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-3/error_ratio.eps}
  \caption{Error ratio vs. iteration for the Newton-Raphson solver used to solve the circuit in \Cref{fig:q3-circuit}.}
  \label{fig:q3-error-ratio}
\end{figure}

\section*{Question 4}
\subsection*{(a)}

Next, we performed numerical integration on the function $f(x) = cos(x)$ from $x = 0$ to $x = 1$ using one-point Gauss-Legendre integration over $N$ equal segments. The code that performs this function is shown in \Cref{sec:integral-h,sec:integral-cpp}. The results are shown in \Cref{fig:q4a}, which shows the natural logarithm of the absolute error plotted against the natural logarithm of the number of segments. This figure shows a clear linear trend, with a mean slope of $-2.0031$. This indicates that the error is approximately proportional to $1/N^2$, as we would expect since the one-point method integrates linear functions exactly and thus the error should be quadratic.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-4/q4a.eps}
  \caption{$ln(E)$ vs. $ln(N)$ for the integral of $f(x) = cos(x)$ from $x = 0$ to $x = 1$ using one-point Gauss-Legendre integration over $N$ equal segments.}
  \label{fig:q4a}
\end{figure}

\subsection*{(b)}

Next, we applied the same method to the function $f(x) = ln(x)$ from $x = 0$ to $x = 1$. The results are shown in \Cref{fig:q4b}, which shows the natural logarithm of the absolute error plotted against the natural logarithm of the number of segments. This figure shows a clear linear trend, with a mean slope of $-0.9981$. This indicates that the error is approximately proportional to $1/N$. Thus the error for this function has a lower order than for $f(x) = cos(x)$. This can be explained by the fact that $f(x) = ln(x)$ is unbounded on the integration interval. Indeed, since the second derivative tends to $-\infty$ as $x \to 0$, we cannot use a simple Taylor series to show that the error should be quadratic on this interval.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-4/q4b.eps}
  \caption{$ln(E)$ vs. $ln(N)$ for the integral of $f(x) = ln(x)$ from $x = 0$ to $x = 1$ using one-point Gauss-Legendre integration over $N$ equal segments.}
  \label{fig:q4b}
\end{figure}

\subsection*{(c)}

Finally, we attempted to integrate the function $f(x) = ln(x)$ as accurately as possible using a one-point Gauss-Legendre method with only $10$ segments. We wrote a function that accepts a vector of segment lengths and performs this computation. The code for this is shown in \Cref{sec:integral-h,sec:integral-cpp}.

In order to perform a methodical study, we decided to divide the lengths according to a geometric ratio, which would make the segments close to the singularity at $x = 0$ shorter compared to the segments close to $x = 1$. Thus, we used segments of the form $\alpha$, $\alpha r$, $\ldots$, $\alpha r^9$. We varied $r$ from $1$ to $2$ and computed $\alpha$ using
\begin{align}
\alpha (1 + r + ... + r^{9}) &= 1 \\
\alpha (r^{10} - 1) / (r - 1) &= 1 \\
\alpha &= (r - 1) / (r^{10} - 1)
\end{align}

The results of this approach are shown in \Cref{fig:q4c}. This figure shows that the error reaches a minimum of $0.0106114$ at $r = 1.45$, which corresponds to $\alpha = 0.0112262$.

\begin{figure}[!htb]
  \centering
  \includegraphics[width=\columnwidth]{question-4/q4c.eps}
  \caption{$E$ vs. $r$ for the integral of $f(x) = ln(x)$ from $x = 0$ to $x = 1$ using one-point Gauss-Legendre integration over $10$ unequal segments.}
  \label{fig:q4c}
\end{figure}

\newpage
\onecolumn

\begin{appendices}

\section{Main.cpp}
\label{sec:main}
\lstinputlisting[language=C++]{src/main.cpp}
\newpage

\section{Polynomial.h}
\label{sec:polynomial-h}
\lstinputlisting[language=C++]{src/polynomial.h}
\newpage

\section{Polynomial.cpp}
\label{sec:polynomial-cpp}
\lstinputlisting[language=C++]{src/polynomial.cpp}
\newpage

\section{Interpolation.h}
\label{sec:interpolation-h}
\lstinputlisting[language=C++]{src/interpolation.h}
\newpage

\section{Interpolation.cpp}
\label{sec:interpolation-cpp}
\lstinputlisting[language=C++]{src/interpolation.cpp}
\newpage

\section{Solver.h}
\label{sec:solver-h}
\lstinputlisting[language=C++]{src/solver.h}
\newpage

\section{Solver.cpp}
\label{sec:solver-cpp}
\lstinputlisting[language=C++]{src/solver.cpp}
\newpage

\section{Matrix.h}
\label{sec:matrix}
\lstinputlisting[language=C++]{src/matrix.h}
\newpage

\section{Cholesky.h}
\label{sec:cholesky}
\lstinputlisting[language=C++]{src/cholesky.h}
\newpage

\section{Matrix-solver.h}
\label{sec:matrix-solver}
\lstinputlisting[language=C++]{src/matrix-solver.h}
\newpage

\section{Integral.h}
\label{sec:integral-h}
\lstinputlisting[language=C++]{src/integral.h}
\newpage

\section{Integral.cpp}
\label{sec:integral-cpp}
\lstinputlisting[language=C++]{src/integral.cpp}
\newpage

\end{appendices}

\end{document}


\documentclass[PHIL101-Textbook.tex]{subfiles}

\begin{document}

\chapter{Quick Reference}
\label{app.solutions}

\section*{Truth Table Connectives}
\label{app.CharacteristicTTs}

\indent
\begin{tabular}{c|c}
\script{A} & \enot\script{A}\\
\hline
\vT & \vF\\
\vF & \vT
\end{tabular}
\hfill
\begin{tabular}{c|c|c|c|c|c}
\script{A} & \script{B} & (\script{A}\eand\script{B}) & (\script{A}\eor\script{B}) & (\script{A}\eif\script{B}) & (\script{A}\eiff\script{B})\\
\hline
\vT & \vT & \vT & \vT & \vT & \vT\\
\vT & \vF & \vF & \vT & \vF & \vF\\
\vF & \vT & \vF & \vT & \vT & \vF\\
\vF & \vF & \vF & \vF & \vT & \vT
\end{tabular}
\hfill

%\vfill
%\newpage

\section*{Symbolisation}
%\begin{center}
\label{app.symbolisation}
\begin{tabular*}{\textwidth}{rl}
\multicolumn{2}{c}{\textsc{Connectives} (chapter \ref{ch.TFL})}\\ \\
It is not the case that $P$. & $\enot P$\\
Either $P$, or $Q$. & $(P \eor Q)$\\
Neither $P$, nor $Q$. & $\enot(P \eor Q)$\ or \ $(\enot P \eand \enot Q)$\\
Both $P$, and $Q$. & $(P \eand Q)$\\
If $P$, then $Q$. $Q$ if $P$. & $(P \eif Q)$\\
$P$ only if $Q$. Only if $Q$, $P$. & $(P \eif Q)$\ or \ $(\enot Q \eif \enot P)$\\
$P$ if and only if $Q$. & $(P \eiff Q)$\\
Unless $P$, $Q$. $Q$ unless $P$. & $(\enot P \eif Q)$\\
\\
\multicolumn{2}{c}{\label{SymbolizingPredicates}\textsc{Predicates} (chapter \ref{ch.PL})}\\ \\
All $F$s are $G$s. & $\forall x(Fx \eif Gx)$\\
Some $F$s are $G$s. & $\exists x(Fx \eand Gx)$\\
Not all $F$s are $G$s. & $\enot\forall x(Fx \eif Gx)$\ or\ $\exists x(Fx \eand \enot Gx)$\\
No $F$s are $G$s. & $\forall x(Fx \eif\enot Gx)$\ or\ $\enot\exists x(Fx \eand Gx)$\\

\end{tabular*}
%\end{center}

\newpage

\section*{Truth Trees}

\begin{tabular}{cc}
\textbf{Conjunction}\\
{\begin{prooftree}
	{not line numbering}
	[\meta{A}\eand\meta{B}, checked
		[\meta{A} , just={$i$ \eand}
		[\meta{B} , just={$i$ \eand}
		]]
	]
	\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\enot(\meta{A}\eand\meta{B}), checked
			[\enot\meta{A} , just={$i$, \enot\eand}]
			[\enot\meta{B} , just={$i$, \enot\eand}]
	]
	\end{prooftree}
}\\
\textbf{Disjunction}\\
{\begin{prooftree}
	{not line numbering}
	[\meta{A}\eor\meta{B}, checked
		[\meta{A} , just={$i$, \eor}]
		[\meta{B} , just={$i$, \eor}]
	]
	\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\enot(\meta{A}\eor\meta{B}), checked
		[\enot\meta{A} , just={$i$, \enot\eor}
		[\enot\meta{B} , just={$i$, \enot\eor}
		]
		]
	]
	\end{prooftree}
}\\
\textbf{Conditional}\\
{\begin{prooftree}
	{not line numbering}
	[\meta{A}\eif\meta{B}, checked
		[\enot\meta{A} , just={$i$, \eif}]
		[     \meta{B} , just={$i$, \eif}]
	]
	\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\enot(\meta{A}\eif\meta{B}), checked
		[     \meta{A} , just={$i$, \enot\eif}
		[\enot\meta{B} , just={$i$, \enot\eif}
		]]
	]
	\end{prooftree}
}\\
\textbf{Negation}\\
{\begin{prooftree}
	{not line numbering}
	[\enot\enot\meta{A}, checked
		[\meta{A} , just={$i$, \enot\enot}]
	]
	\end{prooftree}
}\\
\textbf{Biconditional}\\
{\begin{prooftree}
	{not line numbering}
	[\meta{A}\eiff\meta{B}, checked
		[\meta{A}, just={$i$, \eiff}
		[\meta{B}, just={$i$, \eiff}
		]]
		[\enot\meta{A}
		[\enot\meta{B}
		]]
	]
	\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\enot(\meta{A}\eiff\meta{B}), checked
		[     \meta{A}, just={$i$, \enot\eiff}
		[\enot\meta{B}, just={$i$, \enot\eiff}
		]]
		[\enot\meta{A}
		[     \meta{B}
		]]
	]
	\end{prooftree}
}\\
\textbf{Negated Quantifier}\\
{\begin{prooftree}
	{not line numbering}
	[\enot\exists\script{x}\ \meta{A}
		[\forall\script{x}\ \enot\meta{A} , just={$i$ \enot\esome}]
	]
	\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\enot\forall\script{x}\ \meta{A}
		[\exists\script{x}\ \enot\meta{A} , just={$i$ \enot\eall}]
	]
\end{prooftree}
}\\
\textbf{Quantifier}\\
{\begin{prooftree}
	{not line numbering}
	[\exists\script{x}\meta{A}, checked={\script{a}}
	 [\meta{A}\substitution{x}{a}, just={$i$ \esome \script{a}}
 	  [ , just={(where \script{a} is new})]
	]]
\end{prooftree}
}
&
{\begin{prooftree}
	{not line numbering}
	[\forall\script{x}\meta{A}, subs={\script{a}}
	 [\meta{A}\substitution{x}{a}, just={$i$ \eall \script{a}}
 	  [ , just={(where \script{a} is old})]
	]]
\end{prooftree}
}
\end{tabular}

\newpage

\section*{Identity}
%\begin{center}
\begin{tabular*}{\textwidth}{rl}
\multicolumn{2}{c}{\textsc{Identity} (section \ref{sec.identity})}\\ \\
Only $j$ is $G$. & $\forall x(Gx \eiff x=j)$\\
Everything except $j$ is $G$. & $\forall x(x \neq j \eif Gx)$\\
%$j$ is more $R$ than anyone else. & $\forall x(x\neq j \eif Rjx)$\\
The $F$ is $G$. & $\exists x(Fx \eand \forall y(Fy \eif x=y) \eand Gx)$\\
%\multicolumn{2}{l}{`The F is not G' can be translated two ways:} \\
%It is not the case that the F is G. (wide)& $\enot\exists x(Fx \eand \forall y(Fy \eif x=y) \eand Gx)$\\
The $F$ is non-$G$. (narrow) & $\exists x(Fx \eand \forall y(Fy \eif x=y) \eand \enot Gx)$

\end{tabular*}

\subsection*{There are at least \blank\ $F$s.}
\label{summary.atleast}

\begin{ekey}
\item[one] $\exists xFx$
\item[two] $\exists x_1\exists x_2(Fx_1 \eand Fx_2 \eand x_1 \neq x_2)$
\item[three] $\exists x_1\exists x_2\exists x_3(Fx_1 \eand Fx_2 \eand Fx_3 \eand x_1 \neq x_2 \eand x_1 \neq x_3 \eand x_2 \neq x_3)$
%\item[four] $\exists x_1\exists x_2\exists x_3\exists x_4 (Fx_1 \eand Fx_2 \eand Fx_3 \eand Fx_4 \eand x_1 \neq x_2 \eand x_1 \neq x_3 \eand x_1 \neq x_4 \eand x_2 \neq x_3 \eand x_2 \neq x_4 \eand x_3 \neq x_4)$
\item[n] $\exists x_1\cdots\exists x_n(Fx_1 \eand\cdots\eand Fx_n \eand x_1 \neq x_2 \eand\cdots\eand x_{n-1}\neq x_n)$
\end{ekey}

\subsection*{There are at most \blank\ $F$s.}
\label{summary.atmost}

One way to say `at most $n$ things are $F$' is to put a negation sign in front of one of the symbolizations above and say `NOT at least $n+1$ things are $F$.' Equivalently:
\begin{ekey}
\item[one] $\forall x_1\forall x_2\bigl[(Fx_1 \eand Fx_2) \eif x_1=x_2\bigr]$
\item[two] $\forall x_1\forall x_2\forall x_3\bigl[(Fx_1 \eand Fx_2 \eand Fx_3) \eif (x_1=x_2 \eor x_1=x_3 \eor x_2=x_3)\bigr]$
%\item[three] $\forall x_1\forall x_2\forall x_3\forall x_4\bigl[(Fx_1 \eand Fx_2 \eand Fx_3 \eand Fx_4) \eif (x_1=x_2 \eor x_1=x_3 \eor x_1=x_4 \eor x_2=x_3 \eor x_2=x_4 \eor x_3=x_4)\bigr]$
\item[n]$\forall x_1\cdots\forall x_{n+1}
\bigl[(Fx_1\eand \cdots \eand Fx_{n+1}) \eif (x_1=x_2 \eor \cdots \eor x_n=x_{n+1})\bigr]$
\end{ekey}

\subsection*{There are exactly \blank\ $F$s.}
\label{summary.exactly}

One way to say `exactly $n$ things are $F$' is to say `at least $n$ things are $F$ AND at most $n$ things are $F$.' The following is shorter:
\begin{ekey}
\item[zero] $\enot \exists x Fx$
\item[one] $\exists x\bigl[Fx \eand \enot\exists y(Fy \eand x\neq y)\bigr]$
\item[two] $\exists x_1\exists x_2\bigl[(Fx_1 \eand Fx_2) \eand (x_1 \neq x_2) \eand \enot\exists y\bigl(Fy \eand y\neq x_1 \eand y \neq x_2\bigr) \bigr]$
%\item[three] $\exists x_1\exists x_2\exists x_3\bigl[Fx_1 \eand Fx_2 \eand Fx_3 \eand x_1 \neq x_2 \eand x_1 \neq x_3 \eand x_2 \neq x_3 \eand\\ \enot\exists y(Fy \eand y \neq x_1 \eand y \neq x_2 \eand y\neq x_3) \bigr]$
\item[n] $\exists x_1\cdots\exists x_n\bigl[(Fx_1 \eand\cdots\eand Fx_n)  \eand (x_1 \neq x_2 \eand\cdots\eand x_{n-1}\neq x_n) \eand\\
 \enot\exists y(Fy \eand y\neq x_1 \eand \cdots \eand y\neq x_n)\bigr]$
%\item[one] $\exists x\forall y\bigl[Fx \eand (Fy \eif y = x)\bigr]$
%\item[two] $\exists x\exists y\forall z\Bigl(Fx \eand Fy \eand \bigl[Fz \eif (z=x \eor z=y)\bigr] \eand x \neq y\Bigr)$
%\item[three] $\exists x_1\exists x_2\exists x_3\forall y\Bigl(Fx_1 \eand Fx_2 \eand Fx_3 \eand [Fy \eif (y=x_1 \eor y=x_2 \eor y=x_3)] \eand x_1 \neq x_2 \eand x_1 \neq x_3 \eand x_2 \neq x_3\Bigr)$
%\item[n] $\exists x_1\cdots\exists x_n\forall y\Bigl(Fx_1 \eand\cdots\eand Fx_n \eand \bigl[Fy \eif (y=x_1 \eor \cdots \eor y=x_n)\bigr] \eand x_1 \neq x_2 \eand\cdots\eand x_{n-1}\neq x_n\Bigr)$
\end{ekey}

\newpage

% Tree Rules

% Tree uses

\section*{Proving Logical Properties}
%\begin{table}
	Sometimes we should use a truth tree, and sometimes a model.
	\begin{center}
	\begin{tabular*}{\textwidth}{p{10em}|p{10em}|p{10em}|}
	\cline{2-3}
	 & {\centerline{YES}} & {\centerline{NO}}\\
	\cline{2-3}
	Is \script{A} a tautology? & close tree with root $\enot \script{A}$ & give a model in which \script{A} is false\\
	\cline{2-3}
	Is \script{A} a contradiction? &  close tree with root $\script{A}$ & give a model in which \script{A} is true\\
	\cline{2-3}
	Is \script{A} contingent? & give a model in which \script{A} is true and one in which \script{A} is false & close tree with root $\script{A}$ or root $\enot\script{A}$\\
	\cline{2-3}
	Are \script{A} and \script{B} equivalent? & close tree with root $\script{A}\eiff\script{B}$ & give a model in which \script{A} and \script{B} have different truth values\\
	\cline{2-3}
	Is the set $\{\script{A}_1,\ldots, \script{A}_n\}$ consistent? & give a model in which all $\script{A}_1,\ldots, \script{A}_n$ are true & close tree with root $\script{A}_1,\ldots, \script{A}_n$\\
	\cline{2-3}
	Is the argument $\script{A}_1,\ldots, \script{A}_n \therefore\ \script{C}$ valid? & close tree with root $\script{A}_1,\ldots, \script{A}_n, \enot\script{C}$ & give a model in which $\script{A}_1,\ldots, \script{A}_n$ is true and \script{C} is false\\
	\cline{2-3}
	\end{tabular*}
	\end{center}
%\end{table}

\vfill

\end{document}


\section{VariableGroups}
\label{sec:VariableGroups}

The \xmlNode{VariableGroups} block is an optional input for the convenience of the user.  It allows the
possibility of creating a collection of variables instead of re-listing all the variables in places throughout
the input file, such as DataObjects, ROMs, and ExternalModels.
%
Each entry in the \xmlNode{VariableGroups} block has a distinct name and list of each constituent variable in
the group.
%
Additionally, set operations can be used to construct variable groups from other variable groups, by listing
them in node text along with the operation to perform.
The following types of
set operations are included in RAVEN:
\begin{itemize}
  \item \texttt{+}, Union, the combination of all variables in the \xmlString{base} set and listed set,
  \item \texttt{-}, Complement, the relative complement of the listed set in the \xmlString{base} set,
  \item \texttt{\^}, Intersection, the variables common to both the \xmlString{base} and listed set,
  \item \texttt{\%}, Symmetric Difference, the variables in only either the \xmlString{base} or listed set,
    but not both.
\end{itemize}
Multiple set operations can be performed by separating them with commas in the text of the group node, whether
they be variable groups or single variables. In the event a circular dependency loop is detected, an error will be
raised. VariableGroups are evaluated in the order of entries listed in their node text.

When using the variable groups in a node, they can be listed alone or as part of a comma-separated list.  The
variable group name will only be substituted in the text of nodes, not attributes or tags.

Each \xmlNode{Group} node has the following attributes:
\vspace{-5mm}
\begin{itemize}
  \itemsep0em
  \item \xmlAttr{name}, \xmlDesc{required string attribute}, user-defined name
  of the group. This is the identifier that will be used elsewhere in the RAVEN input.
  %
\end{itemize}
\vspace{-5mm}

An example of constructing and using variable groups is listed here.  The variable groups \xmlString{x\_odd},
\xmlString{x\_even}, \xmlString{x\_first},  and  \xmlString{y\_group} are constructed independently, and the
remainder are examples of other operations.
\begin{lstlisting}[style=XML,morekeywords={name,file}] %moreemph={name,file}]
<Simulation>
  ...
  <VariableGroups>
    <Group name="x_odd"     >x1,x3,x5</Group>
    <Group name="x_even"    >x2,x4,x6</Group>
    <Group name="x_first"   >x1,x2,x3</Group>
    <Group name="y_group"   >y1,y2</Group>
    <Group name="add_remove">x_first,-x1,+ x4,+x5</Group>
    <Group name="union"     >x_odd,+x_even</Group>
    <Group name="complement">x_odd,-x_first</Group>
    <Group name="intersect" >x_even,^x_first</Group>
    <Group name="sym_diff"  >x_odd,% x_first</Group>
  </VariableGroups>
  ...
  <DataObjects>
    <PointSet name="dataset">
      <Input>union</Input>
      <Output>y_group</Output>
    </PointSet>
  </DataObjects>
  ...
</Simulation>
\end{lstlisting}


\section{Spectral clustering}
\label{sec:spectralclustering}
% Basic
Spectral clustering algorithm is a graph-based clustering algorithm of $n$ data points.
It make use of an $n \times n$ affinity matrix which is constructed after measuring pairwise similarity and distance between data points to form edges.
Unlike the other clustering algorithms, it can determine the number of clusters $k$ by using eigengap algorithm.
%It make use of similarity matrix which represents data points as vertices.
After that, it takes $k$ eigenvectors of corresponding to the $k$ largest eigenvalues of an affinity matrix as columns,
then uses $k$-way clustering algorithm in $k$ dimensions.
In short, it performs dimensionality reduction since $k < n$ then produces clusters in fewer dimensions.
Note that the number of cluster $k$ is the same as the number of column $k$ of reduced space.

The assumptions to the methods are that \begin{inparaenum}[\itshape a\upshape)]
%It involves taking top eigenvectors of an affinity matrix, which is transformed by calculating the similarity between objects in dataset, and then use graph cut algorithm.
\item minimizing normalized cut is equivalent to minimizing the probability that a random walk on the graph.
\item the larger the gap between eigenvalues of the graph, %$\lambda_{k}$ and $\lambda_{k+1}$,
the closer the piecewise-constant eigenvectors will be
\end{inparaenum}. \newline
%In this section, I describe the detail of the spectral clustering algorithm. More details can be found in \cite{ulrike07}.\newline
%In Section~\ref{subsec:eigengap}, I describes the eigengap algorithm.\newline
%In Section~\ref{subsec:multiclass}, I describes the multiclass spectral clustering algorithm.

%So it may be applied to image data but not to real network connection data.
% Although its performance is generally good, it is weak at noise.
% In what way they differ from what we do here
% Why is our approach better than what has done before. does it solve a partly new aspect of the problem or does it simply perform better
%It will measure pairwise similarity of data points. %like the other spectral clustering.
%In our implementation, we follow Shi's multiclass normalized cut algorithm \cite{jianbo03}.

\subsection{Eigengap algorithm}
\label{subsec:eigengap}
% Important concept - k -  to a reviewer first
The eigengap is a difference between two consecutive eigenvalues.
We can find the value of $k$ that maximizes the eigengap by following equation.
\begin{equation}
\Delta_{max} = \operatorname*{arg\,max}_{k} \Delta_k, \text{~~} \Delta_k = | \lambda_k - \lambda_{k-1} |
\end{equation}
where $\lambda$ is an eigenvalue and $k$ is a desirable choice of the number of clusterings \cite{ulrike07}.
This is important to understand that $k$ is the number of top eigenvalues determined by eigengap and is also the number of clusters.

\subsection{Multiclass spectral clustering algorithm}
\label{subsec:multiclass}
%\subsection{Algorithm}
%\subsection{Normalized Laplacian Matrix}
% Then, spectral clustering
Spectral clustering algorithms attempt to find $k$ subsets of data points which have the property that data points within a cluster are similar to each other than to data points in other clusters.
%In order to do this, a spectral clustering builds embedded space from the eigenvectors corresponding to the $k$ eigenvalues before it does $k$-way clustering.
%subsets, spectral clustering algorithm needs the normalized Laplacian $n \times n$ matrix $L$.

Let $A \in \mathbb{R}^{n \times n}$ is the affinity matrix where $n$ is the number of data points. It is defined as
\begin{equation}
\label{eq:sim}
A_{i,j} = \left\{
  \begin{array}{l l}
    sim(x_i, x_j) & \quad \text{for $x_j$ is a data point in neighbourhood of $x_i$}\\
    0 & \quad \text{otherwise}
  \end{array} \right.
\end{equation}
where neighbourhood means 8-nearest neighbourhood that is all 8 closest data points around the point $x_i$
and $sim$ is a cosine similarity function.
%In the paper, I use cosine similarity for similarity function $sim$. It is discussed in Section~\ref{subsec:normalabnormalsimilarity}.
%That is, edges of $A$ only if they are neighbourhood.
%In short $A_{i,j}$ is the pairwise similarity only if they are neighbourhood.
%I use nearest 8-neighborhood to construct graph by inserting edges between a node and its nearest 8-neighbours.
%For example, if there is a graph $G$ which has 100 nodes and they are fully connected, each node of nearest 8-neighborhood graph $\hat{G}$ will be connected to only 8 nodes that have highest weight among them.
Note that we are assuming that the graph is undirected which makes $A$ symmetric and a weight of an edge is a non-negative measure of similarity between the two vertices.
So higher weight implies greater similarity.
%and $W$ be the weighted adjacency matrix, such that $W_{i,i} = 0$ and $w_{i,j}$ is the weight of the edge between $v_i \in V$ and $v_j \in V$.
After then we get the normalized Laplacian matrix $L \in \mathbb{R}^{n \times n}$ as follows :
\begin{equation}
L = D^{-1/2} A D^{-1/2}
\end{equation}
where $D \in \mathbb{R}^{n \times n}, d_{i,i} = \sum_{j} A_{i,j}$ be the diagonal degree matrix.
%where $D$ is the diagonal degree matrix $d_{ii}$ is the detree of vertex $i$ defined as $d_{ii} = \sum_{j=1}^n$ and $W$ is the weighted adjacency matrix, such that $W_{ii} = 0$ and $w_{ij}$ is the weight of the edge between $v_i \in V$ and $v_j \in V$.
%%\subsection{Algorithm}
%A spectral clustering builds embedded space from the eigenvectors corresponding to the $k$ eigenvalues before it does $k$-way clustering.

We get the $k$ from $L$ with eigengap algorithm.
Then we get the matrix $V \in \mathbb{R}^{n \times k}$ with the eigenvectors as columns.
Spectral clustering interprets the rows of $V$ as new data points $Z_i \in \mathbb{R}^k$ where $i \in \{1, \cdots, n\}$
%A spectral clustering builds embedded space from the eigenvectors corresponding to the $k$ eigenvalues before it does $k$-way clustering.
%From $L$, we can get the eigenvalues and eigenvectors of Laplacian matrix,
and we can apply known outlier detection techniques \cite{knorr00} to the reduced $\mathbb{R}^{n \times k}$ space to produce $k$ clusters.

A spectral clustering has three issues.
First of all, eigengap algorithm helps us to pick proper $k$ value, but no such algorithm can be perfect especially if there is too much noises.
%We can check whether the result of eigengap is fine or not by threshold.
%In this paper, I use $\sqrt{n}$ where $n$ is the number of data points as threshold on $k$.
Secondly, the choice of similarity function has an important effect on the accuracy.
Thirdly, we need to choose proper clustering method.
%I follow $k$-class clustering approach as I mentioned before because I found recursive bipartite approach is not applicable for real data which has lots of noise.

%we need to find the eigenvalues and eigenvectors of Laplacian matrix to decompose do this.
%After we compute normalized graph Laplacian matrix, we can decompose the matrix.
%After we find them, we can build embedded space from the eigenvectors corresponding to the $k$ eigenvalues given by eigengap algorithm.
%After that, we can apply known outlier detection techniques \cite{knorr00} to the reduced $n \times k$ space to produce $k$ clusters.
\begin{figure}[ht]
\label{fig:spectralclustering}
\begin{mdframed}
\begin{enumerate}
\item[Input] : Similarity matrix $S \in \mathbb{R}^{n \times n}$, number $k$ of clusters.
\item[Step 1] : Construct the normalized graph Laplacian $L = D^{-1/2} A D^{-1/2}$.
%Construct the normalized graph Laplacian $L = D^{-1/2} A D^{-1/2} - W$, using the weighted $n \times n$ adjacency matrix $W$, where $w_{ij}$ is a function of $S_{ij}$ that gives non-negative weights. \\
\item[Step 2] : Find the $k$ eigenvectors $u_1, \cdots, u_k$ corresponding to the smallest $k$ eigenvalues that solve the generalized eigenvector problem $L u = \lambda D u$
\item[Step 3] : Let $U = R^{n \times k}$ be the matrix containing the eigenvectors $u_i$ as columns, and let $y_i \in R^k$ be the $i$th row of $U$.
\item[Step 4] : Cluster the points $(y_i)_{i=1,\cdots,n}$ in $\mathbb{R}^k$ using $k$-means clustering into clusters $C_1,\cdots,C_k$.
\item[Output] : Clusters $C_1, \cdots, C_k$
\end{enumerate}
\end{mdframed}
\caption{Overview of multiclass spectral clustering algorithm according to Shi}
\end{figure}
%A spectral clustering has three issues.
%First of all, eigengap does not pick $k$ value correctly if there is too much noises.
%We can check whether the result of eigengap is fine or not by threshold.
%In this paper, I use $\sqrt{n}$ where $n$ is the number of data points as threshold on $k$.
%Secondly, the choice of similarity function has an important effect on the accuracy.
%Thirdly, we need to choose proper clustering method.
%I follow $k$-class clustering approach as I mentioned before because I found recursive bipartite approach is not applicable for real data which has lots of noise.
%For clustering method, there is two ways to do it.
%First is a $k$-class clustering \cite{jianbo03} and the other is one by one iteratively until it makes $k$ clusters.
%The problem of latter one is that it is too weak for a noise.
%Also the number of cluster $k$ from its eigengap does not always best when the data have considerable noises.
%Therefore I follow multi-class approach since iterated one-to-one clustering is not applicable. %in this problem because of the limitation of eigensolver's sensitivity.
% I followed both way but one-by-one is sometimes really bad.