%!TEX root = forallxcam.tex
\part{Truth-functional logic}
\label{ch.TFL}

\chapter{First steps to symbolisation}

\section{Validity in virtue of form}\label{s:ValidityInVirtueOfForm}
Consider this argument:
	\begin{earg}
		\item[] It is raining outside.
		\item[] If it is raining outside, then Jenny is miserable.
		\item[So:] Jenny is miserable.
	\end{earg}
and another argument:
	\begin{earg}
		\item[] Jenny is an anarcho-syndicalist.
		\item[] If Jenny is an anarcho-syndicalist, then Dipan is an avid reader of Tolstoy.
		\item[So:] Dipan is an avid reader of Tolstoy.
	\end{earg}
Both arguments are valid, and there is a straightforward sense in which we can say that they share a common structure. We might express the structure thus:
	\begin{earg}
		\item[] A
		\item[] If A, then C
		\item[So:] C
	\end{earg}
This looks like an excellent argument \emph{structure}. Indeed, surely any argument with this \emph{structure} will be valid. And this is not the only good argument structure. Consider an argument like:
	\begin{earg}
		\item[] Jenny is either happy or sad.
		\item[] Jenny is not happy.
		\item[So:] Jenny is sad.
	\end{earg}
Again, this is a valid argument. The structure here is something like:
	\begin{earg}
		\item[] A or B
		\item[] not-A
		\item[So:] B
	\end{earg}
A superb structure! And here is a final example:
	\begin{earg}
		\item[] It's not the case that Jim both studied hard and acted in lots of plays.
		\item[] Jim studied hard
		\item[So:] Jim did not act in lots of plays.
	\end{earg}
This valid argument has a structure which we might represent thus:\newpage
	\begin{earg}
		\item[] not-(A and B)
		\item[] A
		\item[So:] not-B
	\end{earg}
The examples illustrate an important idea, which we might describe as \emph{validity in virtue of form}. The validity of the arguments just considered has nothing very much to do with the meanings of English expressions like `Jenny is miserable', `Dipan is an avid reader of Tolstoy', or `Jim acted in lots of plays'. If it has to do with meanings at all, it is with the meanings of phrases like `and', `or', `not,' and `if\ldots, then\ldots'.

In this chapter, I will develop a formal language which allows us to symbolise many arguments in such a way as to show that they are valid in virtue of their form. That language will be \emph{truth-functional logic}, or TFL.

\section{Validity for special reasons}
There are plenty of arguments that are valid, but not for reasons relating to their form. Take an example:
	\begin{earg}
		\item[] Juanita is a vixen
		\item[So:] Juanita is a fox
	\end{earg}
It is impossible for the premise to be true and the conclusion false. So the argument is valid. But the validity is not related to the form of the argument. Here is an invalid argument with the same form:
	\begin{earg}
		\item[] Juanita is a vixen
		\item[So:] Juanita is a cathedral
	\end{earg}
This might suggest that the validity of the first argument \emph{is} keyed to the meaning of the words `vixen' and `fox'. But, whether or not that is right, it is not simply the \emph{shape} of the argument that makes it valid. Equally, consider the argument:
	\begin{earg}
		\item[] The sculpture is green all over.
		\item[So:] The sculpture is not red all over.
	\end{earg}
Again, it seems impossible for the premise to be true and the conclusion false, for nothing can be both green all over and red all over. So the argument is valid. But here is an invalid argument with the same form:
	\begin{earg}
		\item[] The sculpture is green all over.
		\item[So:] The sculpture is not shiny all over.
	\end{earg}
The argument is invalid, since it is possible to be green all over and shiny all over. (I might paint my nails with an elegant shiny green varnish.) Plausibly, the validity of the first argument is keyed to the way that colours (or colour-words) interact. But,  whether or not that is right, it is not simply the \emph{shape} of the argument that makes it valid.

The important moral can be stated as follows. \emph{At best, TFL will help us to understand arguments that are valid due to their form.}

\section{Atomic sentences}
I started isolating the form of an argument, in \S\ref{s:ValidityInVirtueOfForm}, by replacing  \emph{subsentences} of sentences with individual letters. Thus in the first example of this section, `it is raining outside' is a subsentence of `If it is raining outside, then Jenny is miserable', and we replaced this subsentence with `A'.

Our artificial language, TFL, pursues this idea absolutely ruthlessly. We start with some \emph{atomic sentences}. These will be the basic building blocks out of which more complex sentences are built. We will use uppercase italic letters for atomic sentences of TFL. There are only twenty-six letters of the alphabet, but there is no limit to the number of atomic sentences that we might want to consider. By adding subscripts to letters, we obtain new atomic sentences. So, here are five different atomic sentences of TFL:
	$$A, P, P_1, P_2, A_{234}$$
We shall use atomic sentence to represent, or symbolise, certain English sentences. To do this, we provide a \define{symbolisation key}, such as the following:
	\begin{ekey}
		\item[A] It is raining outside
		\item[C] Jenny is miserable
	\end{ekey}
In doing this, we are not fixing this symbolisation \emph{once and for all}. We are just saying that, for the time being, we shall think of the atomic sentence of TFL, `$A$', as symbolising the English sentence `It is raining outside', and the atomic sentence of TFL, `$C$', as symbolising the English sentence `Jenny is miserable. Later, when we are dealing with different sentences or different arguments, we can provide a new symbolisation key; as it might be:
	\begin{ekey}
		\item[A] Jenny is an anarcho-syndicalist
		\item[C] Dipan is an avid reader of Tolstoy
	\end{ekey}
But it is important to understand that whatever structure an English sentence might have is lost when it is symbolised by an atomic sentence of TFL. From the point of view of TFL, an atomic sentence is just a letter. It can be used to build more complex sentences, but it cannot be taken apart.

\chapter{Connectives}\label{s:TFLConnectives}
In the previous section, we considered symbolising fairly basic English sentences with atomic sentences of TFL. This leaves us wanting to deal with the English expressions `and', `or', `not', and so forth. These are \emph{connectives}---they can be used to form new sentences out of old ones. And in TFL, we shall make use of logical connectives to build complex sentences from atomic components. There are five logical connectives in TFL. This table summarises them, and they are explained throughout this section.

	\begin{table}[h]
	\center
	\begin{tabular}{l l l}

	\textbf{symbol}&\textbf{what it is called}&\textbf{rough meaning}\\
	\hline
	\enot&negation&`It is not the case that$\ldots$'\\
	\eand&conjunction&`Both$\ldots$\ and $\ldots$'\\
	\eor&disjunction&`Either$\ldots$\ or $\ldots$'\\
	\eif&conditional&`If $\ldots$\ then $\ldots$'\\
	\eiff&biconditional&`$\ldots$ if and only if $\ldots$'\\

	\end{tabular}
	\end{table}

\section{Negation}
Consider how we might symbolise these sentences:
	\begin{earg}
	\item[\ex{not1}] Mary is in Barcelona.
	\item[\ex{not2}] It is not the case that Mary is in Barcelona.
	\item[\ex{not3}] Mary is not in Barcelona.
	\end{earg}
In order to symbolise sentence \ref{not1}, we will need an atomic sentence. We might offer this symbolisation key:
	\begin{ekey}
		\item[B] Mary is in Barcelona.
	\end{ekey}
Since sentence \ref{not2} is obviously related to the sentence \ref{not1}, we shall not want to symbolise it with a completely different sentence. Roughly, sentence \ref{not2} means something like `It is not the case that B'. In order to symbolise this, we need a symbol for negation. We will use `\enot'. Now we can symbolise sentence \ref{not2} with `$\enot B$'.

