# Logic for Computer Science/Querying Proofs

## Partial Isomorphism

Definition (partial isomorphism on relational S-Structures)

Let $\mathfrak{A}$ and $\mathfrak{B}$ be relational S-Structures and p be a mapping. Then p is said to be a Partial Isomorphism from $\mathfrak{A}$ to $\mathfrak{B}$ iff all of the following hold

• dom(p) $\subset$ A and codom(p) $\subset$ B
• for every $a_1$, $a_2$: $a_1$ = $a_2$ iff p($a_1$) = p($a_2$).
• for every constant symbol c from S and every a: a = c iff p(a) = c
• for every n-ary relation symbol R from S and $a_1$, ..., $a_n$: $R^\mathfrak{A}$ $a_1$ ... $a_n$ iff $R^\mathfrak{B}$ $p(a_1)$ ... $p(a_n)$

where $a_*$ $\in$ A, $b_*$ $\in$ B.

Remark

• I.e. a partial Isomorphism on $\mathfrak{A}$ and $\mathfrak{B}$ is a (plain) Isomprphism on the substructures obtained by choosing dom(p) and codom(p) and 'prune' constants and relations respectively.

Example

• Let S ={<} be defined over A ={1, 2, 3} and B ={3, 4, 5, 6} the 'usual' way. Then $p_1$ with 1->3 and 2->4 is a partial isomorphism (since 1 < 2 and p(1) < p(2)) as well as $p_3$ with 2->3 and 3->6 as well as $p_2$ with 1->6. Whereas neither $p_4$ with 1->6 and 2->3 (since 1 < 2 but not p(1) < p(2)) nor $p_5$ with 2->5 and 3->5 is a partial isomorphism.
• Let S ={R} with $R^\mathfrak{A} =\{(1, 2), (2, 3), (3, 4), (4, 1)\}$ (a 'square') and $R^\mathfrak{B} =\{(1, 2), (1, 3), (3, 4), (3, 5)\}$ (a 'binary tree'). A ={1, ..., 4} and B ={1, ..., 5}. Then p: {1, 2, 3} -> {1, 3, 4} with 1->1, 2->3, 3->4 is a partial isomorphism from $\mathfrak{A}$ to $\mathfrak{B}$, since {(1, 2), (2, 3)} becomes {(1, 3), (3, 4)}. Notice that in case $R_\mathfrak{B}$ contained e.g. (4, 1) additionally, p would not be a partial isomorphism.
• Let S ={<} be defined over A ={1, 2, 3, 4, 5, 6} and B ={1, 3, 5} in the 'usual' way. Then p with 2->3 and 4->5 defines a partial isomorphism. Notice that e.g. $\exists_x( x<4 \and 2 holds on $\mathfrak{A}$ but $\exists_x( x does not hold on $\mathfrak{B}$. I.e. in general the validity of sentences with quantifiers is not preserved. So in order to preserve this validity we need sth stronger than partial isomorphism. That is mainly what the Ehrenfeucht-games will provide us with.

## Ehrenfeucht-Fraisse Games

Definition

Suppose that we are given two structures $\mathfrak{A}$ and $\mathfrak{B}$, each with no function symbols and the same set of relation symbols, and a fixed natural number n.

Then an Ehrenfeucht-Fraisse game is a game with the subsequent properties:

• Elements
• a position is a pair of sequences α and β, both of length i, i $\in$ 0, ..., n
• the starting position is the pair of empty sequences (i = 0)
• the game is finished iff α and β are both of size n
• the players are the 'spoiler' S and the 'duplicator' D
• Moves
• moves are carried out alternatingly
• S moves first
• S chooses exactly one element of either A or B that has not been chosen already (latter is not relevant in the first move)
• D chooses exactly one element of the other set, i.e. if S has chosen from A then D has to choose from B and if S chose one from B then D has to choose from A.
• Winning & Information
• D wins iff the final position defines a partial isomorphism by mapping the i-th elements of α and β, for all i.
• else S wins
• both players know both of the structures completely and also know about all the moves played previously

Remark

• notice that above constants are not mentioned (yet)

Example

• Let A ={1, 2, 3}, B ={1, 2}, S ={ < }, where '<' is defined the 'usual' way. Here player S can win by playing 2 in the first move and playing the second move corresponding to D's first move in the following way: to 1 he responds 1 and in case of 2 his answer is 3. In both cases D can not follow. He may have isomorphic structures e.g. {2, 3} and {1, 2} but the mapping defined by the sequence of moves is twisted, i.e. it maps 2 to 2 (1st move) and 3 to 1 and thus is not a partial isomorphism.
• Let A ={1, 2, ..., 9}, B ={1, 2, ..., 8}, S ={ < }, where '<' is defined the 'usual' way. So, what is the best way to play for S? In case S picks 1 from A, D picks 1 from B and the game left is mainly the same as before just with 1 element less but also 1 move played already. But we can make a better deal for the price of one move: by playing 5 in A, D is forced to play 5 (or 4) in B what leaves two possible ways to proceed for S: either playing the {1, 2, 3, 4} vs {1, 2, 3, 4} game what of course would lead to an obvious win for D, or playing the {6, 7, 8, 9} vs {6, 7, 8} game. Choosing the latter the quickest win for S is 7 - 7, 8 - 8 and finally 9 with a 4 move win. Since there is no better way to play for both sides S wins if n > 3 for the structures above.
• The result from the above example can be generalised to: For linear orders in an n-move Ehrenfeucht game D has a winning strategy if the size of each of A and B is less or equal 2^n.
• Caption
The following is an (popular) illustrative representation of an Ehrenfeucht-game: from the two sequences S has won iff the lines connecting matching letters cross (if D can find a match at all), e.g. S wins after three moves:

...

## Quantifier Rank

Definition

The function qr(φ) is said to be the Quantifier Ranking of φ iff

• $qr(\varphi) = 0$, for φ atomic
• $qr(\varphi_1 \land \varphi_2) = qr(\varphi_1 \lor \varphi_2) = max(qr(\varphi_1), qr(\varphi_2))$
• $qr(\lnot \varphi) = qr(\varphi)$
• $qr(\forall \varphi) = qr(\exists \varphi) = qr(\varphi)+1$

Remark

• qr(φ) describes the 'depth of quantifier nesting' of φ.
• We write FO[k] for all Formulas of Quantifier Rank up to k.
• Notice that in prenex normal form the Quantifier Rank of φ is exactly the number of quantifiers appearing in φ.

Example

• The sentence $\forall_x ( \exists_y ((\lnot x = y) \land x R y ) ) \land ( \exists_y ((\lnot x = z) \land z R x ) )$ has the Quantifier Rank 2.
• The sentence in prenex normal form $\forall_x\exists_y\exists_y ((\lnot x = y) \land x R y ) \land ( (\lnot x = z) \land z R x )$ has the Quantifier Rank 3. Notice that it is equivalent to the above.

...

## Ehrenfeucht-Fraisse Theorem

Theorem

Let $\mathfrak{A}$ and $\mathfrak{B}$ be two structures in a relational vocabulary. Then the following are equivalent

• $\mathfrak{A}$ and $\mathfrak{B}$ agree on FO[k]
• $\mathfrak{A}\equiv_k \mathfrak{B}$

Remark

• The proof is omitted here
• The concept of back and forth relations is not mentioned here, since we do not need it subsequently

## Expressibility Proofs employing Ehrenfeucht-Fraisse Games

The basis for considering expressibility by Ehrenfeucht-Fraisse-Games is given by the following corollary from the above theorem:

Corollary

Let P be a property of finite σ-structures. Then the following are equivalent

• P is not expressible in FO
• for every k $\in \mathbb{N}$ there exist two finite σ-structures $\mathfrak{A}_k$ and $\mathfrak{B}_k$, such that the following are both satisfied
• $\mathfrak{A}_k\equiv_k \mathfrak{B}_k$
• $\mathfrak{A}_k$ has P and $\mathfrak{B}_k$ does not have P

Example

• To begin pick two linear orders say A ={1, 2, 3, 4} and B ={1, 2, 3, 4, 5}. For a two-move Ehrenfeucht game D is to win, obviously. This gives us two structures that satisfy the above conditions for k = 2 and the Property having even cardinality (that A has and B doesn't). Now we have to expand this over all k $\in \mathbb{N}$. From the above example we adopt that in a linear order of cardinality $2^k$ or higher D has a winning strategy. Thus we choose the cardinalities depending on k as |A| = $2^k$ and |B| = $2^k$+1. So we have found an even A and an odd B for every k, where D has a winning strategy. Thus (by the corollary) having even/odd cardinality is a property that can not be expressed in FO for finite σ-structures of linear order.
• Graphs in general are a popular object of interest for FO expressibility. So e.g. it can be shown that the following properties can't be defined in FO:
• Connectivity
• Cyclicity
• Planarity
• Hamiltonicity
• n-colorability
• etc

...