# Logic

Notice: Incomplete
Logic is the study of correct thought. In logic, there are a few things at its core: quantifiers, predicates, objects, and logical connectives.
| Type of thing | Thing | Description | Examples |
| Logical connective | $\land$ | Analogous to English 'and'. The statement only holds if the statements it connects hold. | It's raining, and I have an appointment |
| Logical connective | $\lor$ | Analogous to English 'and/or'. The statement holds if at least one of the statements it connects holds. | I want cake and/or pie |
| Logical connective | $\implies$ | Analogous to English 'whenever' or 'if... then...' The statement holds if it's not the case that the first statement holds and the second doesn't. | If the earth were flat, then I'm the King of England! Whenever one's heart stops, one dies. |
| Logical connective | $\neg$ | Analogous to English 'It's not the case that' or 'The statement '...' is false' The statement holds if its input doesn't | It's not the case that the earth is flat. |
| Predicate | | Analogous to English adjectives, verbs, or 'is...'. First order predicates can only input objects, second order ones can input first order ones, etc. No predicate can input itself. | Socrates is a man. The first-order predicate 'is a man' is a gender |
| Quantifier | $\forall$ | Analogous to English 'for all', 'for every' or 'for each' | Everything is made of matter. |
| | : | Encountered after a quantifier and variable. Analogous to English 'such that', 'who is', 'that is' etc. | Everyone who is attending will get a gift. |
| Quantifier | $\exists$ | Analogous to English 'some', 'there is/are', 'there exists', 'something', or 'someone' | There are illiterate people |

## Truth Tables

Truth tables help us determine correct reasoning. For example, here are the truth tables for the logical connectives (where P and Q stand for arbitrary statements, T stands for truth and F stands for falsehood)
| P | $\neg P$ |
| T | F |
| F | T |
| P | Q | $P\land Q$ |
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | F |
| P | Q | $P\lor Q$ |
| T | T | T |
| T | F | T |
| F | T | T |
| F | F | F |
| P | Q | $P\implies Q$ |
| T | T | T |
| T | F | F |
| F | T | T |
| F | F | T |
| P | Q | $P\equiv Q$ |
| T | T | T |
| T | F | F |
| F | T | F |
| F | F | T |

## Translating from formal logic to English

$(\forall x:human(x))\exists y:human(y)\land parent(y,x)$
Let's break this sentence down: For all x such that x is human, there exists a y such that y is human, and y is a parent of x. This can be rephrased as: Everyone has a human parent. Notice that the quantifier order matters. If I flip the quantifiers around, I get: There exists a y such that for all human x, y is human and y is a parent of x- that is some specific person is everyone's parent. Here's a table detailing all possibilities, using love as an example predicate:
| Quantifier | English | Voice |
| $\forall x\forall yloves(x,y)$ | Everyone loves everyone | Active |
| $\forall x\exists yloves(x,y)$ | Everyone loves someone | Active |
| $\exists x\forall yloves(x,y)$ | Someone loves everyone | Active |
| $\exists x\exists yloves(x,y)$ | Someone loves someone | Active |
| $\forall y\forall xloves(x,y)$ | Everyone is loved by everyone | Passive |
| $\forall y\exists xloves(x,y)$ | Everyone is loved by someone | Passive |
| $\exists y\forall xloves(x,y)$ | Someone is loved by everyone | Passive |
| $\exists y\exists xloves(x,y)$ | Someone is loved by someone | Passive |
Note that the first and fifth, and fourth and eighth are actually the same, as well as the third and sixth. The fact that the others aren't is why having different voices is indispensable in English- it conveys quantifier order where they're present.
$\exists x:(human(x)\land (\nexists yloves(x,y)\land loves(y,x)))$
There exists an x such that x is human and there doesn't exist a y such that x loves y and y loves x. This can be rephrased as: Some people never experience requited love.
Activity: Ask students to write about something (e.g., themselves, their friends, their interests) in formal logic. They may be allowed to get creative with predicate choices, as long as the meaning is obvious (e.g., using a heart to stand for the love predicate is fine, but using a dog to stand for the 'is a computer' predicate isn't) or explicitly stated and there is consistency (i.e., the predicate name never changes). You may wish to add restrictions (e.g., first order predicates only)
Formal logic is useful in mathematics as it eliminates ambiguity (and it's international, for all mathematical predicates are made from mathematical symbols). For example, "Everyone is not evil" may be stated when the intended meaning is "Not everyone is evil", making the listener wonder if the speaker truly meant what they said, or if the speaker actually meant the latter. If you write it in formal logic $(\forall x:human(x))\neg evil(x)$ and $\neg ((\forall x:human(x))evil(x))$ respectively), the difference is obvious (another thing to point out is that the former is false, as the Holocaust happened, but the latter is true, as the polio vaccine wasn't patented). Switching to a different natural language doesn't help, for they all have some level of structural ambiguity.

## Translating from English to formal logic

Activity: Have students translate a text into formal logic.
Activity: Have students translate familial relationships into formal logic using only the predicates '...is a parent of...', '...is male', and '...is female'. You may use some of these or make up your own.
In-laws and the like can also be done, by a) adding the symmetric predicate "...is married to..." or by replacing instances of marriage with sharing a common child.