# Finite Model Theory/Preliminaries
## First Order Logic (FO)

We only give a very rough summary of FO here. An introduction can be found at FO.

#### Syntax

Syntax is 'just' about sequences of signs. The alphabet of FO consists of:
* Variables $x_{0},x_{1},x_{2},...$
* Logical Connectives: $\neg$, $\land$
* Quantifiers: $\exists$
* Equality: $\equiv$
* Parenthesis: ), (
* n-ary Relation symbols, for no or many n>0, e.g. R(., .)
* Constant symbols (none or many)
The handling of parenthesis is done the 'usual' way and is not formally described further.
For a given set of symbols S, variables and constant symbols are said to be S-Terms.
S-Expressions are obtained by the multiple application of the following rules:
* $t_{1}\equiv t_{2}$ is an expression
* $Rt_{1}...t_{n}$ is an expression, for an n-ary relation symbol R
* $\neg \varphi ,\varphi _{1}\land \varphi _{2}$ are expressions
* $\exists _{x}\varphi$ is an expression
where $t_{.}$ is a term and $\varphi _{.}$ an expression.
So additional connectives for OR, IMPLICATION, EQUIVALENCE etc. can be defined as well as the FOR ALL quantifier.

#### Semantics

Semantics adds the meaning to the language in three steps:
* 1st it defines what the logical symbols (connectives and quantifiers) mean (this always holds in FO),
* 2nd it maps relation symbols and constant symbols to actual relations and constants over a given set of entities (this is usually defined per subject, like Analysis or Statistics) and
* 3rd it maps free variables (not bound to a quantifier) to entities (usually done per Problem, like solving an equation).
1st we assume the Logical Symbols $\neg ,\land ,...,\exists$ to have the usual meaning.
2nd a S-Structure is a pair (A, a) of
* a nonempty set A, the Universe, and
* a mapping a from S, such that
** each n-ary relation symbol is mapped to a n-ary relation on A and
** each constant symbol is mapped to an element of A
3rd an Interpretation is a pair $({\mathfrak {A}},\beta )$ where ${\mathfrak {A}}$ = (A, a) is a S-Structure and $\beta$ is a mapping from all free variables to an element of A.
An Interpretation is said to be a Model of a set $\Phi$ of S-expressions (${\mathfrak {I}}\vDash \Phi$) iff all of the following hold
* ${\mathfrak {I}}(t_{1})={\mathfrak {I}}(t_{1})$, for ${\mathfrak {I}}\vDash t_{1}\equiv t_{2}$
* $R^{n}{\mathfrak {I}}(t_{1}),...,{\mathfrak {I}}(t_{n})$ , for ${\mathfrak {I}}\vDash Rt_{1}...t_{n}$
* Not ${\mathfrak {I}}\vDash \varphi$ , for ${\mathfrak {I}}\vDash \neg \varphi$
* ${\mathfrak {I}}\vDash \varphi _{0})$ and ${\mathfrak {I}}\vDash \varphi _{1})$, for ${\mathfrak {I}}\vDash \varphi _{0}\land \varphi _{1}$
* It exists an $a\in A$ s.t. ${\mathfrak {I}}\vDash \varphi (a)$, for ${\mathfrak {I}}\vDash \exists _{x}\varphi (x)$

## Game

A game is described by
* its players (>1),
* its rules i.e. who plays when and what is allowed to do and
* its possible ends and payoffs.
More formal, it's a tuple (P, T, m, u) where
* P (the Players) is a set, with |P| = n > 1
* is a graph on a set of nodes that forms a taxonomy, i.e. a T is a tree with a dedicated root node. The leafs called terminal nodes T all others decision nodes D. This describes the possible move sequences.
* m is a mapping from D to P, that says who is to move at what point.
* u is a set of mappings u$_i$ (one for each player i) from T to an ordered set U, that give the payoff for a player at each terminal node.
We assume here and in the following that every player has perfect information (so the above definition is incomplete), i.e. all moves of all players made so far, and we don't consider move by chance. Common knowledge about the rules and players is assumed anyway. The above is called the extensive form representation of a game. Others like the normal form reptresentation make simplifying assumptions on this (e.g. about the information) and use the concept of strategy instead of single moves.
Notice that different moves can lead to the same 'position', i.e. a position can be represented more than once in a game-tree. And, the same payoffs can have different meanings to different players.

## Back and Forth Method

Counting a set can get messy due to
* counting things in an other than the natural order
* counting elements multiple times

#### Method

Fix enumerations (without repetition) of the underlying sets:
    ${\begin{matrix}A&=&\{\,a_{1},a_{2},a_{3},\dots \,\},\\\\B&=&\{\,b_{1},b_{2},b_{3},\dots \,\}.\end{matrix}}$
Now we construct a one-to-one correspondence between A and B that is strictly increasing. Initially no member of A is paired with any member of B.
    (1) Let i be the smallest index such that a$_i$ is not yet paired with any member of B. Let j be the smallest index such that b$_j$ is not yet paired with any member of A and a$_i$ can be paired with b$_j$ consistently with the requirement that the pairing be strictly increasing. Pair a$_i$ with b$_j$.
    (2) Let j be the smallest index such that b$_j$ is not yet paired with any member of A. Let i be the smallest index such that a$_i$ is not yet paired with any member of B and b$_j$ can be paired with a$_i$ consistently with the requirement that the pairing be strictly increasing. Pair b$_j$ with a$_i$.
    (3) Go back to step (1).
It still has to be checked that the choice required in step (1) and (2) can actually be made in accordance to the requirements. Using step (1) as an example:
If there are already a$_p$ and a$_q$ in A corresponding to b$_p$ and b$_q$ in B respectively such that $a_{p}<a_{i}<a_{q}$ and $b_{p}<b_{q}$, we choose b$_j$ in between b$_p$ and b$_q$ using density. Otherwise, we choose a suitable large or small element of B using the fact that B has neither a maximum nor a minimum. Choices made in step (2) are dually possible. Finally, the construction ends after countably many steps because A and B are countably infinite. Note that we had to use all the prerequisites.
If we iterated only step (1), rather than going back and forth, then the resulting pairing would fail to be bijective.