# Introduction to Propositions and Predicates

## Recap of Propositions:

For the purpose of propositional logic, **propositions** are (almost) atomic black-boxes:
They have *names* and *definitions*, but their names are just atomic symbols in the logic syntax,
and their definitions are *outside* the logic syntax (usually these are statements in a human language).

The set of all propositions, together with the special symbols ⊤ and ⊥,
are the atomic symbols of the syntax of **formulas**.
The connectives will be familiar from their roles as boolean operators: ¬, ∧ ,∨, →, *etc*.
Thus, formulas are recursive trees with connectives as nodes and atomic symbols as leaves.

There are two truth values: 1 and 0.
(These are not part of the syntax of formulas.)
These can go by other names, commonly *"true"* and *"false"*.
The properties and isomorphisms of Boolean Algebra
are all good fun, but for now we can simply take **truth values** ≜ {1, 0}.

The operator **⟦·⟧** maps formula to truth values; *e.g.* ⟦⊤⟧=1.
(This example is actually part of the definition of ⟦·⟧;
⊤ and ⊥ are given meaning respectively as an atomic tautology and an atomic contradiction.)
Although it's often left implicit, it technically has a subscript argument,
either an **assignment** (a set of (*proposition*, *truth value*) pairs)
or a pair (*KB*, σ) of a **knowlege base** (a list of statements of the same form as proposition definitions)
and a **storage** of proposition definitions.
In either case, ⟦·⟧₋ can be implemented in terms of lookups and if-then-else statements.

## Predicates as Relations:

Consider the category *B* of truth values, and whatever category *S* of nouns/subjects.
A single proposition (*e.g.* *p*≜`"Six is prime."`

) can be represented as a pair of form
(*s*∈*S*, *R*) where *R* is a relation over *S* and truth values
(*e.g.* (6, *IsPrime*)).
Rather than writing it as a tuple "(*s*, *R*)", we can instead write it as "*R*(*s*)", which is the normal notation.

Not any relation *R*⊆*S*⨯*B* will serve in the representation of a proposition!
It must be a **predicate***, a relation mapping *every* element of *S* to exactly one truth value.
We use the notation *F*(*s*)≜(*s*,1)∈*F*,
and we deliberately reuse the "¬" symbol to write ¬*F*(*s*)≜(*s*,0)∈*F*.

_{* Here we consider only unary predicates.
Nullary predicates are the same as propositions.
Higher-artiy predicates are also possible.
Also, it's not clear if predicates really have to be total functions; if you know know please share!
}

In the context of a relational representation of predicates and propositions,
we can introduce **quantifiers**.

Universal Quantification: ∀

s∈S(P(s)) ≜ {(s,1) |s∈S} ⊆P

Existential Quantification: ∃s∈S(P(s)) ≜ ∅ ≠ {(s,1) |s∈S} ∩P

Typically the element-hood restriction on *s* is omitted, and *S* is assumed to be the domain of *P*,
but quantification over subsets of the domain is fine.
In particular, notice that ∀*s*∈∅ (*P*(*s*)) is a tautology and ∃*s*∈∅ (*P*(*s*)) is a contradiction, regardless of *P*.

## Predicate Logic Syntax:

In the prior section we introduced the notions and notations of predicates and quantifiers;
here we introduce a formal syntax for them.
While in the prior section we gave predicates meaning as relations, and gave quantifiers meaning in terms of set-theory,
*here we will treat them as pure symbols*.
They'll get (possibly contextual) meanings again later when we define a semantics.

Predicates compose into formula just like propositions do. This is what that looks like in BNF:

patterns | forms | notes |
---|---|---|

x |
Variables (from some set of identifiers) | |

P |
Predicates (from some set of identifiers) | |

F |
⊤ ⏐ ⊥ ⏐ P(x) ¬ F ⏐ F∧F ⏐ F∨F ⏐ F→F ∀ x (F) ⏐ ∃x (F) |
Atomic formula (could also include nullary predicates) Connectives borrowed from Propositional syntax Quantifiers |

