Documentation

Pdl.BuildTree

From winning strategies to model graphs (Section 6.3) #

Lessons learned while working on this file:

BuildTree #

inductive BuildTree :

Winning Strategy Tree for Builder. At a BuStep it is the turn of Builder and we have a single child for the Move they make. At a PrStep it is the turn of Prover, and we have children for all possible Move.

In the paper "a leaf is either labeled with a sequent to which no rule is applicable, or it is a (free) repeat". Here we make leafs with PrStep because at such a position it is the turn of Prover but there are no moves so Prover loses.

GOAL: The BuildTree type should carry all information we need, so later we should not care about how a specific strategy tree for builder gets made/computer, but just that there is one.

Instances For
    def BuildTree.isLeaf {pos : GamePos} :
    BuildTree posProp
    Equations
    Instances For
      Equations
      Instances For
        @[irreducible]

        Given a winning Builder strategy, compute its BuildTree.

        Equations
        Instances For

          Matches #

          inductive Match {pos : GamePos} :
          BuildTree posType

          Path inside a BuildTree. Analogous to PathIn for Tableau.

          Instances For
            def Match.length {pos : GamePos} {bt : BuildTree pos} :
            Match bt

            Inspired by PathIn.length. Note that this counts all steps, even the prLocTab ones where pos.1 does not get longer.

            Equations
            Instances For
              def Match.btAt {pos : GamePos} {bt : BuildTree pos} :
              Match bt(newPos : GamePos) × BuildTree newPos
              Equations
              Instances For
                def Match.append {a✝ : GamePos} {bt : BuildTree a✝} (m1 : Match bt) (m2 : Match m1.btAt.snd) :
                Equations
                Instances For
                  structure Match.BuEdge {x✝ : GamePos} {bt : BuildTree x✝} (m n : Match bt) :
                  Instances For
                    structure Match.PrEdge {x✝ : GamePos} {bt : BuildTree x✝} (m n : Match bt) :
                    Instances For
                      def Match.Edge {a✝ : GamePos} {bt : BuildTree a✝} (m n : Match bt) :

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

                      Equations
                      Instances For
                        def Match.Edge.isModal {pos : GamePos} {bt : BuildTree pos} {m n : Match bt} :
                        m.Edge nProp

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

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          def Match.isLeaf {pos : GamePos} {bt : BuildTree pos} {m : Match bt} :
                          Equations
                          Instances For
                            theorem Match.isLeaf_no_edge {pos : GamePos} {bt : BuildTree pos} (m : Match bt) (h : isLeaf) (n : Match bt) :

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

                            def Match.toHistory {pos : GamePos} {bt : BuildTree pos} (m : Match bt) :

                            Convert a Match to a History. Inspired by PathIn.toHistory. Does not include the last node. The history of .nil is [] because this will not go into pos.1.

                            Equations
                            Instances For
                              def Match.rewind {a✝ : GamePos} {bt : BuildTree a✝} (m : Match bt) (k : Fin (m.length + 1)) :

                              Rewind a Match, i.e. go back up inside bt by k steps. This used to use Nat but now we take a Fin like in PathIn.rewind, and for that we needed to define Match.length first. IDEA: also use Match.toHistory here?

                              Equations
                              Instances For
                                def rep.toFin {H : History} {X : Sequent} (rp : rep H X) :

                                Given a rep H X, determine the index of the companion in H using List.findIdx?. Note that we do not care about loading here.

                                Equations
                                Instances For
                                  theorem Move.fst_length_succ {newPos : GamePos} {H : History} {X : Sequent} {p : ProverPos H X BuilderPos H X} (mov : Move H, X, p newPos) :

                                  The extra condition that it is the turn of Builder is needed because otherwise the prLocTab case would falsify.

                                  This is NOT TRUE, because history only records different steps and will not count Move.prLocTab steps, though these are steps in the Match.

                                  WAIT, but Match.toHistory DOES count all steps, so the length statement here should be true. ??

                                  ?? are we sure about this one ?? Note that the history from pos needs to be added on the right side.

                                  ?? Or better restrict pos to be a starting position of the game!?!? (Analogous to how many things in TableauPath are only the Hist = [] case.)

                                  def Match.companionOf {pos : GamePos} {bt : BuildTree pos} (m : Match bt) (h : m.btAt.snd.isFreeRepLeaf) :
                                  Equations
                                  Instances For
                                    def Match.companion {a✝ : GamePos} {bt : BuildTree a✝} (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 we only store the π part of such pre-states, because the π' is then uniquely determined by π.

                                      inductive PreStateP {pos : GamePos} (bt : BuildTree pos) (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.)

                                      PROBLEM / QUESTION: do we also need leafs given by empty prMoves???

                                      Instances For
                                        def BuildTree.allPreStatePs {pos : GamePos} (bt : BuildTree pos) (m : Match bt) :

                                        Collect all PreStatePs from a given m onwards.

                                        Equations
                                        Instances For
                                          theorem BuildTree.allPreStatePs_spec {pos : GamePos} {bt : BuildTree pos} {m : Match bt} (π : PreStateP bt m) :
                                          inductive PreState {pos : GamePos} (bt : BuildTree pos) :

                                          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 pos being the start of the game?

                                          Instances For

                                            Collect all PreStates for a given BuildTree.

                                            Equations
                                            Instances For
                                              theorem BuildTree.allPreStates_spec {pos : GamePos} {bt : BuildTree pos} (π : PreState bt) :
                                              def PreState.forms {a✝ : GamePos} {bt : BuildTree 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✝ : GamePos} {bt : BuildTree a✝} :

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

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

                                                    TODO Lemma 6.14

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

                                                    WIP Lemma 6.15 (unloaded case only)

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

                                                    def BuildTree.toModel {Pos : GamePos} (bt : BuildTree Pos) :

                                                    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✝ : GamePos} {bt : BuildTree a✝} {α : Program} {φ : AnyFormula} {π : PreState bt} :
                                                      (~'αφ) π.lforms∃ (t : Match bt), AnyNegFormula.mem_Sequent t.btAt.fst.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.