Sentence \ref{not3} also contains the word `not'. And it is obviously equivalent to sentence \ref{not2}. As such, we can also symbolise it with `$\enot B$'.
\factoidbox{
A sentence can be symbolised as $\enot\meta{A}$ if it can be paraphrased in English as `It is not the case that\ldots'.
}
It will help to offer a few more examples:
	\begin{earg}
		\item[\ex{not4}] The widget can be replaced.
		\item[\ex{not5}] The widget is irreplaceable.
		\item[\ex{not5b}] The widget is not irreplaceable.
	\end{earg}
Let us use the following representation key:
	\begin{ekey}
		\item[R] The widget is replaceable
	\end{ekey}
Sentence \ref{not4} can now be symbolised by `$R$'. Moving on to sentence \ref{not5}: saying the widget is irreplaceable means that it is not the case that the widget is replaceable. So even though sentence \ref{not5} does not contain the word `not', we shall symbolise it as follows: `$\enot R$'.

Sentence \ref{not5b} can be paraphrased as `It is not the case that the widget is irreplaceable.' Which can again be paraphrased as `It is not the case that it is not the case that the widget is replaceable'. So we might symbolise this English sentence with the TFL sentence `$\enot\enot R$'. %(In English, double-negation tends to cancel out: sentence \ref{not5b} says something very similar to `the widget is replaceable'.)

But some care is needed when handling negations. Consider:
	\begin{earg}
		\item[\ex{not6}] Jane is happy.
		\item[\ex{not7}] Jane is unhappy.
	\end{earg}
If we let the TFL-sentence `$H$' symbolise  `Jane is happy', then we can symbolise sentence \ref{not6} as `$H$'. However, it would be a mistake to symbolise sentence \ref{not7} with `$\enot{H}$'. If Jane is unhappy, then she is not happy; but sentence \ref{not7} does not mean the same thing as `It is not the case that Jane is happy'. Jane might be neither happy nor unhappy; she might be in a state of blank indifference. In order to symbolise sentence \ref{not7}, then, we would need a new atomic sentence of TFL.

\section{Conjunction}\label{s:ConnectiveConjunction}
Consider these sentences:
	\begin{earg}
		\item[\ex{and1}]Adam is athletic.
		\item[\ex{and2}]Barbara is athletic.
		\item[\ex{and3}]Adam is athletic, and also Barbara is athletic.
	\end{earg}
We will need separate atomic sentences of TFL to symbolise sentences \ref{and1} and \ref{and2}; perhaps
	\begin{ekey}
		\item[A] Adam is athletic.
		\item[B] Barbara is athletic.
	\end{ekey}
Sentence \ref{and1} can now be symbolised as `$A$', and sentence \ref{and2} can be symbolised as `$B$'. Sentence \ref{and3} roughly says `A and B'. We need another symbol, to deal with `and'. We will use `\eand'. Thus we will symbolise it as `$(A\eand B)$'. This connective is called \define{conjunction}. We also say that `$A$' and `$B$' are the two \define{conjuncts} of the conjunction `$(A \eand B)$'.

Notice that we make no attempt to symbolise the word `also' in sentence \ref{and3}. Words like `both' and `also' function to draw our attention to the fact that two things are being conjoined. Maybe they affect the emphasis of a sentence. But we will not (and cannot) symbolise such things in TFL.

Some more examples will bring out this point:
	\begin{earg}
		\item[\ex{and4}]Barbara is athletic and energetic.
		\item[\ex{and5}]Barbara and Adam are both athletic.
		\item[\ex{and6}]Although Barbara is energetic, she is not athletic.
	\item[\ex{and7}]Adam is athletic, but Barbara is more athletic than him.
	\end{earg}
Sentence \ref{and4} is obviously a conjunction. The sentence says two things (about Barbara). In English, it is permissible to refer to Barbara only once. It \emph{might} be tempting to think that we need to symbolise sentence \ref{and4} with something along the lines of `$B$ and energetic'. This would be a mistake. Once we symbolise part of a sentence as `$B$', any further structure is lost. `$B$' is an atomic sentence of TFL. Conversely, `energetic' is not an English sentence at all. What we are aiming for is something like `$B$ and Barbara is energetic'. So we need to add another sentence letter to the symbolisation key. Let `$E$' symbolise `Barbara is energetic'. Now the entire sentence can be symbolised as `$(B\eand E)$'.

Sentence \ref{and5} says one thing about two different subjects. It says of both Barbara and Adam that they are athletic, and in English we use the word `athletic' only once. The sentence can be paraphrased as `Barbara is athletic, and Adam is athletic'. We can symbolise this in TFL as `$(B\eand A)$', using the same symbolisation key that we have been using.

Sentence \ref{and6} is slightly more complicated. The word `although' sets up a contrast between the first part of the sentence and the second part. Nevertheless, the sentence tells us both that Barbara is energetic and that she is not athletic. In order to make each of the conjuncts an atomic sentence, we need to replace `she' with `Barbara'. So we can paraphrase sentence \ref{and6} as, `\emph{Both} Barbara is energetic, \emph{and} Barbara is not athletic'. The second conjunct contains a negation, so we paraphrase further: `\emph{Both} Barbara is energetic \emph{and} \emph{it is not the case that} Barbara is athletic'. And now we can symbolise this with the TFL sentence `$(E\eand\enot B)$'. Note that we have lost all sorts of nuance in this symbolisation. There is a distinct difference in tone between sentence \ref{and6} and `Both Barbara is energetic and it is not the case that Barbara is athletic'. TFL does not (and cannot) preserve these nuances.

Sentence \ref{and7} raises similar issues. There is a contrastive structure, but this is not something that TFL can deal with. So we can paraphrase the sentence as `\emph{Both} Adam is athletic, \emph{and} Barbara is more athletic than Adam'. (Notice that we once again replace the pronoun `him' with `Adam'.) How should we deal with the second conjunct? We already have the sentence letter `$A$', which is being used to symbolise `Adam is athletic', and the sentence `$B$' which is being used to symbolise `Barbara is athletic'; but neither of these concerns their relative athleticity. So, to to symbolise the entire sentence, we need a new sentence letter. Let the TFL sentence `$R$' symbolise the English sentence `Barbara is more athletic than Adam'. Now we can symbolise sentence \ref{and7} by `$(A \eand R)$'.
	\factoidbox{
		A sentence can be symbolised as $(\meta{A}\eand\meta{B})$ if it can be paraphrased in English as `Both\ldots, and\ldots', or as `\ldots, but \ldots', or as `although \ldots, \ldots'.
	}
You might be wondering why I have put \emph{brackets} around the conjunctions. My reasons can be brought out by thinking about negation interacts with conjunction. Consider:
	\begin{earg}
		\item[\ex{negcon1}] It's not the case that you will get both soup and salad.
		\item[\ex{negcon2}] You will not get soup but you will get salad.
	\end{earg}
Sentence \ref{negcon1} can be paraphrased as `It is not the case that: both you will get soup and you will get salad'. Using this symbolisation key:
	\begin{ekey}
		\item[S_1] You get soup.
		\item[S_2] You get salad.
	\end{ekey}
we would symbolise `both you will get soup and you will get salad' as `$(S_1 \eand S_2)$'. To symbolise sentence \ref{negcon1}, then, we simply negate the whole sentence, thus: `$\enot (S_1 \eand S_2)$'.

Sentence \ref{negcon2} is a conjunction: you \emph{will not} get soup, and you \emph{will} get salad. `You will not get soup' is symbolised by `$\enot S_1$'. So to symbolise sentence \ref{negcon2} itself, we offer `$(\enot S_1 \eand S_2)$'.

These English sentences are very different, and their symbolisations differ accordingly. In one of them, the entire conjunction is negated. In the other, just one conjunct is negated. Brackets help us to keep track of things like the \emph{scope} of the negation.

\section{Disjunction}
Consider these sentences:
	\begin{earg}
		\item[\ex{or1}]Either Denison will play golf with me, or he will watch movies.
		\item[\ex{or2}]Either Denison or Ellery will play golf with me.
	\end{earg}
For these sentences we can use this symbolisation key:
	\begin{ekey}
		\item[D] Denison will play golf with me.
		\item[E] Ellery will play golf with me.
		\item[M] Denison will watch movies.
	\end{ekey}
However, we shall again need to introduce a new symbol. Sentence \ref{or1} is symbolised by `$(D \eor M)$'. The connective is called \define{disjunction}. We also say that `$D$' and `$M$' are the \define{disjuncts} of the disjunction `$(D \eor M)$'.

Sentence \ref{or2} is only slightly more complicated. There are two subjects, but the English sentence only gives the verb once. However, we can paraphrase sentence \ref{or2} as `Either Denison will play golf with me, or Ellery will play golf with me'. Now we can obviously symbolise it by `$(D \eor E)$' again.
	\factoidbox{
		A sentence can be symbolised as $(\meta{A}\eor\meta{B})$ if it can be paraphrased in English as `Either\ldots, or\ldots.'
	}
Sometimes in English, the word `or' excludes the possibility that both disjuncts are true. This is called an \define{exclusive or}.  An \emph{exclusive or} is clearly intended when it says, on a restaurant menu, `Entrees come with either soup or salad': you may have soup; you may have salad; but, if you want \emph{both} soup \emph{and} salad, then you have to pay extra.

At other times, the word `or' allows for the possibility that both disjuncts might be true. This is probably the case with sentence \ref{or2}, above. I might play golf with Denison, with Ellery, or with both Denison and Ellery. Sentence \ref{or2} merely says that I will play with \emph{at least} one of them. This is an \define{inclusive or}. The TFL symbol `\eor' always symbolises an \emph{inclusive or}.

It will also help to see how negation interacts with disjunction. Consider:
	\begin{earg}
		\item[\ex{or3}] Either you will not have soup, or you will not have salad.
		\item[\ex{or4}] You will have neither soup nor salad.
		\item[\ex{or.xor}] You get either soup or salad, but not both.
	\end{earg}
Using the same symbolisation key as before, sentence \ref{or3} can be paraphrased in this way: `\emph{Either} it is not the case that you get soup, \emph{or} it is not the case that you get salad'. To symbolise this in TFL, we need both disjunction and negation. `It is not the case that you get soup' is symbolised by `$\enot S_1$'. `It is not the case that you get salad' is symbolised by `$\enot S_2$'. So sentence \ref{or3} itself is symbolised by `$(\enot S_1 \eor \enot S_2)$'.

Sentence \ref{or4} also requires negation. It can be paraphrased as, `\emph{It is not the case that}: either you get soup or you get salad'. Since this negates the entire disjunction, we symbolise sentence \ref{or4} with `$\enot (S_1 \eor S_2)$'.

Sentence \ref{or.xor} is an \emph{exclusive or}. We can break the sentence into two parts. The first part says that you get one or the other. We symbolise this as `$(S_1 \eor S_2)$'. The second part says that you do not get both. We can paraphrase this as: `It is not the case that both you get soup and you get salad'. Using both negation and conjunction, we symbolise this with `$\enot(S_1 \eand S_2)$'. Now we just need to put the two parts together. As we saw above, `but' can usually be symbolised with `$\eand$'. So sentence \ref{or.xor} can be symbolised as `$((S_1 \eor S_2) \eand \enot(S_1 \eand S_2))$'.

This last example shows something important. Although the TFL symbol `\eor' always symbolises \emph{inclusive or}, we can symbolise an \emph{exclusive or} in {TFL}. We just have to use a few other symbols too.

\section{Conditional}
Consider these sentences:
	\begin{earg}
		\item[\ex{if1}] If Jean is in Paris, then Jean is in France.
		\item[\ex{if2}] Jean is in France only if Jean is in Paris.
	\end{earg}
Let's use the following symbolisation key:
	\begin{ekey}
		\item[P] Jean is in Paris.
		\item[F] Jean is in France
	\end{ekey}
Sentence \ref{if1} is roughly of this form: `if P, then F'. We will use the symbol `\eif' to symbolise this `if\ldots, then\ldots' structure. So we symbolise sentence \ref{if1} by `$(P\eif F)$'. The connective is called \define{the conditional}. Here, `$P$' is called the \define{antecedent} of the conditional `$(P \eif F)$', and `$F$' is called the \define{consequent}.

Sentence \ref{if2} is also a conditional. Since the word `if' appears in the second half of the sentence, it might be tempting to symbolise this in the same way as sentence \ref{if1}. That would be a mistake. My knowledge of geography tells me that sentence \ref{if1} is unproblematically true: there is no way for Jean to be in Paris that doesn't involve Jean being in France. But sentence \ref{if2} is not so straightforward: were  Jean in Dieppe, Lyons, or Toulouse, Jean would be in France without being in Paris, thereby rendering sentence \ref{if2} false. Since geography alone dictates the truth of sentence \ref{if1}, whereas travel plans (say) are needed to know the truth of sentence \ref{if2}, they must mean different things.

In fact, sentence \ref{if2} can be paraphrased as `If Jean is in France, then Jean is in Paris'. So we can symbolise it by `$(F \eif P)$'.
	\factoidbox{
		A sentence can be symbolised as $(\meta{A} \eif \meta{B})$ if it can be paraphrased in English as `If A, then B' or `A only if B'.
	}
\noindent In fact, the conditional can represent many English expressions. Consider:
	\begin{earg}
		\item[\ex{ifnec1}] For Jean to be in Paris, it is necessary that Jean be in France.
		\item[\ex{ifnec2}] It is a necessary condition on Jean's being in Paris that she be in France.
		\item[\ex{ifsuf1}] For Jean to be in France, it is sufficient that Jean be in Paris.
		\item[\ex{ifsuf2}] It is a sufficient condition on Jean's being in France that she be in Paris.
	\end{earg}
If we think about it, all four of these sentences mean the same as  `If Jean is in Paris, then Jean is in France'. So they can all be symbolised by `$(P \eif F)$'.

It is important to bear in mind that the connective `\eif' tells us only that, if the antecedent is true, then the consequent is true. It says nothing about a \emph{causal} connection between two events (for example). In fact, we lose a huge amount when we use `$\eif$' to symbolise English conditionals. I shall return to this in \S\S\ref{s:IndicativeSubjunctive} and \ref{s:ParadoxesOfMaterialConditional}.

\section{Biconditional}
Consider these sentences:
	\begin{earg}
		\item[\ex{iff1}] Shergar is a horse only if it he is a mammal
		\item[\ex{iff2}] Shergar is a horse if he is a mammal
		\item[\ex{iff3}] Shergar is a horse if and only if he is a mammal
	\end{earg}
We shall use the following symbolisation key:
	\begin{ekey}
		\item[H] Shergar is a horse
		\item[M] Shergar is a mammal
	\end{ekey}
For reasons discussed above, sentence \ref{iff1} can be symbolised by `$(H \eif M)$'.

Sentence \ref{iff2} is importantly different. It can be paraphrased as, `If Shergar is a mammal then Shergar is a horse'. So it can be symbolised by `$(M\eif H)$'.

Sentence \ref{iff3} says something stronger than either \ref{iff1} or \ref{iff2}. It can be paraphrased as `Shergar is a horse if he is a mammal, and Shergar is a horse only if Shergar is a mammal'. This is just the conjunction of sentences \ref{iff1} and \ref{iff2}. So we can symbolise it as `$((H \eif M) \eand (M \eif H))$'. We call this a \define{biconditional}, because it amounts to stating both directions of the conditional.

We could treat every biconditional this way. So, just as we do not need a new TFL symbol to deal with \emph{exclusive or}, we do not really need a new TFL symbol to deal with biconditionals. However, we will use `\eiff' to symbolise the biconditional. So we can symbolise sentence \ref{iff3} with the TFL sentence `$(H \eiff M)$'.

The expression `if and only if' occurs a lot in philosophy and logic. For brevity, it is often abbreviated with a single, snappy word, `iff'. I shall follow this practice. So `if' with only \emph{one} `f' is the English conditional. But `iff' with \emph{two} `f's is the English biconditional. Armed with this we can say:
	\factoidbox{
		A sentence can be symbolised as $(\meta{A} \eiff \meta{B})$ if it can be paraphrased in English as `A iff B'; that is, as `A if and only if B'.
	}
A word of caution. Ordinary speakers of English often use `if \ldots, then\ldots' when they really mean to use something more like `\ldots if and only if \ldots'. Perhaps your parents told you, when you were a child: `if you don't eat your greens, you won't get any pudding'. Suppose you ate your greens, but that your then parents refused to give you any pudding, on the grounds that they were only committed to the \emph{conditional} (roughly `if you get pudding, then you will have eaten your greens'), rather than the biconditional (roughly, `you get pudding iff you eat your greens'). Well, a tantrum would rightly ensue. So, be aware of this when interpreting people; but in your own writing, make sure to use the biconditional iff you mean to.

\section{Unless}
We have now seen all of the connectives of TFL. We can use them together to symbolise many kinds of sentences. But some cases are harder than others. And a typically nasty case is the English-language connective `unless':
\begin{earg}
\item[\ex{unless1}] Unless you wear a jacket, you will catch a cold.
\item[\ex{unless2}] You will catch a cold unless you wear a jacket.
\end{earg}
These two sentences are clearly equivalent. To symbolise them, we shall use the symbolisation key:
	\begin{ekey}
		\item[J] You will wear a jacket.
		\item[D] You will catch a cold.
	\end{ekey}
Both sentences mean that if you do not wear a jacket, then you will catch a cold. With this in mind, we might symbolise them as `$(\enot J \eif D)$'.

Equally, both sentences mean that if you do not catch a cold, then you must have worn a jacket. With this in mind, we might symbolise them as `$(\enot D \eif J)$'.

Equally, both sentences mean that either you will wear a jacket or you will catch a cold. With this in mind, we might symbolise them as `$(J \eor D)$'.

All three are correct symbolisations. Indeed, in chapter \ref{ch.TruthTables} we shall see that all three symbolisations are equivalent in TFL. For simplicity, then:
	\factoidbox{
		If a sentence can be paraphrased as `Unless A, B,' then it can be symbolised as $(\meta{A}\eor\meta{B})$.
	}
Again, though, there is a little complication. `Unless' can be symbolised as a conditional; but as I said above, people often use the conditional (on its own) when they mean to use the biconditional. Equally, `unless' can be symbolised as a disjunction; but there are two kinds of disjunction (exclusive and inclusive). So it will not surprise you to discover that ordinary speakers of English often use `unless' to mean something more like the biconditional, or like exclusive disjunction. Suppose I say: `I shall go running unless it rains'. I probably mean something like `I shall go running iff it does not rain' (i.e.\ the biconditional), or  `either I shall go running or it will rain, but not both' (i.e.\ exclusive disjunction).

Again: be aware of this when interpreting what other people have said, but be precise in your own writing. Unless you want to be ambiguous.

\practiceproblems
\problempart Using the symbolisation key given, symbolise each English sentence in TFL.\label{pr.monkeysuits}
	\begin{ekey}
		\item[M] Those creatures are men in suits.
		\item[C] Those creatures are chimpanzees.
		\item[G] Those creatures are gorillas.
	\end{ekey}
\begin{earg}
\item Those creatures are not men in suits.
\item Those creatures are men in suits, or they are not.
\item Those creatures are either gorillas or chimpanzees.
\item Those creatures are neither gorillas nor chimpanzees.
\item If those creatures are chimpanzees, then they are neither gorillas nor men in suits.
\item Unless those creatures are men in suits, they are either chimpanzees or they are gorillas.
\end{earg}

\problempart Using the symbolisation key given, symbolise each English sentence in TFL.
\begin{ekey}
\item[A] Mister Ace was murdered.
\item[B] The butler did it.
\item[C] The cook did it.
\item[D] The Duchess is lying.
\item[E] Mister Edge was murdered.
\item[F] The murder weapon was a frying pan.
\end{ekey}
\begin{earg}
\item Either Mister Ace or Mister Edge was murdered.
\item If Mister Ace was murdered, then the cook did it.
\item If Mister Edge was murdered, then the cook did not do it.
\item Either the butler did it, or the Duchess is lying.
\item The cook did it only if the Duchess is lying.
\item If the murder weapon was a frying pan, then the culprit must have been the cook.
\item If the murder weapon was not a frying pan, then the culprit was either the cook or the butler.
\item Mister Ace was murdered if and only if Mister Edge was not murdered.
\item The Duchess is lying, unless it was Mister Edge who was murdered.
\item If Mister Ace was murdered, he was done in with a frying pan.
\item Since the cook did it, the butler did not.
\item Of course the Duchess is lying!
\end{earg}
\problempart Using the symbolisation key given, symbolise each English sentence in TFL.\label{pr.avacareer}
	\begin{ekey}
		\item[E_1] Ava is an electrician.
		\item[E_2] Harrison is an electrician.
		\item[F_1] Ava is a firefighter.
		\item[F_2] Harrison is a firefighter.
		\item[S_1] Ava is satisfied with her career.
		\item[S_2] Harrison is satisfied with his career.
	\end{ekey}
\begin{earg}
\item Ava and Harrison are both electricians.
\item If Ava is a firefighter, then she is satisfied with her career.
\item Ava is a firefighter, unless she is an electrician.
\item Harrison is an unsatisfied electrician.
\item Neither Ava nor Harrison is an electrician.
\item Both Ava and Harrison are electricians, but neither of them find it satisfying.
\item Harrison is satisfied only if he is a firefighter.
\item If Ava is not an electrician, then neither is Harrison, but if she is, then he is too.
\item Ava is satisfied with her career if and only if Harrison is not satisfied with his.
\item If Harrison is both an electrician and a firefighter, then he must be satisfied with his work.
\item It cannot be that Harrison is both an electrician and a firefighter.
\item Harrison and Ava are both firefighters if and only if neither of them is an electrician.
\end{earg}

\problempart
\label{pr.spies}
Give a symbolisation key and symbolise the following English sentences in TFL.
\begin{earg}
\item Alice and Bob are both spies.
\item If either Alice or Bob is a spy, then the code has been broken.
\item If neither Alice nor Bob is a spy, then the code remains unbroken.
\item The German embassy will be in an uproar, unless someone has broken the code.
\item Either the code has been broken or it has not, but the German embassy will be in an uproar regardless.
\item Either Alice or Bob is a spy, but not both.
\end{earg}

\problempart Give a symbolisation key and symbolise the following English sentences in TFL.
\begin{earg}
\item If there is food to be found in the pridelands, then Rafiki will talk about squashed bananas.
\item Rafiki will talk about squashed bananas unless Simba is alive.
\item Rafiki will either talk about squashed bananas or he won't, but there is food to be found in the pridelands regardless.
\item Scar will remain as king if and only if there is food to be found in the pridelands.
\item If Simba is alive, then Scar will not remain as king.
\end{earg}

\problempart
For each argument, write a symbolisation key and symbolise all of the sentences of the argument in TFL.
\begin{earg}
\item If Dorothy plays the piano in the morning, then Roger wakes up cranky. Dorothy plays piano in the morning unless she is distracted. So if Roger does not wake up cranky, then Dorothy must be distracted.
\item It will either rain or snow on Tuesday. If it rains, Neville will be sad. If it snows, Neville will be cold. Therefore, Neville will either be sad or cold on Tuesday.
\item If Zoog remembered to do his chores, then things are clean but not neat. If he forgot, then things are neat but not clean. Therefore, things are either neat or clean; but not both.
\end{earg}

\problempart
We symbolised an \emph{exclusive or} using `$\eor$', `$\eand$', and `$\enot$'. How could you symbolise an \emph{exclusive or} using only two connectives? Is there any way to symbolise an \emph{exclusive or} using only one connective?

\chapter{Sentences of TFL}\label{s:TFLSentences}
The sentence `either apples are red, or berries are blue' is a sentence of English, and the sentence `$(A\eor B)$' is a sentence of TFL. Although we can identify sentences of English when we encounter them, we do not have a formal definition of `sentence of English'. But in this chapter, I will \emph{define} exactly what will count as a sentence of TFL. This is one respect in which a formal language like TFL is more precise than a natural language like English.

\section{Expressions}
We have seen that there are three kinds of symbols in TFL:
\begin{center}
\begin{tabular}{l l}
Atomic sentences & $A,B,C,\ldots,Z$\\
with subscripts, as needed & $A_1, B_1,Z_1,A_2,A_{25},J_{375},\ldots$\\
\\
Connectives & $\enot,\eand,\eor,\eif,\eiff$\\
\\
Brackets &( , )\\
\end{tabular}
\end{center}
Define an \define{expression of TFL} as any string of symbols of TFL. So: write down any sequence of symbols of TFL, in any order, and you have an expression of TFL.

\section{Sentences}\label{tfl:SentencesDefined}
Given what we just said, `$(A \eand B)$' is an expression of TFL, and so is `$\lnot)(\eor()\eand(\enot\enot())((B$'. But the former is a \emph{sentence}, and the latter is \emph{gibberish}. We want some rules to tell us which TFL expressions are sentences.

Obviously, individual atomic sentences like `$A$' and `$G_{13}$' should count as sentences. We can form further sentences out of these by using the various connectives. Using negation, we can get `$\enot A$' and `$\enot G_{13}$'. Using conjunction, we can get `$(A \eand G_{13})$', `$(G_{13} \eand A)$', `$(A \eand A)$', and `$(G_{13} \eand G_{13})$'. We could also apply negation repeatedly to get sentences like `$\enot \enot A$' or apply negation along with conjunction to get sentences like `$\enot(A \eand G_{13})$' and `$\enot(G_{13} \eand \enot G_{13})$'. The possible combinations are endless, even starting with just these two sentence letters, and there are infinitely many sentence letters. So there is no point in trying to list all of the sentences one by one.

Instead, we will describe the process by which sentences can be \emph{constructed}. Consider negation: Given any sentence \meta{A} of TFL, $\enot\meta{A}$ is a sentence of TFL. (Why the funny fonts? I return to this in \S\ref{s:UseMention}.)

We can say similar things for each of the other connectives. For instance, if \meta{A} and \meta{B} are sentences of TFL, then $(\meta{A}\eand\meta{B})$ is a sentence of TFL. Providing clauses like this for all of the connectives, we arrive at the following formal definition for a \define{sentence of TFL}:
	\factoidbox{
	\begin{enumerate}
		\item Every atomic sentence is a sentence.
		\item If \meta{A} is a sentence, then $\enot\meta{A}$ is a sentence.
		\item If \meta{A} and \meta{B} are sentences, then $(\meta{A}\eand\meta{B})$ is a sentence.
		\item If \meta{A} and \meta{B} are sentences, then $(\meta{A}\eor\meta{B})$ is a sentence.
		\item If \meta{A} and \meta{B} are sentences, then $(\meta{A}\eif\meta{B})$ is a sentence.
		\item If \meta{A} and \meta{B} are sentences, then $(\meta{A}\eiff\meta{B})$ is a sentence.
		\item Nothing else is a sentence.
	\end{enumerate}
	}
Definitions like this are called \emph{recursive}. Recursive definitions begin with some specifiable base elements, and then present ways to generate indefinitely many more elements by compounding together previously established ones. To give you a better idea of what a recursive definition is, consider a recursive definition of the notion of \emph{an ancestor of mine}. We specify a base clause.
	\begin{ebullet}
		\item My parents are ancestors of mine.
	\end{ebullet}
and then offer further clauses like:
	\begin{ebullet}
		\item If x is an ancestor of mine, then x's parents are ancestors of mine.
		\item Nothing else is an ancestor of mine.
	\end{ebullet}
Using this definition, we can easily check to see whether someone is my ancestor: just check whether she is the parent of the parent of\ldots one of my parents. And the same is true for our recursive definition of sentences of TFL. Just as the recursive definition allows complex sentences to be built up from simpler parts, the definition allows us to decompose sentences into their simpler parts. And if we ultimately get down to atomic sentences, then we are ok.

Let's put this into practice by considering some examples.

Suppose we want to know whether or not `$\enot \enot \enot D$' is a sentence of TFL. Looking at the second clause of the definition, we know that `$\enot \enot \enot D$' is a sentence \emph{if} `$\enot \enot D$' is a sentence. So now we need to ask whether or not `$\enot \enot D$' is a sentence. Again looking at the second clause of the definition, `$\enot \enot D$' is a sentence \emph{if} `$\enot D$' is. Again, `$\enot D$' is a sentence \emph{if} `$D$' is a sentence. Now `$D$' is an atomic sentence of TFL, so we know that `$D$' is a sentence by the first clause of the definition. So for a compound sentence like `$\enot \enot \enot D$', we must apply the definition repeatedly. Eventually we arrive at the atomic sentences from which the sentence is built up.

Next, consider the example `$\enot (P \eand \enot (\enot Q \eor R))$'. Looking at the second clause of the definition, this is a sentence if `$(P \eand \enot (\enot Q \eor R))$' is. And this is a sentence if \emph{both} `$P$' \emph{and} `$\enot (\enot Q \eor R)$' are sentences. The former is an atomic sentence, and the latter is a sentence if `$(\enot Q \eor R)$' is a sentence. It is. Looking at the fourth clause of the definition, this is a sentence if both `$\enot Q$' and `$R$' are sentences. And both are!

Ultimately, every sentence is constructed nicely out of atomic sentences. When we are dealing with a \emph{sentence} other than an atomic sentence, we can see that there must be some sentential connective that was introduced \emph{most recently}, when constructing the sentence. We call that the \define{main logical operator} of the sentence. In the case of `$\enot\enot\enot D$', the main logical operator is the very first `$\enot$' sign. In the case of `$(P \eand \enot (\enot Q \eor R))$', the main logical operator is `$\eand$'. In the case of `$((\enot E \eor F) \eif \enot\enot G)$', the main logical operator is `$\eif$'.

As a general rule, you can find the main logical operator for a sentence by using the following method:
\begin{ebullet}
	\item If the first symbol in the sentence is `$\enot$', then that is the main logical operator
	\item Otherwise, start counting the brackets. For each open-bracket, i.e.\ `(', add $1$; for each closing-bracket, i.e.\ `$)$', subtract $1$. When your count is at exactly $1$, the first operator you hit (\emph{apart} from a `$\enot$') is the main logical operator.
\end{ebullet}
(Note: if you do use this method, then make sure to included \emph{all} the brackets in the sentence, rather than omitting some as per the conventions of \S\ref{TFLconventions}!)

The recursive structure of sentences in TFL will be important when we consider the circumstances under which a particular sentence would be true or false. The sentence `$\enot \enot \enot D$' is true if and only if the sentence `$\enot \enot D$' is false, and so on through the structure of the sentence, until we arrive at the atomic components. I will return to this in chapter \ref{ch.TruthTables}.

The recursive structure of sentences in TFL also allows us to give a formal definition of the \emph{scope} of a negation (mentioned in \S\ref{s:ConnectiveConjunction}). The scope of a `$\enot$' is the subsentence for which `$\enot$' is the main logical operator. For example, consider this sentence:
$$(P \eand (\enot (R \eand B) \eiff Q))$$
This was constructed by conjoining `$P$' with `$ (\enot (R \eand B) \eiff Q)$'. This last sentence was constructed by placing a biconditional between `$\enot (R \eand B)$' and `$Q$'. And the former of these sentences---a subsentence of our original sentence---is a sentence for which `$\enot$' is the main logical operator. So the scope of the negation is just `$\enot(R \eand B)$'. More generally:
	\factoidbox{The \define{scope} of a connective in a sentence is the subsentence for which that connective is the main logical operator.}

\section{Bracketing conventions}
\label{TFLconventions}
Strictly speaking, the brackets in `$(Q \eand R)$' are an indispensable part of the sentence. Part of this is because we might use `$(Q \eand R)$' as a subsentence in a more complicated sentence. For example, we might want to negate `$(Q \eand R)$', obtaining `$\enot(Q \eand R)$'. If we just had `$Q \eand R$' without the brackets and put a negation in front of it, we would have `$\enot Q \eand R$'. It is most natural to read this as meaning the same thing as `$(\enot Q \eand R)$'. But as we saw in  \S\ref{s:ConnectiveConjunction}, this is very different from `$\enot(Q\eand R)$'.

Strictly speaking, then, `$Q \eand R$' is \emph{not} a sentence. It is a mere \emph{expression}.

When working with TFL, however, it will make our lives easier if we are sometimes a little less than strict. So, here are some convenient conventions.

First,  we allow ourselves to omit the \emph{outermost} brackets of a sentence. Thus we allow ourselves to write `$Q \eand R$' instead of the sentence `$(Q \eand R)$'. However, we must remember to put the brackets back in, when we want to embed the sentence into another sentence!

Second, it can be a bit painful to stare at long sentences with many nested pairs of brackets. To make things a bit easier on the eyes, we shall allow ourselves to use square brackets, `[' and `]', instead of rounded ones. So there is no logical difference between `$(P\eor Q)$' and `$[P\eor Q]$', for example.

Combining these two conventions, we can rewrite the unwieldy sentence
$$(((H \eif I) \eor (I \eif H)) \eand (J \eor K))$$
rather more simply as follows:
$$\bigl[(H \eif I) \eor (I \eif H)\bigr] \eand (J \eor K)$$
The scope of each connective is now much clearer.

\practiceproblems
\problempart
\label{pr.wiffTFL}
For each of the following: (a) Is it a sentence of TFL, strictly speaking? (b) Is it a sentence of TFL, allowing for our relaxed bracketing conventions?
\begin{earg}
\item $(A)$
\item $J_{374} \eor \enot J_{374}$
\item $\enot \enot \enot \enot F$
\item $\enot \eand S$
\item $(G \eand \enot G)$
\item $(A \eif (A \eand \enot F)) \eor (D \eiff E)$
\item $[(Z \eiff S) \eif W] \eand [J \eor X]$
\item $(F \eiff \enot D \eif J) \eor (C \eand D)$
\end{earg}

\problempart
Are there any sentences of TFL that contain no atomic sentences? Explain your answer.\\

\problempart
What is the scope of each connective in the sentence
$$\bigl[(H \eif I) \eor (I \eif H)\bigr] \eand (J \eor K)$$

\problempart
In \S\ref{tfl:SentencesDefined}, I provided a method for finding the main logical connective in any sentence. Try to explain \emph{why} the method always works.

\chapter{Use and mention}\label{s:UseMention}
In this chapter, I have talked a lot \emph{about} sentences. I now want to pause, to explain an important---and very general---point about talking \emph{about} languages.

\section{Quotation conventions}
Consider these two sentences:
	\begin{ebullet}
		\item Elizabeth is the Queen.
		\item The expression `Elizabeth' is composed of one uppercase letter and eight lowercase letters
	\end{ebullet}
When we want to talk about the Queen, we \emph{use} her name. When we want to talk about the Queen's name, we \emph{mention} that name, which we do by putting it in quotation marks.

There is a general point here. When we want to talk about things in the world, we just \emph{use} words. When we want to talk about words, we typically have to \emph{mention} those words. We need to indicate that we are mentioning them, rather than using them. To do this, some convention is needed. We can put them in quotation marks, or display them centrally in the page (say). So this sentence:
	\begin{ebullet}
		\item `Elizabeth' is the Queen.
	\end{ebullet}
says that some \emph{expression} is the Queen. And that's false. The \emph{woman} is the Queen; her \emph{name} isn't. Conversely, this sentence:
	\begin{ebullet}
		\item Elizabeth is composed of one uppercase letter and eight lowercase letters.
	\end{ebullet}
also says something false: Elizabeth is a woman, made of meat rather than letters. One final example:
	\begin{ebullet}
		\item ``\,`Elizabeth'\,'' names `Elizabeth'.
	\end{ebullet}
On the left-hand-side, we have the name of a name. On the right hand side, we have a name. Perhaps this kind of sentence only occurs in logic textbooks, but it is true.

Those are just general rules for quotation, and you should observe them carefully in all your work! To be clear, the quotation-marks here do not indicate reported speech (which I might use in talking about Descartes's `cogito ergo sum'). They indicate that you are moving from talking about an object, to talking about a name of that object.

\section{Object language and metalanguage}
These general quotation conventions are very important for us. After all, we are describing a formal language here, TFL, and so we must often \emph{mention} expressions from TFL.

When we talk about a language, the language that we are talking about is called the \define{object language}. The language that we use to talk about the object language is called the \define{metalanguage}.
\label{def.metalanguage}

For the most part, the object language in this chapter has been the formal language that we have been developing: TFL. The metalanguage is English. Not conversational English,  perhaps, but English supplemented with some additional vocabulary to help us get along.

Now, I have used italic uppercase letters for atomic sentences of TFL:
	$$A, B, C, Z, A_1, B_4, A_{25}, J_{375},\ldots$$
These are sentences of the object language (TFL). They are not sentences of English. So I must not say, for example:
	\begin{ebullet}
		\item $D$ is an atomic sentence of TFL.
	\end{ebullet}
Obviously, I am trying to come out with an English sentence that says something about the object language (TFL). But `$D$' is a sentence of TFL, and no part of English. So the preceding is gibberish, just like:
	\begin{ebullet}
		\item Schnee ist wei\ss\ is a German sentence.
	\end{ebullet}
What we surely meant to say, in this case, is:
	\begin{ebullet}
		\item `Schnee ist wei\ss' is a German sentence.
	\end{ebullet}
Equally, what we meant to say above is just:
	\begin{ebullet}
		\item `$D$' is an atomic sentence of TFL.
	\end{ebullet}
The general point is that, whenever we want to talk in English about some specific expression of TFL, we need to indicate that we are \emph{mentioning} the expression, rather than \emph{using} it. We can either deploy quotation marks, or we can adopt some similar convention, such as  placing it centrally in the page.

\section{Fonts, quotation marks, and concatenation}
However, we do not just want to talk about \emph{specific} expressions of TFL. We also want to be able to talk about \emph{any arbitrary} sentence of TFL. Indeed, I had to do this in \S\ref{s:TFLSentences}, when I presented the recursive definition of a sentence of TFL. I used bold-italic-fonts to do this:
	$$\meta{A}, \meta{B}, \meta{C}, \meta{D}, \ldots$$
These symbols do not belong to TFL. Rather, they are part of our (augmented) metalanguage that we use to talk about \emph{any} expression of TFL. To explain why we need them, recall the second clause of the recursive definition of a sentence of TFL:
	\begin{earg}
		\item[3.] If $\meta{A}$ is a sentence, then $\enot \meta{A}$ is a sentence.
	\end{earg}
This talks about \emph{arbitrary} sentences. If we had instead offered:
	\begin{ebullet}
		\item If `$A$' is a sentence, then `$\enot A$' is a sentence.
	\end{ebullet}
this would not have allowed us to determine whether `$\enot B$' is a sentence. To emphasise:
	\factoidbox{
		`$\meta{A}$' is a symbol in augmented English, and we use it to talk about expressions of TFL. `$A$' is a particular atomic sentence of TFL.}
