- Variables x, y, z, ...
- Symbols of functions (and constants) f,g, ... a, b, ...

Example: x, 1, x+1 are terms. x+1 > 0 is an atomic formula. (1 is a constant, + is a function, and > is a predicate.)

Formulas: Expressions built on atomic formulas, the logical connectives, and the quantifiers exists and forall.

- The choice of the universe (domain), i.e. the set where the variables are assumed to range.
- The values of the variables (in the domain).
- The interpretation of functions and constants symbols (interpreted as functions and elements of the domain).
- The interpretation of the predicates (interpreted as relations on the domain).

forall x>0 exists y. x*y = 1is True in the domain of rational numbers, but is False in the domain of integer numbers.

Valid formulas: formulas which are True in every domain, and for every possible interpretation of the function, constant, and predicate symbols.

In general the truth tables are not enough to prove that
a fourmula is valid. There are various systems for this purpose;
but anyway (for the purposes of the course)
we will mostly rely on our intuition.
All the laws of classical logic are pretty intuitive except maybe for the
*Law of the excluded middle*:

p or not pThis law, which says that either p is True or its negation is True, brings to curious consequences like the following

There is a person is this room such that, if this person smokes, then everybody in the room smokes.This sentence is true in classical logic (provided that the room is not empty). In fact we can formulate it as:

exists x. (smokes(x) -> forall y. smokes(y))which is equivalent to

(exists x. not smokes(x)) or (forall y. smokes(y))which is (classically) equivalent to

(not (forall x. smokes(x))) or (forall x. smokes(x))Notably, the law of excluded middle is not accepted in other logics, like the Intuitionistic Logic. (We, however, will consider only classical logic in this course.)

forall x. P(x)where P is an arbritrary formula containing x, and the intended domain is the set of natural numbers.

The principle says that, in order to prove the above formula, it is sufficent to prove the following:

- Base case: P(0)
- Inductive step: forall n. P(n) -> P(n+1)

Exercise: prove by induction that

forall x. 1 + 2 + ... + x = x*(x+1)/2

The induction principle can trivially be generalized to start with a base case greater than 0.

- (Base) e
_{1},...,e_{m}are in S - (Inductive rules)

e is in S -> op_{1}(e) is in S,

...

e is in S -> op_{m}(e) is in S

The set S specified by this definition is *the smallest*
subset of U which satisfies points (1) and (2) above (sometimes this
qualification of "smallest" is added explicitly to the definition).
Note that there might be more than one set satisfying (1) and (2), hence it
is important to remember that we intend the smallest one.

This definition can be extended in the obvious way to operations op_{1},... , op_{m} with
more than one argument.

In order to prove the formulaThe correctness of this principle can be explained as follows: Let S' = {x in U | P(x)}. If we prove the base case and the inductive step for P, then we have proved that S' satisfies (1) and (2) above. But S is the smallest such set. Hence S is contained in (or equal to) S'. Therefore for all x in S, P(x) holds.for all x in S. P(x)it is sufficient to prove

- Base case: P(e
_{1}),...,P(e_{m}), and- Inductive step: P(e) -> P(op
_{1}(e)),..., P(e) -> P(op_{m}(e)).

- (Base) a is in L
- (Inductive rules)
- x is in L -> axb is in L
- x, y is in L -> xy is in L

Suppose we want to prove that for every x in L, the number of a's in x is greater than the number of b's. It is easy to prove this property by structural induction. Let us denote by #a(x) the number of a's in x, and by #b(x) the number of b's in x.

- Base case: #a(a) = 1 > 0 = #b(a).
- Inductive step:
- Assume #a(x) > #b(x). Then #a(axb) = #a(x) + 1 > #b(x) + 1 = #b(axb)
- Assume #a(x) > #b(x) and #a(y) > #b(y). Then #a(xy) = #a(x) + #a(y) > #b(x) + #b(y) = Then #b(xy).