Documentation

CslibFrontier.Logics.FirstOrder.FiniteVariable.PebbleGame

Pebble games #

The k-pebble game on two L-structures M and N is played with k pairs of pebbles. In each round Spoiler picks a pebble index i, places the M-pebble or the N-pebble of pair i on an element of that structure (lifting it first if it was already placed), and Duplicator places the other pebble of pair i in the other structure. Duplicator wins a play when, after every round, the placed pairs define a partial isomorphism. Unlike the Ehrenfeucht–Fraïssé game, pebbles are reused, and the game may continue for any number of rounds, even forever.

A position is a set S : Set (Fin k) of placed pebble indices together with assignments a : Fin k → M and b : Fin k → N; only the values on S matter (pebbleWins_congr). Moving pebble i to c and d gives the position (insert i S, update a i c, update b i d). These are exactly the assignments of the k-variable formulas of CslibFrontier.Logics.FirstOrder.FiniteVariable.Basic, whose quantifiers ex i and all i update variable i.

PebbleWins L n S a b says that Duplicator wins the n-round game from the position, and PebbleWinsForever L S a b that she wins the game that continues forever, witnessed by a back-and-forth invariant. PebbleWins.realize_iff is the easy direction of the pebble-game characterization of FO^k: a winning position satisfies the same k-variable formulas of quantifier rank at most n whose free variables are placed. The converse needs finitely many relation symbols and is proved in CslibFrontier.Logics.FirstOrder.FiniteVariable.Hintikka.

Main definitions #

Main results #

References #

Partial isomorphisms on placed pebbles #

structure Cslib.Logic.FO.PartialIsoOn (L : FirstOrder.Language) {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} (S : Set (Fin k)) (a : Fin k → M) (b : Fin k → N) :

The pebbles with indices in S define a partial isomorphism a i ↦ b i: the map is well defined and injective, and it preserves and reflects every relation among placed pebbles.