But all of this raises a further complication, concerning quotation conventions. I did not include any quotation marks in the third clause of our recursive definition. Should I have done so?

The problem is that the expression on the right-hand-side of the rule, i.e.\, `$\enot\meta{A}$' is not a sentence of English, since it contains `$\enot$'. So we might try to write:
	\begin{enumerate}
		\item[3$'$.] If \meta{A} is a sentence, then `$\enot \meta{A}$' is a sentence.
	\end{enumerate}
But this is no good: `$\enot \meta{A}$' is not a TFL sentence, since `$\meta{A}$' is a symbol of (augmented) English rather than a symbol of TFL.

What we really want to say is something like this:
	\begin{enumerate}
		\item[3$''$.] If \meta{A} is a sentence, then the result of concatenating the symbol `$\enot$' with the sentence \meta{A} is itself a sentence.
	\end{enumerate}
This is impeccable, but rather long-winded. %Quine introduced a convention that speeds things up here. In place of (3$''$), he suggested:
%	\begin{enumerate}
%		\item[3$'''$.] If \meta{A} and \meta{B} are sentences, then $\ulcorner (\meta{A}\eand\meta{B})\urcorner$ is a sentence
%	\end{enumerate}
%The rectangular quote-marks are sometimes called `Quine quotes', after Quine. The general interpretation of an expression like `$\ulcorner (\meta{A}\eand\meta{B})\urcorner$' is in terms of rules for concatenation.
But we can avoid long-windedness by creating our own conventions. We can perfectly well stipulate that an expression like `$\enot \meta{A}$' should simply be read \emph{directly} in terms of rules for concatenation. So, \emph{officially}, the metalanguage expression `$\enot \meta{A}$'
simply abbreviates:
\begin{quote}
	the result of concatenating the symbol `$\enot$' with the sentence \meta{A}
\end{quote}
and similarly, for expressions like `$(\meta{A} \eand \meta{B})$', `$(\meta{A} \eor \meta{B})$', etc.

\section{Quotation conventions for arguments}
One of our main purposes for using TFL is to study arguments, and that will be our concern in chapter \ref{ch.TruthTables}. In English, the premises of an argument are often expressed by individual sentences, and the conclusion by a further sentence. Since we can symbolise English sentences, we can symbolise English arguments using TFL.

Or rather, we can use TFL to symbolise each of the \emph{sentences} used in an English argument. However, TFL itself has no way to flag some of them as the \emph{premises} and another as the \emph{conclusion} of an argument.  (Contrast this with natural English, which uses words like `so', `therefore', etc., to mark that a sentence is the \emph{conclusion} of an argument.)

%So, if we want to symbolise an \emph{argument} in TFL, what are we to do?

%An obvious thought would be to add a new symbol to the \emph{object} language of TFL itself, which we could use to separate the premises from the conclusion of an argument. However, adding a new symbol to our object language would add significant complexity to that language, since that symbol would require an official syntax.\footnote{\emph{The following footnote should be read only after you have finished the entire book!} And it would require a semantics. Here, there are deep barriers concerning the semantics. First: an object-language symbol which adequately expressed `therefore' for TFL would not be truth-functional. (\emph{Exercise}: why?) Second: a paradox known as `validity Curry' shows that FOL itself \emph{cannot} be augmented with an adequate, object-language `therefore'.}

So, we need another bit of notation. Suppose we want to symbolise the premises of an argument with $\meta{A}_1, \ldots, \meta{A}_n$ and the conclusion with $\meta{C}$. Then we will write:
$$\meta{A}_1, \ldots, \meta{A}_n \therefore \meta{C}$$
The role of the symbol `$\therefore$' is simply to indicate which sentences are the premises and which is the conclusion.

%Strictly, this extra notation is \emph{unnecessary}. After all, we could always just write things down long-hand, saying: the premises of the argument are well symbolised by $\meta{A}_1, \ldots \meta{A}_n$, and the conclusion of the argument is well symbolised by $\meta{C}$. But having some convention will save us some time. Equally, the particular convention we chose was fairly \emph{arbitrary}. After all, an equally good convention would have been to underline the conclusion of the argument. Still, this is the convention we will use.

Strictly, the symbol `$\therefore$' will not be a part of the object language, but of the \emph{metalanguage}. As such, one might think that we would need to put quote-marks around the TFL-sentences which flank it. That is a sensible thought, but adding these quote-marks would make things harder to read. Moreover---and as above---recall that \emph{we} are stipulating some new conventions. So, we can simply stipulate that these quote-marks are unnecessary. That is, we can simply write:
$$A, A \eif B \therefore B$$
\emph{without any quotation marks}, to indicate an argument whose premises are (symbolised by) `$A$' and `$A \eif B$' and whose conclusion is (symbolised by) `$B$.


\documentclass{article}
\usepackage[utf8]{inputenc}
\usepackage{graphicx}
\usepackage{xfrac}
\usepackage{indentfirst}
\usepackage{amsmath}
\usepackage{hyperref}
\hypersetup{
    colorlinks=true,
    urlcolor=blue,
    linkcolor=black
}

\graphicspath{{./img}}

\title{Electrical Components and Circuits Reference}
\author{Marine Maisonneuve, Devaughn Menezes, Andrew Rocco, Eugene Min }
\date{September 2020}

\begin{document}

\maketitle

\tableofcontents

\section{Common Circuit Symbols}

\begin{tabular}{c|c}
    Name & Symbol \\
    \hline
    Ground & \includegraphics[width=0.08\textwidth]{img/Symbol G7_Earth.JPG}\\
    \hline
    Resistor &
    \includegraphics[width=0.2\textwidth]{img/1280px-Resistor_symbol_America.svg.png}\\
    \hline
    Diode & \includegraphics[width=0.2\textwidth]{img/51f1c87ace395fea20000004.png}\\
    \hline
    Capacitor & \includegraphics[width=0.2\textwidth]{img/Screenshot_20200913_143337.png} \\
    \hline
    MOSFET & \includegraphics[width=0.2\textwidth]{img/62fe4e5439abf066e1badb3f8a73b483b52614ec.jpeg} \\
    \hline
    Inductor & \includegraphics[width=0.2\textwidth]{img/1280px-Inductor_symbol.svg.png}\\
    \hline
    Voltage Source & \includegraphics[width=0.12\textwidth]{img/1200px-Voltage_Source.svg.png}
\end{tabular}

\section{Basic Concepts and Definitions}

\begin{tabular}{c|c|c}
    Physical Quantity & Units & Equations \\
    \hline
    Time (t)  & Second & (SI Unit) \\
    Charge (Q) & Coulomb (C) & (SI Unit) \\
    Current (I) & Ampere (A) & $I = \sfrac{Q}{t}$ \\
    Energy (E) & Joule (J) & E = $V \cdot I \cdot t$ \\
    Voltage (V) & Volt (V) & V = $\sfrac{E}{Q}$ \\
    Power (P) & Watt (W) & P = $\sfrac{E}{t} = V \cdot I$ \\
\end{tabular}

\section{Electricity Basics}
Electricity is, as defined by Wikipedia:
\begin{center}
   [A] set of physical phenomena associated with the \textbf{presence} and \textbf{motion} of \textbf{electric charge}.
\end{center}

In other words, a flow of \textbf{electrical charges}.

\subsection{Electric Charge}
In short, particles can be positively or negatively charged.
\textbf{Electric Charge} is a physical property of particles. On an atomic level, charges carried by \textbf{electrons} are negative and \textbf{protons/nuclei} are positive. Particles with like charges repel each other and particles of opposite charges attract each other.

\subsection{Voltage}
\begin{figure} [h]
    \centering
    \includegraphics[width=0.7\textwidth]{img/E_Field.png}
    \caption{Charged particles create electric fields}
    \label{fig:E_Field}
\end{figure}
Charged particles create electric fields. If a charge is placed in such a field, there exists a potential difference which causes these particles to move.

\textbf{Voltage} is the driving force for electrical applications. It is an \textbf{electric field potential difference}. Charged particles naturally move from higher potential to lower potential. The amount of energy required to move from this higher potential to a lower potential is described as electrical potential energy. At any point within an electrical field, the amount of electrical potential energy per unit of charge determines the electric potential, measured in Volts (V). The polarity of voltage does not necessarily matter: charges may flow from 5V to 3.3V and also from -5V to -12V. Charged particles always move if there is a potential difference in place.
\\We can measure electric potential using the following equation:
\begin{center}
Voltage = Electric Potential Energy (in joules)/Charge of Particle (in coulombs)
\end{center}

\begin{figure}
    \centering
    \includegraphics[width=0.7\textwidth]{img/E_Potential.png}
    \caption{Visual of Electric Potential}
    \label{fig:E_Potential}
\end{figure}

\subsection{Current}
Current is induced when charges flow due to an electric potential.

When a potential difference exists in a circuit, charged particles will flow with a certain speed (called drift speed). The \textbf{net flow} of charged particles is called \textbf{current(I)}, measured in \textbf{Amperes (A)}. By convention, the current direction is \textbf{opposite} to the direction of the electron flow. Current is usually induced by voltages, so when there is no voltage, charged particles move randomly so there exists no net flow and thus no current.

\subsection{Resistance}

\textbf{Resistance} is a measure of the \textbf{difficulty for current to pass} through a component, it is measured in Ohms ($\Omega$). The resistance of a component can be calculated by dividing the potential difference (V) across the component by the amount of current (I) passing through it.
\\
\begin{figure}[h]
    \centering
    \includegraphics[width=0.7\textwidth]{img/VI_Curve.png}
    \caption{A Voltage vs Current plot. The slope represents resistance.}
    \label{fig:VI_Resistor}
\end{figure}
\\
Voltage, Resistance, and Current are related through the following equation: \\

\begin{center}
    Voltage = Current (I) $\times$ Resistance (R)
\end{center}
$$
V=IR
$$

This equation is known as \textbf{Ohm's Law}.

\section{Electrical Components}
\subsection{Resistor}
Resistors are used to reduce current and/or drop voltage.\\

\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{img/resistors-thru-hole.jpg}
    \caption{Through-hole resistors come with different resistance values identified by the colored bands}
    \label{fig:res-thru}
\end{figure}

A \textbf{resistor} is a two-terminal \textbf{passive} (requires no external energy to operate) component that \textbf{implements electrical resistance} between the two terminals. Resistors are used to reduce current flow, adjust signal levels, divide voltage, etc.

The power dissipated by a resistor is calculated by multiplying voltage and current, $P =V \times I$, this may further expand to $P =V^{2}/R$ and $P= I^2R$. The first equation applies to the power dissipation of all electrical components, while the other two are for the case of resistors.

\begin{figure}[h]
    \centering
    \includegraphics[width=0.5\textwidth]{img/resistors-smd.jpg}
    \caption{Surface mount resistors are normally used when designing PCBs}
    \label{fig:res-smd}
\end{figure}

Tip: The resistance of a wire is calculated with the formula R=pl/A (p=resistivity of the material, l=length of the wire, A=cross sectional area of the wire).

\subsection{Capacitor}

In short, capacitors store energy. \\
\begin{figure} [h]
    \centering
    \includegraphics[width=0.9\textwidth]{img/Capacitors.png}
    \caption{Ceramic (left) and electrolytic capacitor (right).}
    \label{fig:capacitor}
\end{figure}

A \textbf{capacitor} is a \textbf{passive} two-terminal component that \textbf{stores energy in an electric field}. The larger the capacitance (which is noted as C), the more energy a capacitor can store and the longer it takes to charge and discharge.\\

There are primarily two kinds of capacitors: ceramic and electrolytic. In our scope of application, we need to know that electrolytic capacitors easily obtain high capacitance values with low cost and electrolytic ones are usually much larger compared to ceramics, rendering most capacitors on Printed Circuit Board (PCBs) to be ceramic. Electrolytic capacitors have polarity or a direction they must be in, in circuits. \\

Capacitors act as energy sources when discharging, so they’re often placed in parallel with voltage sources to maintain voltage levels during sudden load changes to prevent spikes. This application is known as “decoupling capacitance.”

\subsection{Inductor}

In short, an inductor limits current.
An \textbf{inductor}, also known as a coil, is a \textbf{passive} two-terminal component that stores energy in a \textbf{magnetic field}. An inductor, which has inductance noted as L, can help smooth sudden current spikes in the circuit as it stores current temporarily. Thus, they are commonly placed in series with power supplies. \\

Unlike a Capacitor which opposes a change of voltage across their plates, an inductor opposes the rate of change of current flowing through it due to the build up of self-induced energy within its magnetic field. In other words, inductors resist or oppose changes of current but will easily pass a constant current.\\

Inductors are also a primary component in electromechanical actuators such as relays (switches that use electromagnets), solenoids (values that use electromagnets), and motors (rotating devices that use electromagnets).

\subsection{Diode}

In short, a diode allows current flow in one direction.\\

A \textbf{diode} is a two-terminal \textbf{passive} component that conducts current primarily in \textbf{one direction}. It ideally has zero resistance in one direction and infinite resistance in the other. In order for the diode to start operating in forward-bias mode, there has to be a threshold voltage across the diode (typically 0.7V). After this the diode will conduct electricity freely. \\

A common diode is the \textbf{Light Emitting Diode (LED)} that \textbf{emits light} when current passes through it. When designing an LED circuit, one must consider the maximum current the diode can handle and add a resistor if needed, or the LED could burn up from too much current. Below is an example of an LED circuit.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.5\textwidth]{img/LED_Circuit.png}
    \caption{LED Circuit.}
    \label{fig:LED_ckt}
\end{figure}

The value of R depends on the voltage applied and the type of LED and can be found from Ohm’s Law. \\

Diodes have many applications for reverse polarity protection (preventing current from flowing if the circuit is plugged in backwards) and voltage source protection (preventing current from flowing from one source to another). LEDs are used for indication and signaling of power levels, statuses, or faults. \\

Most diodes have a maximum \textbf{reverse voltage}: the breakdown voltage. Any higher than this voltage, and the diode will break down unless it is a \textbf{zener diode}, specifically designed to be reversible.

\subsection{Transistor}

In short, transistors are simple \textbf{electronic switches}. \\

There are primarily two types of transistors: Bipolar Junction Transistors (BJTs) and Metal Oxide-Semiconductor Field-Effect Transistors (MOSFETs).

They typically have three terminals, the base or gate being the ‘controller’, and the other two being the collector or source and emitter or drain. There exist two types of BJT: NPN and PNP. NPN is normally OFF and conducts current when there is positive voltage at its base. PNP works in the exact opposite way, it is normally ON and conducts when there is zero voltage at its base. nFET and pFET MOSFETS work in a similar fashion to NPN and PNP respectively. Transistors are used to switch on other parts of the circuit.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.7\textwidth]{img/TransistorSignal.png}
    \caption{Function of transistors based on gate logic levels}
    \label{fig:TranSignal}
\end{figure}

VDD (Voltage Drain Drain) is the power source of the system, or the ON voltage. GND is “the reference point in an electrical circuit from which voltages are measured” or the 0 voltage. For our applications, 3.3V or 5V are usually the logical operating levels of printed circuit boards with 12V or 24V are usually the voltage level that power the robot.
Never directly connect 5V directly to 0V, as this is called a short circuit.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.7\textwidth]{img/TransistorCurrent.png}
    \caption{Transistor terminals and direction of current flow}
    \label{fig:TranCurr}