Not inherent in the BNF, but fundamental to understanding predicate logic formula,
are the ideas of **free variables** and **bound variables**.
In the formula ∀*x* (*F*), we say "*x* is **bound** (*by that specific quantifier node*) in *F*";
usually we're only interested this if *x* actually appears in *F*.
(Existential quantifiers bind variables the same way.)
If *x* appears in some *F* and is not bound by any quantification node in *F*, then we say "*x* is **free** in *F*".
Specifically, *an appearence of x* may be free; it is possible to have both free and bound appearances of a variable in a single syntax tree.

## Re-write rules:

As a first step toward a *semantics* for predicate-logic syntax trees, we declare an equivalence relation (and therefor equivalence classes).
When we discussed propositional logic, we considered the (reflexive, symmetric, transitive) relation
*a*≡*b* ≜ ⟦*a*⟧=⟦*b*⟧ *("for all suitable assignments")*.
Equivalence here is similar, we just haven't discussed ⟦·⟧ yet.

Usually, we're interested in these equivalence classes because they define our re-write rules for formula:
if *F*≡*G* then we can use *G* anywhere we were using *F*.

### Example:

This example from class shows re-write steps from one representation of the required property of a predicate into its usual presentation:

Justification | formula |
---|---|

Start ("P is a predicate") |
∀f ∀f' ∀b ( (f=f' ∧ (f,b)∈P) → ¬∃b' (b≠b' ∧ (f',b')∈P) ) |

Distribute negation across existence | ∀f ∀f' ∀b ( (f=f' ∧ (f,b)∈P) → ∀b' ¬(b≠b' ∧ (f',b')∈P) ) |

Distribute negation across conjunction | ∀f ∀f' ∀b ( (f=f' ∧ (f,b)∈P) → ∀b' (b=b' ∨ (f',b')∉P) ) |

Move quantifier up (no name conflicts!) | ∀f ∀f' ∀b ∀b' ( (f=f' ∧ (f,b)∈P) → (b=b' ∨ (f',b')∉P) ) |

Definition of implication | ∀f ∀f' ∀b ∀b' (¬(f=f' ∧ (f,b)∈P) ∨ (b=b' ∨ (f',b')∉P) ) |

Distribute negation across conjunction | ∀f ∀f' ∀b ∀b' ( (f≠f' ∨ (f,b)∉P) ∨ (b=b' ∨ (f',b')∉P) ) |

Associativity of disjunction | ∀f ∀f' ∀b ∀b' ( ((f,b)∉P ∨ (f',b')∉P) ∨ (f≠f' ∨ b=b') ) |

Factor out negation from disjunction | ∀f ∀f' ∀b ∀b' (¬((f,b)∈P ∧ (f',b')∈P) ∨ (f≠f' ∨ b=b') ) |

Definition of implication | ∀f ∀f' ∀b ∀b' ( ((f,b)∈P ∧ (f',b')∈P) → (f≠f' ∨ b=b') ) |

It's not clear that this example actually fits into the syntax as introduced. For the purpose of example, let's fix that. Our goal is to show the same sequence of re-writes, but at every step our formula should be a valid tree in our BNF.

First we'll extend our syntax to allow binary predicates.
Here "=" is just an atomic symbol in our grammar/syntax, in the set of all predicates.
We'll use it as a binary predicate; if we had semantics or a more advanced grammar we would enforce that.
While we intuitively understand it to mean "equality", that idea is *not* encoded in the syntax.
Similarly, I here use the un-italicized P to refer to a *binary* predicate "is a predicate", who's right-hand argument is a truth value,
but neither the semantics of P nor the idea of a truth value is encoded in the syntax.

patterns | forms | notes |
---|---|---|

