Skip to content
Permalink
Browse files

start logic

  • Loading branch information...
thomas--graf committed Nov 30, 2018
1 parent 8f06ca6 commit 90a1e2e6c590eea4b671b826039968c0f95d5818
@@ -0,0 +1,115 @@
# Propositions

## Intuition

A proposition is a statement that is either true or false.
This does not mean that one can necessarily tell whether a proposition is true, nor that the proposition makes any sense considering what our world is like.
It just means that the statement is such that it can have a truth value.

\begin{example}
All of the following are propositions, even though whether they're true or false can depend greatly on context:

<ul>
<li>Nobody likes ponies.</li>
<li>He always snores like a pig.</li>
<li>$2 + 2 = 4$</li>
<li>We might see another stock market crash soon.</li>
<li>A language is regular iff it is recognized by a finite-state automaton.</li>
</ul>
\end{example}

\begin{example}
The following are not propositions.

<ul>
<li>Are you mad?</li>
<li>Please open a window.</li>
<li>Hell, yeah!</li>
<li>A cute kitten</li>
<li>John and Mary</li>
</ul>
\end{example}

\begin{example}
Some cases are borderline and require some more detailed analysis.
Take *Either John leaves or I will*.
As a literal description of how the world is, this can be either true or false, so it's a proposition.
But we can also interpret it as a command that the addressee must choose between John and the speaker.
Commands have no truth value and thus aren't propositions.
\end{example}

\begin{exercise}
For each one of the following, say whether it is a proposition.
If you say no, justify your answer.

<ol>
<li>John and Peter met yesterday.</li>
<li>The DeLorean DMC-12 is a sports car originally manufactured by John DeLorean's DeLorean Motor Company.</li>
<li>Who would say no to that.</li>
<li>That son of a gun has fooled us all.</li>
<li>Colorless green ideas sleep furiously.</li>
<li>John and Mary have only one child, who has three siblings.</li>
</ol>
\end{exercise}

## Entailment

Some propositions are atomic in the sense that one cannot break them down into smaller propositions, whereas others are clearly built up from smaller propositions.

\begin{example}
The sentence *John rode a bike and Mary her dragon* might be true or false, so it's a proposition.
But it is not an atomic proposition because it's built up from two smaller propositions.
One is *John rode a bike*, the other one *Mary rode her dragon* (that English allows for the verb to be omitted in the second conjunct is irrelevant for this point).
\end{example}

As a result, propositions can be related to each other so that the truth value of one follows immediately from the other.
This is called **entailment**.

\begin{example}
If *John rode a bike and Mary her dragon* is true, then it must also be true that John rode a bike, and it must be true that Mary rode her dragon.
In the other direction, if *John rode a bike* is false, then so is *John rode a bike and Mary her dragon*.
\end{example}

Entailment can also hold between propositions that do not stand in an obvious part-whole relation to each other.

\begin{example}
Consider the sentences *If pigs can fly, then Sokrates is a chain-smoking dragon* and *No human is a dragon*.
Assuming that both are true, the sentence *Sokrates is human* entails that pigs cannot fly.
\end{example}

The entailments in these two examples are slightly different.
For the first, it suffices to recognize how one proposition was built up from smaller ones.
The second one presents a more complex reasoning pattern that hinges on the meaning of the quantifier *no*.
Logic was devised as a means to study these different kinds of entailments, but over the centuries it has evolved to a highly flexible system that can be used for all kinds of purposes.

\begin{exercise}
For each one of the following pairs of sentences, say whether entailment holds, and if so, in which direction.
If entailment does not hold, explain why.

<ol>
<li>
John likes his son's sisters. |
John likes his daughters.
</li>
<li>
I am 30 years old. |
My age is a multiple of 15.
</li>
<li>
1 is not a prime number. |
No prime numbers is less than 2.
</li>
<li>
John and Bill both left the party early. |
Bill left the party around 9.
</li>
<li>
The 45th US president isn't universally beloved. |
Donald Trump isn't universally beloved.
</li>
<li>
If $2 + 2 = 4$, then $2 + 2 = 4$. |
$2 + 2 = 4$
</li>
</ol>
\end{exercise}

Large diffs are not rendered by default.

@@ -0,0 +1,93 @@
# Tautologies

A tautology is a formula that is always true, irrespective of what assignment function one picks.
A simple example is $a \vee \neg a$.

| $a$ | $\vee$ | $\neg$ | $a$ |
| :-: | :-: | :-: | :-: |
| 0 | 1 | 1 | 0 |
| 1 | 1 | 0 | 1 |

