Logic for Computer Science/Querying Proofs

From Wikibooks, open books for an open world
Jump to: navigation, search

Partial Isomorphism[edit]

Definition (partial isomorphism on relational S-Structures)

Let and be relational S-Structures and p be a mapping. Then p is said to be a Partial Isomorphism from to iff all of the following hold

  • dom(p) A and codom(p) B
  • for every , : = iff p() = p().
  • 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 , ..., : ... iff ...

where A, B.


  • I.e. a partial Isomorphism on and is a (plain) Isomprphism on the substructures obtained by choosing dom(p) and codom(p) and 'prune' constants and relations respectively.


  • Let S ={<} be defined over A ={1, 2, 3} and B ={3, 4, 5, 6} the 'usual' way. Then with 1->3 and 2->4 is a partial isomorphism (since 1 < 2 and p(1) < p(2)) as well as with 2->3 and 3->6 as well as with 1->6. Whereas neither with 1->6 and 2->3 (since 1 < 2 but not p(1) < p(2)) nor with 2->5 and 3->5 is a partial isomorphism.
  • Let S ={R} with (a 'square') and (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 to , since {(1, 2), (2, 3)} becomes {(1, 3), (3, 4)}. Notice that in case 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. holds on but does not hold on . 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[edit]


Suppose that we are given two structures and , 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 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


  • notice that above constants are not mentioned (yet)


  • 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[edit]


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

  • , for φ atomic


  • 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 φ.


  • The sentence has the Quantifier Rank 2.
  • The sentence in prenex normal form has the Quantifier Rank 3. Notice that it is equivalent to the above.


Ehrenfeucht-Fraisse Theorem[edit]


Let and be two structures in a relational vocabulary. Then the following are equivalent

  • and agree on FO[k]


  • 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[edit]

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


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

  • P is not expressible in FO
  • for every k there exist two finite σ-structures and , such that the following are both satisfied
    • has P and does not have P


  • 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 . From the above example we adopt that in a linear order of cardinality or higher D has a winning strategy. Thus we choose the cardinalities depending on k as |A| = and |B| = +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