Documentation

Pdl.BuildTree

From winning strategies to model graphs (Section 6.3) #

Lessons learned while working on this file:

BuildTree #

def FreeRepeat (Hist : History) (X : Sequent) :

A free repeat is a non-loaded sequent that occured before.

Equations
Instances For
    inductive BuildTree :

    Winning Strategy Tree for Builder. At each step, we consider

    • ALL rules R that prover may choose, followed immediately by
    • ONE of the children then chosen by Builder

    The type is actually similar to Tableau, as it also uses a history, but it does allow open leaves. For choosing a local tableau end node the mutual RuleChoice is needed to avoid the error "nested inductive datatypes parameters cannot contain local variables". Instead of the .lpr constructor here we have .fpr because we only make a RuleTree when Builder wins and thus we can never reach an lpr where Prover would win, but do allow free repeats. As in Tableau note that the history is stored in reverse.

    Instances For
      inductive BuildChoice :
      Instances For
        @[simp]
        theorem BuildChoice.fst_eq_H {H : History} {X : Sequent} {YS : List Sequent} {bc : BuildChoice H X YS} :
        bc.1 = H
        @[irreducible]
        def buildTree (s : Strategy tableauGame Builder) {H : History} {X : Sequent} {p : ProverPos H X} (h : winning s H, X, Sum.inl p) :

        Given a winning Builder strategy, compute its RuleTree. NEW: note the Sum.inl p here. This ensure we start tree building from a Prover position, i.e.

        • not allowing BuilderPos.lpr here (easy, was forbidden already anyway as prover wins there.)
        • not allowing BuilderPos.ltab because we cannot use BuildTree.loc for a single fixed local tab.
        Equations
        Instances For

          Matches #

          inductive Match {H : History} {X : Sequent} :
          BuildTree H XType

          A match is a path inside a BuildTree. Analogous to PathIn for Tableau. In Game Theory this could be called a "rollout", but note that it stays within the given Builder strategy tree and it is not tracking all intermediate game positions.

          Instances For
            @[irreducible]
            def Match.all {H : History} {X : Sequent} (bt : BuildTree H X) :
            List (Match bt)
            Equations
            Instances For
              theorem Match.all_spec {H : History} {X : Sequent} (bt : BuildTree H X) (m : Match bt) :
              m all bt
              def Match.length {H : History} {X : Sequent} {bt : BuildTree H X} :
              Match bt

              Inspired by PathIn.length. Counting the steps made by a Match in a BuildTree. Note that such a step may be combinations of a prover and a builder move.

              Equations
              Instances For
                def Match.btAt {H : History} {X : Sequent} {bt : BuildTree H X} :
                Match bt(H' : History) × (Y : Sequent) × BuildTree H' Y
                Equations
                Instances For
                  def Match.append {H : History} {X : Sequent} {bt : BuildTree H X} (m1 : Match bt) (m2 : Match m1.btAt.snd.snd) :
                  Equations
                  Instances For
                    structure Match.locEdge {x✝ : History} {x✝¹ : Sequent} {bt : BuildTree x✝ x✝¹} (m n : Match bt) :
                    Instances For
                      structure Match.pdlEdge {x✝ : History} {x✝¹ : Sequent} {bt : BuildTree x✝ x✝¹} (m n : Match bt) :
                      Instances For
                        def Match.Edge {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} (m n : Match bt) :

                        The parent-child relation ⋖_𝕋 in a Builder strategy tree.

                        Equations
                        Instances For
                          def Match.Edge.isModal {H : History} {X : Sequent} {bt : BuildTree H X} {m n : Match bt} :
                          m.Edge nProp

                          This edge between matches is a modal step. To even say this BuildTree must contain the rule data.

                          Equations
                          Instances For
                            def Match.isOpenLeaf {H : History} {X : Sequent} {bt : BuildTree H X} {m : Match bt} :
                            Equations
                            Instances For
                              def Match.isFreeRepeat {H : History} {X : Sequent} {bt : BuildTree H X} (m : Match bt) :
                              Equations
                              Instances For
                                theorem Match.isOpenLeaf_no_edge {H : History} {X : Sequent} {bt : BuildTree H X} (m : Match bt) (h : isOpenLeaf) (n : Match bt) :

                                If m ends at an open leaf, then it cannot have an edge to any n.

                                def Match.rewind {H : History} {X : Sequent} {bt : BuildTree H X} (m : Match bt) (k : Fin (m.length + 1)) :

                                Rewind a Match, i.e. go back up inside bt by k steps. The + 1 is there because going back 0 steps does nothing.

                                Equations
                                Instances For
                                  def BuildTree.getFreeRepeat {H : History} {X : Sequent} {bt : BuildTree H X} (h : bt.isFreeRepeat) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def Match.companionOf {X : Sequent} {bt : BuildTree [] X} (m : Match bt) (h : m.isFreeRepeat) :

                                    Roll back to the companion. Only possibe if we started with H=[] so we know the root.

                                    Equations
                                    Instances For
                                      def Match.companion {X : Sequent} {bt : BuildTree [] X} (m n : Match bt) :

                                      The repeat ♥ companion relation on Match.

                                      Equations
                                      Instances For

                                        Pre-states (Def 6.13) #

                                        As possible worlds for the model graph we want to define maximal paths inside the build tree that do not contain (M) steps.

                                        In the paper pre-states are allowed to be of the form π;π' when π ends at a repeat and π' is a maximal prefix of the path from the companion to that repeat. Here in PreState and PreStateP we only store the π part of such pre-states, because the π' is then uniquely determined by π.

                                        inductive PreStatePart {H : History} {X : Sequent} (bt : BuildTree H X) (m : Match bt) :

                                        A pre-state-part starting at m is any path in bt : BuildTree consisting of non-(M) edges and stopping at a leaf or at an (M) application. (No Match.companion steps here, see note above.)

                                        Instances For
                                          def BuildTree.allPreStateParts {H : History} {X0 : Sequent} (bt : BuildTree H X0) (m : Match bt) :

                                          Collect all PreStatePs from a given m onwards.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            theorem BuildTree.allPreStateParts_spec {H : History} {X : Sequent} {bt : BuildTree H X} {m : Match bt} (π : PreStatePart bt m) :
                                            inductive PreState {H : History} {X : Sequent} (bt : BuildTree H X) :

                                            A pre-state is a maximal pre-state-part, i.e. starting at the root or just after (M).

                                            WORRY: should fromRoot also have a condition about H being empty, i.e. the start of the game?

                                            Instances For
                                              def BuildTree.allPreStates {H : History} {X : Sequent} (bt : BuildTree H X) :

                                              Collect all PreStates for a given BuildTree.

                                              Equations
                                              Instances For
                                                theorem BuildTree.allPreStates_spec {H : History} {X : Sequent} {bt : BuildTree H X} (π : PreState bt) :
                                                def PreState.forms {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} :

                                                Collect formulas in a pre-state. The non-loaded part of Λ(π) in paper.

                                                TODO: If the pre-state ends in a repeat, also include formulas in the path from companion to (M).

                                                QUESTION: Can we collect loaded formulas here by unloading them? Or would that make the loaded case of PreState.pdlFormCase unsayable?

                                                Equations
                                                Instances For
                                                  def PreState.lforms {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} :

                                                  Collect formulas in a pre-state. The loaded part of Λ(π) in paper.

                                                  Equations
                                                  Instances For
                                                    def PreState.last {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} :
                                                    Equations
                                                    Instances For
                                                      theorem PreState.formsCases {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} {φ : Formula} {π : PreState bt} :
                                                      φ π.formsφ.basic = true φ π.last sorry

                                                      TODO Lemma 6.14

                                                      theorem PreState.pdlFormCase {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} {α : Program} {φ : Formula} {δ : List Program} {π : PreState bt} :
                                                      ¬α.isAtomic(~αφ) π.formsH α, .1 [~⌈⌈δ⌉⌉φ] π.forms

                                                      WIP Lemma 6.15 (unloaded case only)

                                                      theorem PreState.locConsSatBas {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} (π : PreState bt) :

                                                      WIP Lemma 6.16: pre-states are saturated and locally consistent, their last node is basic.

                                                      def BuildTree.toModel {H : History} {X : Sequent} (bt : BuildTree H X) :

                                                      Definition 6.17 to get model graph from strategy tree.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For
                                                        theorem PreState.diamondExistence {a✝ : History} {a✝¹ : Sequent} {bt : BuildTree a✝ a✝¹} {α : Program} {φ : AnyFormula} {π : PreState bt} :
                                                        (~'αφ) π.lforms∃ (t : Match bt), AnyNegFormula.mem_Sequent t.btAt.snd.fst (~''φ) ∃ (ρ : PreState bt) (u : Match bt), Modelgraphs.Q sorry α π.forms.toFinset, ρ.forms.toFinset,

                                                        WIP Lemma 6.18

                                                        QUESTION: which R can we use here in order to use Modelgraphs.Q?

                                                        Model graph of pre-states #

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

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