Sometimes the **verum** symbol $\top$ is used to denote an arbitrary tautology.
So $\top$ is short for a proposition that is always true.
Its opposite is the **falsum** $\bot$, which is always false.

Tautologies are very useful for simplifying formulas.
For one thing, if one knows that the formula $\phi$ is a tautology, then one can always replace it by $1$ without computing the truth values of any of its parts.
But one can also use tautologies to convert $\phi$ into a fully equivalent yet distinct formula $\psi$.

The rest of this section lists some important tautologies.

## Commutativity of $\wedge$ and $\vee$

From the truth tables of $\wedge$ and $\vee$, it follows immediately that

- $\phi \wedge \psi \leftrightarrow \psi \wedge \phi$
- $\phi \vee \psi \leftrightarrow \psi \vee \phi$

## Double negation

It always holds that $\phi$ is equivalent to $\neg \neg \phi$, no matter what formula or propositional symbol $\phi$ corresponds to.
So $\phi \leftrightarrow \neg \neg \phi$ is a tautology.

\begin{exercise}
Explain how this also entails that $\neg \phi \leftrightarrow \neg \neg \neg \phi$.
\end{exercise}

## De Morgan's Law

In set theory, De Morgan's law states that $A \cap B = \overline{\overline{A} \cup \overline{B}}$ and $A \cup B = \overline{\overline{A} \cap \overline{B}}$.
A direct analogue of that holds in propositional logic.
Both of the following are tautologies:

- $\phi \wedge \psi \leftrightarrow \neg (\neg \phi \vee \neg \psi)$
- $\phi \vee \psi \lefrightarrow \neg (\neg \phi \wedge \neg \psi)$

This means that every instance of $\phi \wedge \psi$ can be replaced by $\neg (\neg \phi \wedge \neg \psi)$, and similarly for negation.

\begin{exercise}
Give the truth table for each one of the two tautologies.
\end{exercise}

## Decomposition of implication

Implication can be decomposed into negation and disjunction:

- $\phi \rightarrow \psi \leftrightarrow \neg \phi \vee \psi$

\begin{exercise}
Rewrite each one of the following formulae using only $\neg$ and $\wedge$ (yes, logical and, not logical or):

<ol>
<li>$p \rightarrow q$</li>
<li>$(p \vee (q \rightarrow \neg p))$</li>
<li>$p \rightarrow (q \rightarrow r)$</li>
</ol>
\end{exercise}

## Implication chains as conjunction

Some implicational chains can be converted to a single implication with $\wedge$ in the antecedent.

- $\phi \rightarrow (\psi \rightarrow \rho) \leftrightarrow \phi \wedge \psi \rightarrow \rho$

Bracketing is crucial.
It is not the case that $(\phi \rightarrow \psi) \rightarrow \rho$ is equivalent to $\phi \wedge \psi \rightarrow \rho$.

\begin{exercise}
Give truth tables for the two formulas below to show that only the first is a tautology.

- $\phi \rightarrow (\psi \rightarrow \rho) \leftrightarrow \phi \wedge \psi \rightarrow \rho$
- $(\phi \rightarrow \psi) \rightarrow \rho \leftrightarrow \phi \wedge \psi \rightarrow \rho$
\end{exercise}

## Distributivity of $\wedge$ and $\vee$

The operators $\wedge$ and $\vee$ distribute over each other

- $\phi \wedge (\psi \vee \rho) \leftrightarrow (\phi \wedge \psi) \vee (\phi \wedge \rho)$
- $\phi \vee (\psi \wedge \rho) \leftrightarrow (\phi \vee \psi) \wedge (\phi \vee \rho)$

\begin{exercise}
Show via truth tables that both formulae are indeed tautologies.
\end{exercise}
@@ -0,0 +1,66 @@
# Boolean lattices

The fact that De Morgan's law holds for sets as well as propositional logic is no accident.
The two are close siblings from an algebraic perspective.

Let $S$ be some fixed set.
We may order $\w(S)$ by the subset relation to obtain the familiar powerset lattice, with join corresponding to union and meet to intersection.
In fact, this lattice satisfies two additional properties that make it a **Boolean lattice** (or **Boolean algebra**).

\begin{definition}
A lattice $\tuple{L, \leq}$ is

<ol>
<li>**distributive** iff join distributes over meet, and the other way round,</li>
<li>**bounded** iff there is a least element 0 and and a greatest element 1 such that for all $l \in L$, $0 \leq l \leq 1$,</li>
<li>**complemented** iff every eleement $a$ has a complement $\neg a$ such that $a \wedge \neg a = 0$ and $a \vee \neg a = 1$.</li>
</ol>
A lattice is **Boolean** iff it satisfies all three of the criteria.
\end{definition}