\end{figure}

\subsection{Fuse}

A \textbf{fuse} is a component that is designed to fail when there is \textbf{too much current} passing through it. When placed in series with your circuit, it is a safety device as it prevents over current.

Blown fuses alert you that there’s excessive current, implying either:
\begin{enumerate}
    \item A component is broken or operating in an unsafe region
    \item The circuit must be redesigned taking into account maximum ratings
\end{enumerate}

\section{Circuit Analysis}

A circuit with components in \textbf{series} has all of its components on the same “path” whereas a circuit with its components in \textbf{parallel} has all of its components on different “paths.”

\begin{figure} [h]
    \centering
    \includegraphics[width=\textwidth]{img/ParallelSeries.png}
    \caption{Example of resistors in parallel or series}
    \label{fig:ParallelSeries}
\end{figure}

\subsection{Series Circuit Component Formulas}

\begin{gather*}
R_{total} = R_{1} + R_{2} + R_{3} + \dots + R_{i} \\
\frac{1}{C_{total}} = \frac{1}{C_{1}} +  \frac{1}{C_{2}} + \frac{1}{C_{3}} + \dots + \frac{1}{C_{i}} \\
C_{total} = \frac{1}{\sum_{i} \sfrac{1}{C_{i}}} \\
L_{total} = L_{1} + L_{2} + L_{3} + \dots + L_{i}
\end{gather*}