x |
f ⏐ f' ⏐ b ⏐ b' | Variables (that we'll use) |

P |
P ⏐ = | Predicates (that we'll use) |

F |
⊤ ⏐ ⊥ ⏐ P(x) ⏐ x P x ¬ F ⏐ F∧F ⏐ F∨F ⏐ F→F ∀ x (F) ⏐ ∃x (F) |
Add binary predicates No change No change |

And then we can proceed:

Justification | formula |
---|---|

Start | ∀f (∀f' (∀b ( (f=f' ∧ f P b) → ¬∃b' ( (¬b=b' ∧ f' P b') ) ) ) ) |

Distribute negation across existence | ∀f (∀f' (∀b ( (f=f' ∧ f P b) → ∀b' (¬(¬b=b' ∧ f' P b') ) ) ) ) |

Distribute negation across conjunction | ∀f (∀f' (∀b ( (f=f' ∧ f P b) → ∀b' ( (¬¬b=b' ∨ ¬f' P b') ) ) ) ) |

Remove double negation | ∀f (∀f' (∀b ( (f=f' ∧ f P b) → ∀b' ( (b=b' ∨ ¬f' P b') ) ) ) ) |

Move quantifier up | ∀f (∀f' (∀b (∀b' ( (f=f' ∧ f P b) → (b=b' ∨ ¬f' P b') ) ) ) ) |

Definition of implication | ∀f (∀f' (∀b (∀b' (¬(f=f' ∧ f P b) ∨ (b=b' ∨ ¬f' P b') ) ) ) ) |

Distribute negation across conjunction | ∀f (∀f' (∀b (∀b' ( (¬f=f' ∨ ¬f P b) ∨ (b=b' ∨ ¬f' P b') ) ) ) ) |

Associativity of disjunction | ∀f (∀f' (∀b (∀b' ( (¬f P b ∨ ¬f' P b') ∨ (¬f=f' ∨ b=b') ) ) ) ) |

Factor out negation from disjunction | ∀f (∀f' (∀b (∀b' (¬(f P b ∧ f' P b') ∨ (¬f=f' ∨ b=b') ) ) ) ) |

Definition of implication | ∀f (∀f' (∀b (∀b' ( (f P b ∧ f' P b') → (¬f=f' ∨ b=b') ) ) ) ) |

One more step for the fun of it | ∀f (∀f' (∀b (∀b' ( (f P b ∧ f' P b') → (f=f' → b=b') ) ) ) ) |

The double-implication isn't excellent, it might read more clearly if we took a different route from the sixth line:

Justification | formula |
---|---|

Sixth line from above | ∀f (∀f' (∀b (∀b' ( (¬f=f' ∨ ¬f P b) ∨ (b=b' ∨ ¬f' P b') ) ) ) ) |

Associativity of disjunction | ∀f (∀f' (∀b (∀b' ( ( (¬f P b ∨ ¬f' P b') ∨ ¬f=f' ) ∨ b=b' ) ) ) ) |

Factor out negation from disjunction | ∀f (∀f' (∀b (∀b' ( (¬(f P b ∧ f' P b') ∨ ¬f=f' ) ∨ b=b' ) ) ) ) |

Factor out negation from disjunction | ∀f (∀f' (∀b (∀b' (¬( (f P b ∧ f' P b') ∧ f=f' ) ∨ b=b' ) ) ) ) |

Definition of implication | ∀f (∀f' (∀b (∀b' ( ( (f P b ∧ f' P b') ∧ f=f' ) → b=b' ) ) ) ) |

Cull parentheses (not technically allowed) | ∀f ∀f' ∀b ∀b' ( ( f P b ∧ f' P b' ∧ f=f' ) → b=b' ) |

Returning to our intuitive understanding of the nature of predicates, we can see that this doesn't entirely capture the refinement of Relations that we want; P is not necessarily Total. We could express totality as

∀

f(∃b(fPb)

but that (combined with the above property) would just limit us to *functions*;
predicates must range over truth values.
There are a few approaches we could take,
probably the easiest of which would be to associate variables *bT* and *bF* with "boolean true" and "boolean false".
Then we could just say

∀

f(fPbT∨fPbF)

Which suffices to get us a law-of-excluded-middle in this weird logic-inside-of-logic we've built.