\begin{exercise}
Show that $\tuple{\wp(S), \subseteq}$ is a Boolean lattice.
More specifically:

<ol>
<li>Show that distributivity holds: $A \cap (B \cup C) = (A \cap B) \cup (A \cap C)$ and $A \cup (B \cap C) = (A \cup B) \cap (A \cup C)$</li>
<li>What are the least and greatest elements of $\wp(S)$?</li>
<li>For any arbitrary $A \in \wp(S)$, what is its complement $\neg A$?</li>
</oL>
\end{exercise}

As you might already expect, propositional logic also has the structure of a Boolean lattice.
All we have to do is figure out the carrier set, and the rest will follow immediately.
First, let $L$ be the set of all propositional formulas.
We define an ordering $\leq$ such that $\phi \leq \psi$ ($\phi, \psi \in L$) iff $\phi$ always entails $\psi$.
In other words, $\phi \leq \psi$ iff $\phi \rightarrow \psi$ is a tautology.

We're almost done, but not quite.
Note that $\tuple{L, \leq}$ is not a poset because antisymmetry is violated.

\begin{example}
Consider the formulas $a$ and $\neg \neg a$.
Clearly $a \rightarrow \neg \neg a$ and $\neg \neg a \rightarrow a$.
So we ahve $a \leq \neg \neg a$ and $\neg \neg a \leq a$, yet $a$ and $\neg \neg a$ are distinct memebers of $L$.
This contradicts antisymmetry.
\end{example}

In order to fix this, we instead look at the quotient structure $\tuple{L_\sim, \leq}$, where $\phi \sim \psi$ iff $\phi$ and $\psi$ entail each other.
So $L_\sim$ consists of equivalence classes of propositional formulas whose truth values never differ from each other.
Strictly speaking, we have to define $\leq$ for this new set $L_\sim$, but the idea is simple: $[\phi] \leq [\psi]$ iff $\phi$ entails $\psi$.
That is to say, we can order any two equivalence classes by looking at the entailment between their respective members.
This makes $\tuple{L_\sim, \leq}$ a poset.

Note that there is a unique least element, the equivalence class $[a \wedge \neg a]$, or simply $[\bot]$.
And there is a unique greatest element $[a \vee \neg a]$, or simply $[\top]$.
Any two elements $[\phi]$ and $[\psi]$ have a unique join $[\phi \vee \psi]$, and a unique meet $[\phi \wedge \psi]$.
So the lattice operations of join ($\vee$) and meet ($\wedge$) correspond exactly to logical or ($\vee$) and logical and ($\wedge$).
We already know that the latter are distributive, and it is also easy to see that for every $[\phi] \in L$ there is some complement $\neg [\phi] \in L$ such that $[\phi] \wedge \neg [\phi] = [\bot]$ and $[\phi] \vee \neg [\phi] = [\top]$.
In fact, this complement $\neg [\phi]$ is simply $[\neg \phi]$, showing the close connection between logical negation and complement in this structure.
Overall, then, $\tuple{L_\sim, \leq}$ is a poset where any two elements have a unique join and meet, where join and meet distribute over each, with unique least and greatest bounds, and a complement for every element of the $L_\sim$.
That's just a very roundabout way of saying that $\tuple{L_\sim, \leq}$ is a Boolean lattice, just like $\tuple{\wp(S), \subseteq}$, and that's why De Morgan's Law holds for both sets and propositional logic.

\begin{exercise}
Instead of the propositional formulas themselves, we could also look at their truth values.
Show that $\tuple{ \setof{F, T}, \leq }$ with $F \leq T$ is also a Boolean lattice.
\end{exercise}
No changes.
No changes.
@@ -0,0 +1,12 @@
\documentclass[tikz]{standalone}
\usepackage[linguistics]{forest}
\begin{document}
\begin{forest}
[$\wedge$
[$p$]
[$\neg$
[$q$]
]
]
\end{forest}
\end{document}
@@ -0,0 +1,28 @@
\documentclass[tikz]{standalone}
\usepackage[linguistics]{forest}
\begin{document}
\begin{forest}
[$\neg$
[$\neg$
[$\neg$
[$\rightarrow$
[$\righarrow$
[$p$]
[$q$]
]
[$\neg$
[$\vee$
[$\neg$
[$p$]
]
[$\neg$
[$q$]
]
]
]
]
]
]
]
\end{forest}
\end{document}

0 comments on commit 90a1e2e

Please sign in to comment.
You can’t perform that action at this time.