\subsection{Parallel Circuit Component Formulas}

\begin{gather*}
\frac{1}{R_{total}} = \frac{1}{R_{1}} +  \frac{1}{R_{2}} + \frac{1}{R_{3}} + \dots + \frac{1}{R_{i}} \\
R_{total} = \frac{1}{\sum_{i} \sfrac{1}{R_{i}}} \\
C_{total} = C_{1} + C_{2} + C_{3} + \dots + C_{i} \\
\frac{1}{L_{total}} = \frac{1}{L_{1}} +  \frac{1}{L_{2}} + \frac{1}{L_{3}} + \dots + \frac{1}{L_{i}} \\
L_{total} = \frac{1}{\sum_{i} \sfrac{1}{L_{i}}} \\
\end{gather*}

\subsection{Further Reading}
\noindent \href{https://learn.sparkfun.com/tutorials/capacitors/introduction}{Capacitors - learn.sparkfun.com} \\
\href{https://www.allaboutcircuits.com/technical-articles/characteristics-of-the-ideal-diode/}{Characteristics of the Ideal Silicon Diode - Technical Articles}

\section{Circuit Basics}

\subsection{Kirchoff's Laws}
Kirchhoff's Current Law is that the sum of current flowing into a node (or a junction) must be equal to the sum of current flowing out of it.
Kirchhoff’s Voltage Law is that the algebraic sum of the voltage (potential) differences in any closed circuit must equal zero.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.8\textwidth]{img/Kirchoff.png}
    \caption{Kirchoff's junction and loop laws}
    \label{fig:Kirchoff}
\end{figure}

As defined by Kirchhoff’s law, in the left diagram $i_{2} + i_{3} = i_{1} + i_{4}$; in the right figure,
$v_{1} + v_{2} + v_{3} + v_{4} = 0$

\subsection{Breadboard}
In short, a \textbf{breadboard} is a device allowing you to \textbf{prototype} circuits. \\

It offers the ability to let you connect circuits by directly plugging them into it, saving you the effort of making a PCB.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.6\textwidth]{img/Electronics-White-Breadboard.jpg}
    \caption{A Breadboard}
    \label{fig:breadboard}
\end{figure}

\pagebreak

\section{Common Circuit Designs}

\subsection{Voltage Divider}
The goal of a voltage divider is to reduce the voltage in your circuit. The input voltage is distributed among the two resistors shown below, with the output voltage emerging from the connection between the resistors and the second resistor being connected to ground.

\begin{figure}[h]
    \centering
    \includegraphics[width=0.4\textwidth]{img/Voltage_Div.png}
    \caption{A voltage divider circuit.}
    \label{fig:VoltageDiv}
\end{figure}

To calculate the output voltage of the circuit, the following formula can be used.
$$
V_{out} = \frac{R_{2}}{R_{1} + R_{2}}
$$

\subsection{High/Low Side Switch}
High/low side switches two different ways to configure a circuit. A low side switch connects the load (the portion of the circuit that consumes power, shown as a box below) to ground using an N-type MOSFET. On the other hand, a high side switch connects power to the load using a P-type MOSFET.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.4\textwidth]{img/high_low_switch.png}
    \caption{A high-side switch, using a PFET, and a low-side switch, using an NFET }
    \label{fig:my_label}
\end{figure}

So how do you decide which one to use? In most scenarios, a low-side switch would work. Low-side switches are especially useful when dealing with high voltage circuits. If you are delivering power to an entire circuit or a voltage-sensitive device, a high-side switch may be applicable.

\subsection{Pull Up/Pull Down Resistor}
In a digital logic circuit, there must only be a Low state (GND or 0) or a High state (Vcc or 1) and a Pull-Up and Pull-Down resistor ensures this.

\begin{figure} [h]
    \centering
    \includegraphics[width = 0.5\textwidth]{img/Pull-up-and-Pull-down-Resistor.png}
    \caption{Pull up and pull down resistors on a Microcontroller's input pins}
    \label{fig:PullUpDown}
\end{figure}

In figure \ref{fig:PullUpDown} for a Pull-Up Resistor, we see a +5V source, resistor, ground, switch, and an input to a microcontroller. When the switch is opened, the 5V source provides an input current to the microcontroller which is a logic of 1. When the switch is closed, the resistor causes a small amount of current to flow to ground thus making the microcontroller input a logic of 0.

A similar process applies to a Pull-Down Resistor as well. When the switch is closed in this circuit, the input of the microcontroller with get 5V or a logic of 1. When it is open, it receives a logic 0.

Note, if we didn’t have the resistor in these circuits, the 5V source would be directly connected to ground without any resistance and this will end up shorting the circuit which we never want to do.

\section{Decoupling/Bypass Capacitor}
In short, a decoupling capacitor's job is to suppress high-frequency noise in power supply signals.

Many electronics use decoupling capacitors to make sure the chip is not subjected to any big dips or spikes in voltage.
Decoupling capacitors are used between the power source and ground as shown in the figure below. It is quite common to use more than one capacitor to bypass the power supply.

\begin{figure} [h]
    \centering
    \includegraphics[width=0.7\textwidth]{img/DecouplingCap.png}
    \caption{Decouling Capacitors used for an IC. Source: \href{https://learn.sparkfun.com/tutorials/capacitors/application-examples}{Sparkfun.com}}
    \label{fig:DecouplingCap}
\end{figure}

\end{document}

references/electricity_basics/Electrical Components and Circuits Reference LaTeX/main.tex


\documentclass{article}

\usepackage{cmbright}
\usepackage{float}
\usepackage{amsmath}
\usepackage{mathtools}
\usepackage{hyperref}
\usepackage{cleveref}
\usepackage{algorithm}
\usepackage{algpseudocode}

\title{Algorithms Design for Bridge Problem}
\author{Hanlin He\footnote{\texttt{hxh160630@utdallas.edu}},
Lizhong Zhang\footnote{\texttt{lxz160730@utdallas.edu}}}
\date{\today}

\begin{document}

\maketitle

\section*{Semaphores Algorithm}

The solution using semaphores is shown in \cref{semaphore1}.

\begin{algorithm}[H]
\caption{Attempt Semaphores Solution}\label{semaphore1}
\begin{algorithmic}
    \State{int[2] $count \leftarrow \{0, 0\}$}
    \State{semaphore[2] $mutex \leftarrow \{1, 1\}$}
    \State{semaphore $service \leftarrow 1$}
    \State{semaphore $resource \leftarrow 1$}
    \State{}
    \Function{arriveBridge}{$direction$}\Comment{Assume $direction$ is $0/1$}
        \State{\Call{down}{$service$}}
        \State{\Call{down}{$mutex[direction]$}}
        \State{$count[direction] \leftarrow count[direction] + 1$}
        \If{$count[direction] = 1$}\Comment{First one need to acquire $resource$}
            \State{\Call{down}{$resource$}}
        \EndIf{}
        \State{\Call{up}{$mutex[direction]$}}
        \State\Call{up}{$service$}
    \EndFunction{}
    \State{}
    \Function{leaveBridge}{$direction$}
        \State{\Call{down}{$mutex[direction]$}}
        \State{$count[direction] \leftarrow count[direction] - 1$}
        \If{$count[direction] = 0$}\Comment{Last one need to release $resource$}
            \State{\Call{up}{resource}}
        \EndIf{}
        \State{\Call{up}{$mutex[direction]$}}
    \EndFunction{}
\end{algorithmic}
\end{algorithm}

\subsection*{Analysis}

This algorithm mimic the reader logic in the `Fair Readers-Writers Solution'.
It uses array of integers/semaphores for two directions and direction as the
reference index into the array. Each $mutex[i]$ ensure exclusive read/write
operation on each $count[i]$. Traffics from one direction can enter the bridge
without waiting if no traffic was waiting on the other side (just like any
number of readers can read if no writer was waiting). And as long as there is
some traffics waiting on the other side, the after traffic will wait until the
other end traffic enter bridge once.

But this algorithm relies on the implementation of semaphores to ensure that
all cars will come one direction after the other if both directions have
traffic waiting. Consider scenario as follow:
\begin{enumerate}
    \item Process A first called \verb|arriveBridge| from direction $0$.
    \item Before A return,
        \begin{enumerate}
            \item Process B called \verb|arriveBridge| from direction $1$.
            \item Process C called \verb|arriveBridge| from direction $0$.
        \end{enumerate}
    \item Process A return from \verb|arriveBridge|.
\end{enumerate}
By requirement, the next process `cross the bridge' should be B. In the
algorithm, both B and C are `spinning' on \verb|down(service)|. After A invoke
\verb|leaveBridge| and release $service$, it depends on the implementation of
the semaphore to determine which process among B and C could acquire the
$service$. It's possible one side traffic got overtaken by the other side any
number of times, but eventually the traffic will leave the bridge.

\pagebreak

\section*{Monitors Algorithm}

The solution using monitors is shown in \cref{monitor}.

\begin{algorithm}[H]
\caption{Attempt Monitors Solution}\label{monitor}
\begin{algorithmic}
    \State{int $active[2] \leftarrow \{0, 0\}$}
    \State{int $waiting[2] \leftarrow \{0, 0\}$}
    \State{condition $canPass[2]$}
    \State{}
    \Function{arriveBridge}{$direction$}\Comment{Assume $direction$ is $0/1$}
        \State{$other \leftarrow 1 - direction$}
        \If{$active[other] + waiting[other] > 0$}
            \State{$waiting[direction] \leftarrow waiting[direction] + 1$}
            \State{\Call{wait}{$canPass[direction]$}}
            \State{$waiting[direction] \leftarrow waiting[direction] - 1$}
        \EndIf{}
        \State{$active[direction] \leftarrow active[direction] + 1$}
    \EndFunction{}
    \State{}
    \Function{leaveBridge}{$direction$}
        \State{$other \leftarrow 1 - direction$}
        \State{$active[direction] \leftarrow active[direction] - 1$}
        \If{$active[direction] = 0 \land waiting[other] > 0$}
            \If{$waiting[direction] > 0$}
                \State{\Call{signal}{$canPass[other]$}}
            \Else
                \State{\Call{signalAll}{$canPass[other]$}}
            \EndIf{}
        \EndIf{}
    \EndFunction{}
\end{algorithmic}
\end{algorithm}

\subsection*{Analysis}

This algorithm mimic the reader logic in the `Starvation Free Readers-Writers
Solution with Monitors'.

During \verb|leaveBridge|, if current car is the last of its direction to leave
the bridge for the moment, and there are cars waiting on the other side,
prepare to signal the other end to pass. And if current car's direction also
has cars waiting, then only signal one car from the other end to enter,
otherwise, signal all cars on the other direction to enter.

\end{document}