theorem Cslib.Logic.FO.PartialIsoOn.refl {L : FirstOrder.Language} {M : Type w} [L.Structure M] {k : ℕ} (S : Set (Fin k)) (a : Fin k → M) :
PartialIsoOn L S a a
theorem Cslib.Logic.FO.PartialIsoOn.symm {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PartialIsoOn L S a b) :
PartialIsoOn L S b a
theorem Cslib.Logic.FO.PartialIsoOn.trans {L : FirstOrder.Language} {M : Type w} {N : Type w'} {P : Type w''} [L.Structure M] [L.Structure N] [L.Structure P] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} {c : Fin k → P} (h₁ : PartialIsoOn L S a b) (h₂ : PartialIsoOn L S b c) :
PartialIsoOn L S a c
theorem Cslib.Logic.FO.PartialIsoOn.mono {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S T : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (hST : S ⊆ T) (h : PartialIsoOn L T a b) :
PartialIsoOn L S a b
theorem Cslib.Logic.FO.PartialIsoOn.congr {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a a' : Fin k → M} {b b' : Fin k → N} (ha : Set.EqOn a a' S) (hb : Set.EqOn b b' S) (h : PartialIsoOn L S a b) :
PartialIsoOn L S a' b'

A partial isomorphism on S depends only on the values of the pebbles in S.

theorem Cslib.Logic.FO.partialIsoOn_empty {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} [IsEmpty (L.Relations 0)] (a : Fin k → M) (b : Fin k → N) :

With no pebbles placed, every position is a partial isomorphism, provided L has no nullary relation symbols: these are sentences that the two structures would have to agree on.

theorem Cslib.Logic.FO.partialIsoOn_comp_equiv_iff {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k k' : ℕ} (σ : Fin k' ≃ Fin k) {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PartialIsoOn L (⇑σ ⁻¹' S) (a ∘ ⇑σ) (b ∘ ⇑σ) ↔ PartialIsoOn L S a b

Reindexing pebble names along a bijection preserves partial isomorphisms.

theorem Cslib.Logic.FO.PartialIsoOn.update_of_mem {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PartialIsoOn L S a b) {i j₀ : Fin k} (hj₀ : j₀ ∈ S) {c : M} (hc : a j₀ = c) :
PartialIsoOn L (insert i S) (Function.update a i c) (Function.update b i (b j₀))

Updating pebble i to an already-placed pebble a j₀ (j₀ ∈ S) preserves PartialIsoOn when paired with b j₀.

theorem Cslib.Logic.FO.PartialIsoOn.update_eq_iff_of_fresh {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PartialIsoOn L S a b) {i : Fin k} {c : M} {d : N} (hc : ∀ j ∈ S, j ≠ i → a j ≠ c) (hd : ∀ j ∈ S, j ≠ i → d ≠ b j) {r : Fin k} (hr : r ∈ insert i S) {q : Fin k} (hq : q ∈ insert i S) :

Equality preservation on insert i S when updating pebble i to fresh elements c and d outside {a j | j ∈ S ∧ j ≠ i} and {b j | j ∈ S ∧ j ≠ i}.

The game #

def Cslib.Logic.FO.PebbleWins (L : FirstOrder.Language) {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} :
ℕ → Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop

Duplicator wins the n-round k-pebble game from the position (S, a, b), where S is the set of placed pebble indices and a, b give their positions in M and N: the placed pebbles define a partial isomorphism and, if a round remains, for every pebble index i and every placement of the M-pebble (or N-pebble) of pair i, Duplicator can place the other pebble of pair i so that she wins the remaining rounds.

The values of a and b outside S do not matter (pebbleWins_congr). Since positions are total assignments Fin k → M and Fin k → N, a position exists only when k = 0 or both structures are nonempty: for k > 0 and empty M or N the statement is vacuous, and results about games starting with no pebbles placed (S = ∅) say nothing about empty structures.

theorem Cslib.Logic.FO.pebbleWins_zero {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PebbleWins L 0 S a b ↔ PartialIsoOn L S a b
theorem Cslib.Logic.FO.pebbleWins_succ {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PebbleWins L (n + 1) S a b ↔ PartialIsoOn L S a b ∧ (∀ (i : Fin k) (c : M), ∃ (d : N), PebbleWins L n (insert i S) (Function.update a i c) (Function.update b i d)) ∧ ∀ (i : Fin k) (d : N), ∃ (c : M), PebbleWins L n (insert i S) (Function.update a i c) (Function.update b i d)
theorem Cslib.Logic.FO.PebbleWins.partialIsoOn {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PebbleWins L n S a b) :
PartialIsoOn L S a b
theorem Cslib.Logic.FO.PebbleWins.forth {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PebbleWins L (n + 1) S a b) (i : Fin k) (c : M) :
∃ (d : N), PebbleWins L n (insert i S) (Function.update a i c) (Function.update b i d)
theorem Cslib.Logic.FO.PebbleWins.back {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PebbleWins L (n + 1) S a b) (i : Fin k) (d : N) :
∃ (c : M), PebbleWins L n (insert i S) (Function.update a i c) (Function.update b i d)

Basic properties of the game #

theorem Cslib.Logic.FO.PebbleWins.mono {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k m n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
m ≤ n → PebbleWins L n S a b → PebbleWins L m S a b

Winning a game implies winning every shorter game.

theorem Cslib.Logic.FO.PebbleWins.of_subset {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S T : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
S ⊆ T → PebbleWins L n T a b → PebbleWins L n S a b

Lifting placed pebbles keeps the position winning.

theorem Cslib.Logic.FO.pebbleWins_congr {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a a' : Fin k → M} {b b' : Fin k → N} :
Set.EqOn a a' S → Set.EqOn b b' S → PebbleWins L n S a b → PebbleWins L n S a' b'

Winning depends only on the positions of the placed pebbles.

theorem Cslib.Logic.FO.PebbleWins.refl {L : FirstOrder.Language} {M : Type w} [L.Structure M] {k : ℕ} (n : ℕ) (S : Set (Fin k)) (a : Fin k → M) :
PebbleWins L n S a a
theorem Cslib.Logic.FO.PebbleWins.symm {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PebbleWins L n S a b → PebbleWins L n S b a
theorem Cslib.Logic.FO.PebbleWins.trans {L : FirstOrder.Language} {M : Type w} {N : Type w'} {P : Type w''} [L.Structure M] [L.Structure N] [L.Structure P] {k n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} {c : Fin k → P} :
PebbleWins L n S a b → PebbleWins L n S b c → PebbleWins L n S a c

Back-and-forth invariants and the infinite game #

structure Cslib.Logic.FO.IsPebbleBackAndForth (L : FirstOrder.Language) {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} (I : Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop) :

A back-and-forth invariant for the k-pebble game: a set of positions, each a partial isomorphism on its placed pebbles, such that every move of Spoiler from a position in the set has an answer leading back into the set.

  • partialIsoOn {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} : I S a b → PartialIsoOn L S a b

    Every position of the invariant is a partial isomorphism on its placed pebbles.

  • forth {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} : I S a b → ∀ (i : Fin k) (c : M), ∃ (d : N), I (insert i S) (Function.update a i c) (Function.update b i d)

    Every move of Spoiler in M has an answer in N staying in the invariant.

  • back {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} : I S a b → ∀ (i : Fin k) (d : N), ∃ (c : M), I (insert i S) (Function.update a i c) (Function.update b i d)

    Every move of Spoiler in N has an answer in M staying in the invariant.

theorem Cslib.Logic.FO.IsPebbleBackAndForth.pebbleWins {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {I : Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop} (hI : IsPebbleBackAndForth L I) {n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
I S a b → PebbleWins L n S a b

Every position of a back-and-forth invariant is won by Duplicator in every finite game.

def Cslib.Logic.FO.PebbleWinsForever (L : FirstOrder.Language) {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} (S : Set (Fin k)) (a : Fin k → M) (b : Fin k → N) :

Duplicator wins the k-pebble game that continues forever from the position (S, a, b): the position belongs to a back-and-forth invariant. As for PebbleWins, the statement is vacuous for k > 0 when M or N is empty.

theorem Cslib.Logic.FO.pebbleWinsForever_iff_exists_isPebbleBackAndForth {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PebbleWinsForever L S a b ↔ ∃ (I : Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop), IsPebbleBackAndForth L I ∧ I S a b

Unfolds PebbleWinsForever into existence of a k-pebble back-and-forth invariant.

theorem Cslib.Logic.FO.IsPebbleBackAndForth.pebbleWinsForever {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {I : Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop} (hI : IsPebbleBackAndForth L I) {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : I S a b) :

Every position of a back-and-forth invariant is won by Duplicator in the infinite game.

theorem Cslib.Logic.FO.PebbleWinsForever.pebbleWins {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : PebbleWinsForever L S a b) (n : ℕ) :
PebbleWins L n S a b

Winning the infinite game implies winning every finite game.

theorem Cslib.Logic.FO.pebbleWinsForever_iff_forall_pebbleWins {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} [Finite M] [Finite N] {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} :
PebbleWinsForever L S a b ↔ ∀ (n : ℕ), PebbleWins L n S a b

The infinite pebble game on finite structures. On finite structures, Duplicator wins the k-pebble game that continues forever exactly when she wins the n-round game for every n [Lib04] (remark before Proposition 11.8). On infinite structures only the forward implication holds in general.

theorem FirstOrder.Language.Equiv.pebbleWinsForever {L : Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} (e : L.Equiv M N) (S : Set (Fin k)) (a : Fin k → M) :

Duplicator wins the infinite game between a structure and an isomorphic copy, from a position and its image.

theorem FirstOrder.Language.Equiv.pebbleWins {L : Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} (e : L.Equiv M N) (n : ℕ) (S : Set (Fin k)) (a : Fin k → M) :

Duplicator wins every finite game between a structure and an isomorphic copy, from a position and its image.

The easy direction of the pebble-game characterization of FO^k #

theorem Cslib.Logic.FO.FiniteVariable.GenFormula.realize_iff_of_step {L : FirstOrder.Language} {M : Type w} {N : Type w'} [L.Structure M] [L.Structure N] {k : ℕ} {Q : Type} [Quantifier Q M] [Quantifier Q N] (R : ℕ → Set (Fin k) → (Fin k → M) → (Fin k → N) → Prop) (h0 : ∀ {n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N}, R n S a b → PartialIsoOn L S a b) (hquant : ∀ {n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (q : Q) (i : Fin k) (pM : M → Prop) (pN : N → Prop), R (n + 1) S a b → (∀ {c : M} {d : N}, R n (insert i S) (Function.update a i c) (Function.update b i d) → (pM c ↔ pN d)) → (Quantifier.eval q pM ↔ Quantifier.eval q pN)) {n : ℕ} {S : Set (Fin k)} {a : Fin k → M} {b : Fin k → N} (h : R n S a b) {φ : GenFormula Q L k} (hr : φ.quantifierRank ≤ n) (hS : ↑φ.freeVars ⊆ S) :
φ.Realize a ↔ φ.Realize b

Generic quantifier-rank induction for preserving GenFormula truth across a family of n-round game positions R n S a b. Base positions must form partial isomorphisms on S, and stepping from n + 1 to n at i must preserve each quantifier q : Q.

Pebble games, easy direction. If Duplicator wins the n-round k-pebble game from (S, a, b), then a and b satisfy the same k-variable formulas of quantifier rank at most n whose free variables are placed pebbles. No finiteness assumption is needed.

Infinite pebble games, easy direction. If Duplicator wins the infinite k-pebble game from (S, a, b), then a and b satisfy the same k-variable formulas whose free variables are placed pebbles.