Documentation

Pdl.TableauGame

The Tableau Game (Section 6.2 and 6.3) #

Prover and Builder positions #

Equations
Instances For
    Equations
    Instances For
      inductive ProverPos (H : History) (X : Sequent) :
      Instances For
        inductive BuilderPos (H : History) (X : Sequent) :
        Instances For
          def instDecidableEqBuilderPos.decEq {H✝ : History} {X✝ : Sequent} (x✝ x✝¹ : BuilderPos H✝ X✝) :
          Decidable (x✝ = x✝¹)
          Equations
          Instances For
            Equations
            Instances For
              def posOf (H : History) (X : Sequent) :

              If we reach this sequent, what is the next game position? Includes winning positions.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For

                Moves #

                The moves for the tableauGame.

                Equations
                Instances For
                  def move (next p : GamePos) :

                  move next p says that we can move from p to next.

                  TODO: rewrite to an inductive, and flip the order?

                  Equations
                  Instances For
                    theorem no_moves_of_rep {Hist : History} {X : Sequent} {pos : ProverPos Hist X BuilderPos Hist X} (h : rep Hist X) :
                    theorem move_then_no_rep {Hist : History} {X : Sequent} {next : GamePos} {p : ProverPos Hist X BuilderPos Hist X} :
                    move next Hist, X, p¬rep Hist X
                    theorem move.hist {next : GamePos} {Hist : History} {X : Sequent} {pos : ProverPos Hist X BuilderPos Hist X} (mov : move next Hist, X, pos) :
                    (∃ (newPos : ProverPos Hist X BuilderPos Hist X), next = Hist, X, newPos) ∃ (Y : Sequent) (newPos : ProverPos (X :: Hist) Y BuilderPos (X :: Hist) Y), next = X :: Hist, Y, newPos
                    theorem move.hist_suffix {next : GamePos} {Hist : History} {X : Sequent} {pos : ProverPos Hist X BuilderPos Hist X} (mov : move next Hist, X, pos) :
                    Hist <:+ next.fst
                    theorem move.trans_hist_suffix {pZ pX : GamePos} (mov : Relation.TransGen move pZ pX) :
                    pX.fst <:+ pZ.fst
                    theorem move_iff {H : History} {X : Sequent} {p : ProverPos H X BuilderPos H X} {next : GamePos} :
                    move next H, X, p (∃ (nrep : ¬rep H X) (Xbasic : X.basic), p = Sum.inl (ProverPos.bas nrep Xbasic) ∃ (L : List Formula) (R : List Formula), X = (L, R, none) ((∃ (δs : List Program) (δ : Program) (ψ : Formula), ¬ψ.isBox (~⌈⌈δs⌉⌉δψ) L next = X :: H, (L.erase (~⌈⌈δs⌉⌉δψ), R, some (Sum.inl (~'⌊⌊δs⌋⌋δAnyFormula.normal ψ))), posOf (X :: H) (L.erase (~⌈⌈δs⌉⌉δψ), R, some (Sum.inl (~'⌊⌊δs⌋⌋δAnyFormula.normal ψ)))) ∃ (δs : List Program) (δ : Program) (ψ : Formula), ¬ψ.isBox (~⌈⌈δs⌉⌉δψ) R next = X :: H, (L, R.erase (~⌈⌈δs⌉⌉δψ), some (Sum.inr (~'⌊⌊δs⌋⌋δAnyFormula.normal ψ))), posOf (X :: H) (L, R.erase (~⌈⌈δs⌉⌉δψ), some (Sum.inr (~'⌊⌊δs⌋⌋δAnyFormula.normal ψ)))) (∃ (a : ) (ξ : AnyFormula), X = (L, R, some (Sum.inl (~'·aξ))) ((∃ (φ : Formula), ξ = AnyFormula.normal φ next = X :: H, (~φ :: projection a L, projection a R, none), posOf (X :: H) (~φ :: projection a L, projection a R, none)) (∃ (χ : LoadFormula), ξ = AnyFormula.loaded χ next = X :: H, (projection a L, projection a R, some (Sum.inl (~'χ))), posOf (X :: H) (projection a L, projection a R, some (Sum.inl (~'χ)))) next = X :: H, (List.insert (~(·aξ).unload) L, R, none), posOf (X :: H) (List.insert (~(·aξ).unload) L, R, none))) ∃ (a : ) (ξ : AnyFormula), X = (L, R, some (Sum.inr (~'·aξ))) ((∃ (φ : Formula), ξ = AnyFormula.normal φ next = X :: H, (projection a L, ~φ :: projection a R, none), posOf (X :: H) (projection a L, ~φ :: projection a R, none)) (∃ (χ : LoadFormula), ξ = AnyFormula.loaded χ next = X :: H, (projection a L, projection a R, some (Sum.inr (~'χ))), posOf (X :: H) (projection a L, projection a R, some (Sum.inr (~'χ)))) next = X :: H, (L, List.insert (~(·aξ).unload) R, none), posOf (X :: H) (L, List.insert (~(·aξ).unload) R, none))) (∃ (nrep : ¬rep H X) (nbas : ¬X.basic), p = Sum.inl (ProverPos.nbas nrep nbas) ∃ (ltab : LocalTableau X), next = H, X, Sum.inr (BuilderPos.ltab nrep nbas ltab)) ∃ (nrep : ¬rep H X) (nbas : ¬X.basic) (ltab : LocalTableau X), p = Sum.inr (BuilderPos.ltab nrep nbas ltab) YendNodesOf ltab, next = X :: H, Y, posOf (X :: H) Y
                    theorem move_twice_neq {A B C : GamePos} (B_C : move C B) (A_B : move B A) :

                    After two moves we must reach a different sequent. Is this useful for termination?

                    Termination via finite FL closure #

                    Intuitively, we want to say that each step from (L,R,O) in a tableau to (L',R',O') stays in the FL of (L,R,O). Moreover, each side left/right stays within its own FL closure. This does not mean that L' must be in the FL of L, because the O may also contribute to the left part. This makes Sequent.subseteq_FL tricky to define.

                    Moreover, we are working with lists (or, by ignoring their order, multisets) and thus staying in the FL closure does not imply that there are only finitely many sequents reachable: by repeating the same formulas the length of the list may increase. To tackle this we want to use that rep is defined with setEqTo that ignores multiplicity, so that even if there are infinitely many different lists and thus sequents in principle reachable, we still cannot have an infinite chain because that would mean we must have a "set-repeat" that is not allowed.

                    X is a component-wise multisubset of the FL-closure of Y. Implies Sequent.subseteq_FL but not vice versa, as infinitely many multisets yield the same set.

                    BROKEN - does not take into account X.O and Y.O on both sides. Hopefully we will never need this anyway. Use Sequent.subseteq_FL instead.

                    Equations
                    Instances For

                      Sequent Y is a component-wise subset of the FL-closure of X. Note that by component we mean left and right (and not L, R, O).

                      WORRY: Is using Sequent.O.L here a problem because it might not be injective? (Because it calls unload where both ⌊a⌋⌊b⌋p and ⌊a⌋⌈b⌉p become ⌈a⌉⌈b⌉p.)

                      Equations
                      Instances For
                        @[simp]
                        theorem LocalRule.stays_in_FL {Lcond Rcond : List Formula} {Ocond : Olf} {B : List Sequent} (rule : LocalRule (Lcond, Rcond, Ocond) B) (Y : Sequent) :
                        Y BY.subseteq_FL (Lcond, Rcond, Ocond)

                        Helper for move_inside_FL

                        theorem move_inside_FL {next p : GamePos} :
                        move next pnext.snd.fst.subseteq_FL p.snd.fst

                        A list of sequents that are all FL-subsequents of the given sequent. The list defined here is not complete because there are infinitely many such other sequents. But the list is exhaustive modulo setEqTo, as will be shown later via the Seqt quotient. Defined using List.instMonad.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For

                          NOTE

                          The following do NOT hold / do NOT exist because there are in fact infinitely many FL-subsequents of a given sequent, so the list returned by all_subseteq_FL can never contain all.

                          def Sequent.all_subseteq_FL_spec (X Y : Sequent) (h : Y.subseteq_FL X) :
                              ⟨Y,h⟩ ∈ Sequent.all_subseteq_FL X := sorry
                          
                          instance Sequent.subseteq_FL_fintype {X : Sequent} :
                              Fintype { Y // Sequent.subseteq_FL Y X } := sorry
                          

                          Hence, we now define the Quotient modulo Sequent.setEqTo within which there are only finitely many FL-subsequents.

                          TODO move Seqt to Sequent.lean and Sequent.subseteq_FL_congr to FischerLadner.lean later?

                          @[reducible, inline]
                          abbrev Seqt :

                          Yes, it's a pun. A Sequent modulo Sequent.setEqTo.

                          Equations
                          Instances For

                            Needed to make List.toFinset work for List Seqt. Strange that this is not inferred from instDecidableRelSequentSetEqTo automatically.

                            Equations
                            theorem Sequent.subseteq_FL_congr (a₁ b₁ a₂ b₂ : Sequent) :
                            a₁ a₂b₁ b₂a₁.subseteq_FL b₁ = a₂.subseteq_FL b₂

                            Congruence for Sequent.subseteq_FL, used to make Seqt.subseteq_FL well-defined.

                            In the quotient the moves keep us inside the FL. UNUSED, delete this?

                            theorem Seqt.all_subseteq_FL_spec {Xs Ys : Seqt} (Ys_in : Ys Xs.all_subseteq_FL) :
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For
                              Equations
                              • =
                              Instances For

                                In the quotient for setEqTo there are only finitely many FL-subsets for a given Seqt. This means "there are only finitely many "sequents modulo setEq" that are subseteq_FL Y.

                                theorem help {α : Type} {f : α} {p : αProp} (h_p : ∀ (n : ), p (f n)) (h_fin : Finite { x : α // p x }) :
                                ∃ (k1 : ) (k2 : ), k1 k2 f k1 = f k2

                                General helper lemma: If we have an enumeration of infinitely many values, and all of them have a certain property, but we also know that there are only finitely many values with that property, then there must be identical values in the enuemration.

                                Lemma 6.10, sort of. Because the move relation is wellfounded, all matches must be finite. Note that the paper does not prove this, only says it is similar to the proof that PDL-tableaux are finite, i.e. Lemma 4.10 which uses the Fischer-Ladner closure.

                                Actual Game Definition #

                                The game defined in Section 6.2.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  @[simp]
                                  theorem tableauGame_turn_Prover {Hist : History} {X : Sequent} {lpr : ProverPos Hist X} :
                                  @[simp]
                                  theorem tableauGame_turn_Builder {Hist : History} {X : Sequent} {lpr : BuilderPos Hist X} :

                                  From Prover winning strategies to tableau #

                                  @[irreducible]
                                  theorem gameP_general (Hist : History) (X : Sequent) (sP : Strategy tableauGame Prover) (pos : ProverPos Hist X BuilderPos Hist X) (h : winning sP Hist, X, pos) :
                                  Nonempty (Tableau Hist X)

                                  After history Hist, if Prover has a winning strategy then there is a closed tableau. Note: we skip Definition 6.9 (Strategy Tree for Prover) and just use the Strategy type. This is the induction loading for gameP.

                                  The starting position for the given sequent. With an empty history and using posOf to determine the first GamePos.

                                  Equations
                                  Instances For
                                    theorem gameP (X : Sequent) (s : Strategy tableauGame Prover) (h : winning s (startPos X)) :

                                    If Prover has a winning strategy then there is a closed tableau.

                                    From Builder winning strategies to model graphs (Section 6.3) #

                                    inductive BuildTree :

                                    Tree data type to keep track of choices made by Builder. Might still need to be tweaked.

                                    Instances For
                                      @[irreducible]

                                      The generated strategy tree for Builder

                                      Equations
                                      Instances For
                                        theorem strmg (X : Sequent) (s : Strategy tableauGame Builder) (h : winning s (startPos X)) :
                                        ∃ (WS : Finset (Finset Formula)) (mg : ModelGraph WS), X.toFinset WS

                                        Theorem 6.21: If Builder has a winning strategy then there is a model graph.