Documentation

LeanPool.PDL.Local.AllLocalTab

Generating all Local Tableaux #

We show that for any X the type LocalTableau is finite.

This is needed to define BuildTree as a finite tree.

Helpers about Finset.pdlSort #

theorem PDL.pdlSort_eq_pair {X : Finset Formula} {a b : Formula} (h : X.pdlSort = [a, b]) :
X = {a, b}

A sublist of the sorted version of L gives a subset of L.

theorem PDL.exists_sublist_pdlSort_of_subset {L Lcond : Finset Formula} (h : Lcond ⊆ L) :
∃ l ∈ L.pdlSort.sublists, l.toFinset = Lcond

Any subset of L arises from a sublist of the sorted version of L.

theorem PDL.Olf.subset_self (o : Olf) :
o ⊆ o
theorem PDL.Formula.ne_neg (φ : Formula) :
φ ≠ φ.neg
theorem PDL.pair_neg_cases {φ a b : Formula} (h : {φ, φ.neg} = {a, b}) (hab : a ≠ b) :
a = φ ∧ b = φ.neg ∨ a = φ.neg ∧ b = φ

If {φ, ~φ} = {a, b} with a ≠ b then the pair is one of the two obvious ones.

All one-sided local rules #

def PDL.osrCast {L L' : Finset Formula} {B : Finset (Finset Formula)} (h : L = L') (r : OneSidedLocalRule L' B) :

Transport a OneSidedLocalRule along an equality of preconditions.

Equations
Instances For
    @[simp]
    theorem PDL.osrCast_self {L : Finset Formula} {B : Finset (Finset Formula)} (h : L = L) (r : OneSidedLocalRule L B) :
    osrCast h r = r

    Given the sorted list of the formulas in L, is there a OneSidedLocalRule for L? The pair case comes first so that the equations below hold by rfl.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      theorem PDL.OneSidedLocalRule.ofSorted_pair {L : Finset Formula} {a b : Formula} (h : L.pdlSort = [a, b]) :
      ofSorted L [a, b] h = if hb : b = a.neg then some ⟨∅, osrCast ⋯ (not a)⟩ else if ha : a = b.neg then some ⟨∅, osrCast ⋯ (not b)⟩ else none
      theorem PDL.OneSidedLocalRule.ofSorted_con {L : Finset Formula} {φ ψ : Formula} (h : L.pdlSort = [φ.and ψ]) :
      ofSorted L [φ.and ψ] h = some ⟨{{φ, ψ}}, osrCast ⋯ (con φ ψ)⟩
      theorem PDL.OneSidedLocalRule.ofSorted_nCo {L : Finset Formula} {φ ψ : Formula} (h : L.pdlSort = [(φ.and ψ).neg]) :
      ofSorted L [(φ.and ψ).neg] h = some ⟨{{φ.neg}, {ψ.neg}}, osrCast ⋯ (nCo φ ψ)⟩
      theorem PDL.OneSidedLocalRule.ofSorted_box {L : Finset Formula} {α : Program} {φ : Formula} (h : L.pdlSort = [Formula.box α φ]) :
      ofSorted L [Formula.box α φ] h = if notAtm : ¬α.isAtomic then some ⟨(unfoldBox α φ).pdlToFinFin, osrCast ⋯ (box α φ notAtm)⟩ else none
      theorem PDL.OneSidedLocalRule.ofSorted_dia {L : Finset Formula} {α : Program} {φ : Formula} (h : L.pdlSort = [(Formula.box α φ).neg]) :
      ofSorted L [(Formula.box α φ).neg] h = if notAtm : ¬α.isAtomic then some ⟨(unfoldDiamond α φ).pdlToFinFin, osrCast ⋯ (dia α φ notAtm)⟩ else none

      Is there a OneSidedLocalRule applicable to L?

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

        All load rules #

        Given a negated loaded formula, is there a LoadRule applicable to it?

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

          All local rules #

          def PDL.lrCast {c c' : Sequent} {ress : Finset Sequent} (h : c = c') (r : LocalRule c' ress) :
          LocalRule c ress

          Transport a LocalRule along an equality of the conditions.

          Equations
          Instances For
            @[simp]
            theorem PDL.lrCast_self {c : Sequent} {ress : Finset Sequent} (h : c = c) (r : LocalRule c ress) :
            lrCast h r = r
            def PDL.LocalRule.negPairOf (L R : Finset Formula) (lL lR : List Formula) :
            L.pdlSort = lL → R.pdlSort = lR → Option ((ress : Finset Sequent) × LocalRule (L, R, none) ress)

            Helper for LocalRule.all, dealing with the two closing rules LRnegL and LRnegR.

            Equations
            • One or more equations did not get rendered due to their size.
            Instances For
              theorem PDL.LocalRule.negPairOf_singletons {L R : Finset Formula} {φ1 φ2 : Formula} (hL : L.pdlSort = [φ1]) (hR : R.pdlSort = [φ2]) :
              negPairOf L R [φ1] [φ2] hL hR = if h : φ2 = φ1.neg then some ⟨∅, lrCast ⋯ (LRnegL φ1)⟩ else if h : φ1 = φ2.neg then some ⟨∅, lrCast ⋯ (LRnegR φ2)⟩ else none
              def PDL.LocalRule.all (cond : Sequent) :
              Option ((ress : Finset Sequent) × LocalRule cond ress)

              Given a subsequent cond to be replaced, is there an applicable local rule? Note that cond are only the principal formulas, not the whole sequent.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                theorem PDL.LocalRule.all_none (L R : Finset Formula) :
                all (L, R, none) = if hR : R = ∅ then Option.map (fun (x : (B : Finset (Finset Formula)) × OneSidedLocalRule L B) => match x with | ⟨fst, orule⟩ => ⟨Finset.image (fun (res : Finset Formula) => (res, ∅, none)) fst, lrCast ⋯ (oneSidedL orule ⋯)⟩) (OneSidedLocalRule.all L) else if hL : L = ∅ then Option.map (fun (x : (B : Finset (Finset Formula)) × OneSidedLocalRule R B) => match x with | ⟨fst, orule⟩ => ⟨Finset.image (fun (res : Finset Formula) => (∅, res, none)) fst, lrCast ⋯ (oneSidedR orule ⋯)⟩) (OneSidedLocalRule.all R) else negPairOf L R L.pdlSort R.pdlSort ⋯ ⋯
                theorem PDL.LocalRule.all_inl_loaded (L R : Finset Formula) (α : Program) (χ : LoadFormula) :
                all (L, R, some (Sum.inl (NegLoadFormula.neg (LoadFormula.box α (AnyFormula.loaded χ))))) = if hL : L = ∅ then if hR : R = ∅ then if notAtm : ¬α.isAtomic then some ⟨Finset.image (fun (x : Finset Formula × Option NegLoadFormula) => match x with | (X, o) => (X, ∅, Option.map Sum.inl o)) (unfoldDiamondLoaded α χ).pdlToFinFinOpt, lrCast ⋯ (loadedL (LoadFormula.box α (AnyFormula.loaded χ)) (LoadRule.dia notAtm) ⋯)⟩ else none else none else none
                theorem PDL.LocalRule.all_inl_normal (L R : Finset Formula) (α : Program) (φ : Formula) :
                all (L, R, some (Sum.inl (NegLoadFormula.neg (LoadFormula.box α (AnyFormula.normal φ))))) = if hL : L = ∅ then if hR : R = ∅ then if notAtm : ¬α.isAtomic then some ⟨Finset.image (fun (x : Finset Formula × Option NegLoadFormula) => match x with | (X, o) => (X, ∅, Option.map Sum.inl o)) (unfoldDiamondLoaded' α φ).pdlToFinFinOpt, lrCast ⋯ (loadedL (LoadFormula.box α (AnyFormula.normal φ)) (LoadRule.dia' notAtm) ⋯)⟩ else none else none else none
                theorem PDL.LocalRule.all_inr_loaded (L R : Finset Formula) (α : Program) (χ : LoadFormula) :
                all (L, R, some (Sum.inr (NegLoadFormula.neg (LoadFormula.box α (AnyFormula.loaded χ))))) = if hL : L = ∅ then if hR : R = ∅ then if notAtm : ¬α.isAtomic then some ⟨Finset.image (fun (x : Finset Formula × Option NegLoadFormula) => match x with | (X, o) => (∅, X, Option.map Sum.inr o)) (unfoldDiamondLoaded α χ).pdlToFinFinOpt, lrCast ⋯ (loadedR (LoadFormula.box α (AnyFormula.loaded χ)) (LoadRule.dia notAtm) ⋯)⟩ else none else none else none
                theorem PDL.LocalRule.all_inr_normal (L R : Finset Formula) (α : Program) (φ : Formula) :
                all (L, R, some (Sum.inr (NegLoadFormula.neg (LoadFormula.box α (AnyFormula.normal φ))))) = if hL : L = ∅ then if hR : R = ∅ then if notAtm : ¬α.isAtomic then some ⟨Finset.image (fun (x : Finset Formula × Option NegLoadFormula) => match x with | (X, o) => (∅, X, Option.map Sum.inr o)) (unfoldDiamondLoaded' α φ).pdlToFinFinOpt, lrCast ⋯ (loadedR (LoadFormula.box α (AnyFormula.normal φ)) (LoadRule.dia' notAtm) ⋯)⟩ else none else none else none
                theorem PDL.LocalRule.negPairOf_eq {L R : Finset Formula} {lL lR : List Formula} (hL : L.pdlSort = lL) (hR : R.pdlSort = lR) :
                negPairOf L R L.pdlSort R.pdlSort ⋯ ⋯ = negPairOf L R lL lR hL hR
                theorem PDL.LocalRule.all_spec {L : Sequent} {B : Finset Sequent} (lr : LocalRule L B) :
                ⟨B, lr⟩ ∈ all L
                @[instance_reducible]
                instance PDL.LocalRule.fintype {X : Sequent} {ress : Finset Sequent} :
                Equations

                All local rule applications #

                Given a sequent, return a list of all possible local rule applications.

                Equations
                • One or more equations did not get rendered due to their size.
                Instances For
                  theorem PDL.LocalRuleApp.all_X (X : Sequent) (lra : LocalRuleApp) :
                  lra ∈ all X → lra.X = X

                  Termination measure for local tableaux #

                  The formula-length measure of the optional loading.

                  Equations
                  Instances For

                    Local measure of a sequent: the sum of lmOfFormula over all three components.

                    Equations
                    Instances For

                      Local measure of an optional negated loaded formula.

                      Equations
                      Instances For

                        Helpers to show that local rules decrease the measure #

                        theorem PDL.lm_sum_union_le (A B : Finset Formula) :
                        ∑ φ ∈ A ∪ B, lmOfFormula φ ≤ ∑ φ ∈ A, lmOfFormula φ + ∑ φ ∈ B, lmOfFormula φ

                        The measure sum over a union is at most the sum of the measure sums.

                        theorem PDL.lm_sum_Dset_le_tests {α : Program} {F : List Formula} {δ : List Program} (in_D : (F, δ) ∈ Dset α) :
                        ∑ ψ ∈ F.toFinset, lmOfFormula ψ ≤ (List.map (fun (τ : { x : Formula // x ∈ testsOfProgram α }) => lmOfFormula ↑τ) (testsOfProgram α).attach).sum

                        For (F,δ) ∈ Dset α the measure sum over F is at most the test measure of α.

                        theorem PDL.lm_dia_eq {α : Program} {φ : Formula} (h : ¬α.isAtomic) :

                        Unfolding the measure of a diamond with a non-atomic program.

                        theorem PDL.OneSidedLocalRule.decreases_lm {precond : Finset Formula} {ress : Finset (Finset Formula)} (orule : OneSidedLocalRule precond ress) (res : Finset Formula) :
                        res ∈ ress → ∑ φ ∈ res, lmOfFormula φ < ∑ φ ∈ precond, lmOfFormula φ

                        One-sided local rules strictly decrease the measure sum.

                        Loaded rules strictly decrease the measure: the new formulas together with the new loaded formula have a smaller measure than the old loaded formula.

                        Generating all local tableaux #

                        def PDL.combo {α : Type} [DecidableEq α] {q : α → Type} {L : List α} (f : (x : α) → x ∈ L → List (q x)) :
                        List ((x : α) → x ∈ L → q x)

                        Convert a function returning lists into a list of functions. Helper for LocalTableau.all.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        • PDL.combo x_2 = [fun (x : α) (x_in : x ∈ []) => ⋯.elim]
                        Instances For
                          theorem PDL.combo_mem_of_forall_in {α : Type} [DecidableEq α] {q : α → Type} {L : List α} (f : (x : α) → x ∈ L → List (q x)) (g : (x : α) → x ∈ L → q x) :
                          (∀ (x : α) (x_in : x ∈ L), g x x_in ∈ f x x_in) → g ∈ combo f

                          Characterization of members of combo result. Could be strengthened to ↔ later.

                          def PDL.comboF {q : Sequent → Type} (s : Finset Sequent) (f : (x : Sequent) → x ∈ s → List (q x)) :
                          List ((x : Sequent) → x ∈ s → q x)

                          Version of combo for Finsets.

                          Equations
                          Instances For
                            theorem PDL.comboF_mem_of_forall_in {q : Sequent → Type} {s : Finset Sequent} (f : (x : Sequent) → x ∈ s → List (q x)) (g : (x : Sequent) → x ∈ s → q x) (h : ∀ (x : Sequent) (x_in : x ∈ s), g x x_in ∈ f x x_in) :
                            g ∈ comboF s f
                            @[irreducible]

                            Enumerate all local tableaux rooted at a sequent.

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

                              Generating all Open Local Tableaux #

                              Enumerate all local tableaux with at least one end node.

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