Documentation

LeanPool.Lean4GlCoalgebras.General.Completeness

Prover winning the GL-game builds a GL-proof. #

If Prover has a winning strategy in the game starting from Γ, then there is a proof of Γ, proven in prover_win_builds_proof, all other definitions and proofs in this file are helpers.

Rewinding the history one step to get previous move.

Equations
Instances For

    Rewinding the history one step is still in the cone of the game.

    @[irreducible]
    def Lean4GlCoalgebras.rewindHistory (g : Game.Pos) (n : Fin ((if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1)) :

    Rewinding the history n steps.

    Equations
    Instances For
      theorem Lean4GlCoalgebras.rewind_history_in_cone {Γ : Sequent} (g : Game.Pos) (n : Fin ((if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1)) (strat : Strategy coalgebraGame Prover) (in_cone : inMyCone strat (startPos Γ) g) :

      Rewinding the history n steps is still in the cone of the game.

      This is the type of the coalgebra we will use to build the proof of Γ.

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

        Auxiliary declaration used in the GL coalgebra development.

        Equations
        Instances For
          def Lean4GlCoalgebras.nextNext {Γ Δ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (h : winning strat (startPos Γ)) (nrep : Δ(↑g).2.1) (pos : Δ (builderRuleApp g ).sequents) :
          proof_type Γ strat

          Defines the premise when we do not have a repeat.

          Equations
          Instances For
            theorem Lean4GlCoalgebras.next_next_cor {Γ Δ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (h : winning strat (startPos Γ)) (nrep : Δ(↑g).2.1) (pos : Δ (builderRuleApp g ).sequents) :
            f (builderRuleApp (nextNext g h nrep pos) ) = Δ

            The sequent at the premise defined by nextNext is the sequent Δ which we expect.

            theorem Lean4GlCoalgebras.history_length_in_cone {Γ : Sequent} (strat : Strategy coalgebraGame Prover) (g : Game.Pos) (in_cone : inMyCone strat (startPos Γ) g) :
            (Game.turn g = Proverg.2.1.length = g.2.2.length) (Game.turn g = Builderg.2.1.length = g.2.2.length + 1)

            Comparison of rule app history length and sequent history length.

            def Lean4GlCoalgebras.repPos {Γ Δ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (rep : Δ (↑g).2.1) :

            Defines the premise when we do not have a repeat.

            Equations
            Instances For
              theorem Lean4GlCoalgebras.rewind_turn_one_step {g : Game.Pos} {n : } {h1 : n + 1 < (if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1} {h2 : n < (if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1} :

              Rewinding the game one step changes the player.

              theorem Lean4GlCoalgebras.rewind_turn {g : Game.Pos} {n : Fin ((if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1)} :

              Rewinding an even number of moves is the same players turn, rewinding an odd number is other players turn.

              theorem Lean4GlCoalgebras.f_of_mem_ruleApps {Γ : Sequent} {R : RuleApp} (h : R Γ.ruleApps) :
              f R = Γ

              The sequent at the one step rewind can be found in the history.

              theorem Lean4GlCoalgebras.builder_RuleApp_head_of_in_cone {Γ : Sequent} {g : Game.Pos} (strat : Strategy coalgebraGame Prover) (in_cone : inMyCone strat (startPos Γ) g) (h : Game.turn g = Builder) (h2 : 0 < g.2.1.length) :
              f (builderRuleApp g h) = g.2.1[0]

              The rule application at a builder position in the cone points to the head sequent.

              theorem Lean4GlCoalgebras.rewind_history_correspondence_aux (Γ : Sequent) (info : Sequent RuleApp) (Γs : List Sequent) (Rs : List RuleApp) (strat : Strategy coalgebraGame Prover) (n : ) (h2 : n < Γs.length) (h3 : 2 * n < (if Game.turn (info, Γs, Rs) = Prover then min (2 * (info, Γs, Rs).2.1.length + 1) (2 * (info, Γs, Rs).2.2.length) else min (2 * (info, Γs, Rs).2.1.length) (2 * (info, Γs, Rs).2.2.length + 1)) + 1) (h4 : 2 * n + 1 < (if Game.turn (info, Γs, Rs) = Prover then min (2 * (info, Γs, Rs).2.1.length + 1) (2 * (info, Γs, Rs).2.2.length) else min (2 * (info, Γs, Rs).2.1.length) (2 * (info, Γs, Rs).2.2.length + 1)) + 1) (h6 : n < Γs.length) (in_cone : inMyCone strat (startPos Γ) (info, Γs, Rs)) :
              (∀ (b_turn_g : Game.turn (info, Γs, Rs) = Builder), f (builderRuleApp (rewindHistory (info, Γs, Rs) 2 * n, h3) ) = Γs[n]) ∀ (p_turn_q : Game.turn (info, Γs, Rs) = Prover), f (builderRuleApp (rewindHistory (info, Γs, Rs) 2 * n + 1, h4) ) = Γs[n]

              The sequent at the n step rewind can be found in the history.

              theorem Lean4GlCoalgebras.rewind_history_correspondence (Γ : Sequent) (g : Game.Pos) (strat : Strategy coalgebraGame Prover) (n : ) (h2 : n < g.2.1.length) (h3 : 2 * n < (if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1) (h4 : 2 * n + 1 < (if Game.turn g = Prover then min (2 * g.2.1.length + 1) (2 * g.2.2.length) else min (2 * g.2.1.length) (2 * g.2.2.length + 1)) + 1) (h6 : n < g.2.1.length) (in_cone : inMyCone strat (startPos Γ) g) :
              (∀ (b_turn_g : Game.turn g = Builder), f (builderRuleApp (rewindHistory g 2 * n, h3) ) = g.2.1[n]) ∀ (p_turn_q : Game.turn g = Prover), f (builderRuleApp (rewindHistory g 2 * n + 1, h4) ) = g.2.1[n]

              The sequent at the n step rewind can be found in the history.

              def Lean4GlCoalgebras.repNext (Γ : Sequent) {Δ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (rep : Δ (↑g).2.1) :
              proof_type Γ strat

              Defines the premise when we have a repeat.

              Equations
              Instances For
                theorem Lean4GlCoalgebras.rep_next_cor (Γ : Sequent) {Δ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (rep : Δ (↑g).2.1) :
                f (builderRuleApp (repNext Γ g rep) ) = Δ

                The sequent at the premise defined by repNext is the sequent Δ which we expect.

                def Lean4GlCoalgebras.builderMovePremises {Γ : Sequent} {strat : Strategy coalgebraGame Prover} (g : proof_type Γ strat) (h : winning strat (startPos Γ)) :
                List (proof_type Γ strat)

                Define the list of premises from a Builder move.

                Equations
                Instances For

                  If Prover has a winning strategy in the game starting from Γ, then there is a proof of `Γ!

                  Builder winning the GL-game builds a GL-countermodel. #

                  If Builder has a winning strategy in the game starting from Γ, then there is a proof of Γ, proven in builder_win_builds_model, all other definitions and proofs in this file are helpers.

                  Maximal Paths. #

                  Predicate on moves in the game necessary for quantifying maximal paths.

                  Equations
                  Instances For

                    Predicate on moves in the game necessary for quantifying maximal paths.

                    Equations
                    Instances For

                      Relation on moves in the game necessary for quantifying maximal paths.

                      Equations
                      Instances For

                        The type of a maximal path in the game.

                        Instances For

                          Auxiliary declaration used in the GL coalgebra development.

                          Equations
                          Instances For

                            Auxiliary declaration used in the GL coalgebra development.

                            Equations
                            Instances For

                              Maximal paths always start from a move which is Prover's turn.

                              Maximal paths always end in a move which is Prover's turn.

                              @[irreducible]

                              If Builder is winning, there is always a maximal path.

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

                                If Builder is winning, the List from makePathFrom is nonempty.

                                If Builder is winning, the List from makePathFrom is a chain.

                                If Builder is winning, the List from makePathFrom is maximal.

                                theorem Lean4GlCoalgebras.make_path_is_in_cone (Δ : Sequent) (strat : Strategy coalgebraGame Builder) (g : Game.Pos) (in_cone : inMyCone strat (Sum.inl Δ, [], []) g) (h : winning strat (Sum.inl Δ, [], [])) (i : Fin (makePathFrom strat g).length) :
                                inMyCone strat (Sum.inl Δ, [], []) ((makePathFrom strat g).get i)

                                If Builder is winning, every move in the list from makePathFrom is in the cone.

                                theorem Lean4GlCoalgebras.always_exists_maximal_path_from_root_or_after (Γ : Sequent) (strat : Strategy coalgebraGame Builder) (h : winning strat (startPos Γ)) (g : Game.Pos) (in_cone : inMyCone strat (startPos Γ) g) (head_cases : afterBox g g = startPos Γ) :
                                ∃ (π : MaximalPath Γ strat), π.first = g

                                If Builder is winning, the starting move or any move after a box move has a maximal path.

                                Given a prover move, find the underlying sequent.

                                Equations
                                Instances For

                                  Auxiliary declaration used in the GL coalgebra development.

                                  Equations
                                  Instances For
                                    theorem Lean4GlCoalgebras.first_sequent_eq_of_first {Γ : Sequent} {strat : Strategy coalgebraGame Builder} (π : MaximalPath Γ strat) {Δ : Sequent} {Δs : List Sequent} {Rs : List RuleApp} (hfirst : π.first = (Sum.inl Δ, Δs, Rs)) :

                                    Auxiliary declaration used in the GL coalgebra development.

                                    Equations
                                    Instances For

                                      Two maximal paths are related if two steps in the game can connect tail to head.

                                      Equations
                                      Instances For

                                        The definition of the GL-model (M,R,V) we will use as the countermodel. M, R, V are all defined as expected (except R is transtive), transitivity is immediate, and converse well-foundedness follow from well-foundedness of the game.

                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          theorem Lean4GlCoalgebras.diamond_in_last_of_diamond_in_first {Γ : Sequent} {strat : Strategy coalgebraGame Builder} (h : winning strat (startPos Γ)) (π : MaximalPath Γ strat) (φ : Formula) (i : ) (lt : i < π.list.length) (helper : π.list.length - i - 1 < π.list.length) (ps : Game.turn π.list[π.list.length - i - 1] = Prover) :

                                          Helper for case of builder_win_strong.

                                          theorem Lean4GlCoalgebras.formula_in_successor_of_diamond_formula_in {Γ : Sequent} {strat : Strategy coalgebraGame Builder} (h : winning strat (startPos Γ)) {π ρ : MaximalPath Γ strat} (π_ρ : pathRelation Γ strat π ρ) (φ : Formula) :

                                          Helper for case of builder_win_strong.

                                          theorem Lean4GlCoalgebras.diamond_in_path_of_diamond_formula_in {Γ : Sequent} {strat : Strategy coalgebraGame Builder} (h : winning strat (startPos Γ)) {π ρ : MaximalPath Γ strat} (π_ρ : Relation.TransGen (pathRelation Γ strat) π ρ) (φ : Formula) :

                                          Helper for case of builder_win_strong.

                                          theorem Lean4GlCoalgebras.formula_in_path_of_diamond_formula_in {Γ : Sequent} {strat : Strategy coalgebraGame Builder} (h : winning strat (startPos Γ)) {π ρ : MaximalPath Γ strat} (π_ρ : Relation.TransGen (pathRelation Γ strat) π ρ) (φ : Formula) :

                                          Helper for case of builder_win_strong.

                                          theorem Lean4GlCoalgebras.builder_win_strong {Δ : Sequent} (strat : Strategy coalgebraGame Builder) (h : winning strat (Sum.inl Δ, [], [])) (π : MaximalPath Δ strat) (φ : Formula) (i : ) (lt : i < π.list.length) (helper : π.list.length - i - 1 < π.list.length) (ps : Game.turn π.list[π.list.length - i - 1] = Prover) :
                                          φ proverSequent π.list[π.list.length - i - 1] ps¬evaluate (gameBModel Δ h, π) φ

                                          If Builder has a winning strategy, then for any maximal path π, if φ appears in π then the model gameBModel which we previously defined will falsify φ at π.

                                          If Builder has a winning strategy in the game starting from Γ, then there is a countermodel of `Γ!

                                          Completeness! Comes as a corrolary of gamedet, prover_win_builds_proof, and builder_win_builds_model.