Documentation

Linglib.Logic.Team.QBSML.Defs

Quantified bilateral state-based modal logic (QBSML) #

QBSML ([AvO23]) is the first-order extension of BSML ([Alo22], [Ant21]). A formula is evaluated bilaterally — supported or anti-supported — at a state: a finite set of indices ⟨w, g⟩ pairing a world with a partial variable assignment. Quantifiers are interpreted by extending states, disjunction by splitting them, and the non-emptiness atom NE — the only source of non-classical behaviour — by state non-emptiness.

Main definitions #

Implementation notes #

Indices #

@[reducible, inline]
abbrev QBSML.Index (W : Type u_4) (Var : Type u_5) (Domain : Type u_6) :
Type (max u_4 u_6 u_5)

An index is a (world, assignment) pair ([AvO23] Definition 4.2: i = ⟨wᵢ, gᵢ⟩), with gᵢ a PartialAssign.

Equations
Instances For
    @[reducible, inline]
    abbrev QBSML.Index.world {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} (i : Index W Var Domain) :
    W

    The world component of an index.

    Equations
    Instances For
      @[reducible, inline]
      abbrev QBSML.Index.assign {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} (i : Index W Var Domain) :
      PartialAssign Var Domain

      The assignment component of an index.

      Equations
      Instances For
        def QBSML.Index.update {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq Var] (i : Index W Var Domain) (x : Var) (d : Domain) :
        Index W Var Domain

        Update an index's assignment ([AvO23] Definitions 4.3–4.4: i[x/d] := ⟨wᵢ, gᵢ[x/d]⟩, with the assignment update gᵢ[x/d] as mathlib's Function.update).

        Equations
        Instances For
          @[simp]
          theorem QBSML.Index.world_update {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq Var] (i : Index W Var Domain) (x : Var) (d : Domain) :
          (i.update x d).world = i.world
          @[simp]
          theorem QBSML.Index.assign_update {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq Var] (i : Index W Var Domain) (x : Var) (d : Domain) :
          (i.update x d).assign = Function.update i.assign x (some d)

          The world projection #

          def QBSML.State.worldProj {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] (s : Finset (Index W Var Domain)) :
          Finset W

          The world projection s↓ of a state of indices: the set of worlds appearing in some index ([AvO23] Definition 4.10: s↓ := {w | ∃g, (w, g) ∈ s}). Frame conditions on accessibility are stated relative to s↓, so QBSML reuses BSML's notions via this projection.

          Equations
          Instances For
            @[simp]
            theorem QBSML.State.mem_worldProj {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] {s : Finset (Index W Var Domain)} {w : W} :
            w worldProj s is, i.world = w
            theorem QBSML.State.worldProj_mono {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] {s t : Finset (Index W Var Domain)} (h : st) :
            theorem QBSML.State.worldProj_nonempty {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] {s : Finset (Index W Var Domain)} (h : s.Nonempty) :
            (worldProj s).Nonempty

            State extensions #

            def QBSML.State.extendIndividual {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (s : Finset (Index W Var Domain)) (x : Var) (d : Domain) :
            Finset (Index W Var Domain)

            Individual extension s[x/d]: assign x to d in every index ([AvO23] Definition 4.5: s[x/d] := {i[x/d] | i ∈ s}).

            Equations
            Instances For
              def QBSML.State.extendUniversal {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (s : Finset (Index W Var Domain)) (x : Var) :
              Finset (Index W Var Domain)

              Universal extension s[x]: extend with every domain value at x ([AvO23] Definition 4.6: s[x] := {i[x/d] | i ∈ s, d ∈ D}). Requires [Fintype Domain] to range over the entire domain.

              Equations
              Instances For
                def QBSML.State.extendFunctional {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (s : Finset (Index W Var Domain)) (x : Var) (h : Index W Var DomainFinset Domain) :
                Finset (Index W Var Domain)

                Functional extension s[x/h]: for each i ∈ s, extend with values drawn from h i ([AvO23] Definition 4.7: s[x/h] := {i[x/d] | i ∈ s, d ∈ h(i)}). Interprets existential quantification: ∃x φ iff M, s[x/h] ⊨ φ for some functional h.

                Equations
                Instances For

                  Membership characterisations #

                  @[simp]
                  theorem QBSML.State.mem_extendIndividual {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] {s : Finset (Index W Var Domain)} {x : Var} {d : Domain} {j : Index W Var Domain} :
                  j extendIndividual s x d is, i.update x d = j
                  @[simp]
                  theorem QBSML.State.mem_extendUniversal {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] {s : Finset (Index W Var Domain)} {x : Var} {j : Index W Var Domain} :
                  j extendUniversal s x ∃ (d : Domain), is, i.update x d = j
                  @[simp]
                  theorem QBSML.State.mem_extendFunctional {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] {s : Finset (Index W Var Domain)} {x : Var} {h : Index W Var DomainFinset Domain} {j : Index W Var Domain} :
                  j extendFunctional s x h is, dh i, i.update x d = j

                  Extension algebra #

                  theorem QBSML.State.extendIndividual_empty {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (x : Var) (d : Domain) :
                  extendIndividual x d =
                  theorem QBSML.State.extendIndividual_union {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (s t : Finset (Index W Var Domain)) (x : Var) (d : Domain) :
                  extendIndividual (s t) x d = extendIndividual s x d extendIndividual t x d
                  theorem QBSML.State.extendIndividual_mono {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] {s t : Finset (Index W Var Domain)} (x : Var) (d : Domain) (hsub : st) :
                  theorem QBSML.State.extendUniversal_empty {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (x : Var) :
                  extendUniversal x =
                  theorem QBSML.State.extendUniversal_union {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (s t : Finset (Index W Var Domain)) (x : Var) :
                  theorem QBSML.State.extendUniversal_mono {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] {s t : Finset (Index W Var Domain)} (x : Var) (hsub : st) :
                  theorem QBSML.State.extendFunctional_empty {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (x : Var) (h : Index W Var DomainFinset Domain) :
                  extendFunctional x h =
                  theorem QBSML.State.extendFunctional_union {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] (s t : Finset (Index W Var Domain)) (x : Var) (h : Index W Var DomainFinset Domain) :
                  extendFunctional (s t) x h = extendFunctional s x h extendFunctional t x h
                  theorem QBSML.State.extendFunctional_mono {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] {s t : Finset (Index W Var Domain)} (x : Var) (h : Index W Var DomainFinset Domain) (hsub : st) :
                  theorem QBSML.State.extendUniversal_eq_extendFunctional {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (s : Finset (Index W Var Domain)) (x : Var) :
                  extendUniversal s x = extendFunctional s x fun (x : Index W Var Domain) => Finset.univ

                  The universal extension is the functional extension with the constant full-domain functional.

                  theorem QBSML.State.extendFunctional_filter_of_update_mem {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] {s t : Finset (Index W Var Domain)} {x : Var} (hpar : jt, is, ∃ (d : Domain), i.update x d = j) :
                  (extendFunctional s x fun (i : Index W Var Domain) => {d : Domain | i.update x d t}) = t

                  Witness reconstruction: a state t consisting of x-updates of indices of s is recovered exactly as the functional extension of s by the functional collecting, at each index, the values whose updates land in t. The shared Finset surgery behind the existential-witness steps of the free-choice facts (Logic/Team/QBSML/FreeChoice.lean).

                  def QBSML.State.modalLift {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] (X : Finset W) (g : PartialAssign Var Domain) :
                  Finset (Index W Var Domain)

                  Modal pairing R(wᵢ)[gᵢ]: pair each accessible world with the assignment of the original index. Used in modal evaluation ([AvO23] Definition 4.9).

                  Equations
                  Instances For
                    @[simp]
                    theorem QBSML.State.mem_modalLift {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] {X : Finset W} {g : PartialAssign Var Domain} {i : Index W Var Domain} :
                    i modalLift X g i.world X i.assign = g
                    @[simp]
                    theorem QBSML.State.modalLift_singleton {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] (w : W) (g : PartialAssign Var Domain) :
                    modalLift {w} g = {(w, g)}
                    @[simp]
                    theorem QBSML.State.worldProj_modalLift {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] (X : Finset W) (g : PartialAssign Var Domain) :
                    theorem QBSML.State.modalLift_worldProj_of_subset {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] {s : Finset (Index W Var Domain)} {X : Finset W} {g : PartialAssign Var Domain} (h : smodalLift X g) :

                    A state contained in a modal pairing is recovered by projecting its worlds and pairing them back with the same assignment: every index of s ⊆ State.modalLift X g carries the assignment g.

                    theorem QBSML.State.worldProj_subset_of_subset_modalLift {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} [DecidableEq W] [Fintype Var] [DecidableEq Domain] {s : Finset (Index W Var Domain)} {X : Finset W} {g : PartialAssign Var Domain} (h : smodalLift X g) :
                    worldProj sX

                    The formula language #

                    inductive QBSML.Formula (Var : Type u_6) (Const : Type u_7) (Pred : Type u_8) :
                    Type (max (max u_6 u_7) u_8)

                    QBSML formula language ([AvO23] Definition 4.1), parameterized over variable type Var, constant type Const, and (monadic) predicate type Pred. The paper's terms t := c | x appear as the two atom constructors. is not primitive — see Formula.nec.

                    • pred {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : PredVarFormula Var Const Pred

                      Monadic predicate applied to a variable.

                    • predc {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : PredConstFormula Var Const Pred

                      Monadic predicate applied to an individual constant.

                    • ne {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : Formula Var Const Pred

                      Non-emptiness atom: state is non-empty.

                    • neg {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : Formula Var Const PredFormula Var Const Pred

                      Bilateral negation: swap support/anti-support.

                    • conj {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : Formula Var Const PredFormula Var Const PredFormula Var Const Pred

                      Conjunction.

                    • disj {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : Formula Var Const PredFormula Var Const PredFormula Var Const Pred

                      Split (tensor) disjunction.

                    • poss {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : Formula Var Const PredFormula Var Const Pred

                      Possibility modal.

                    • exi {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : VarFormula Var Const PredFormula Var Const Pred

                      Existential quantifier.

                    • univ {Var : Type u_6} {Const : Type u_7} {Pred : Type u_8} : VarFormula Var Const PredFormula Var Const Pred

                      Universal quantifier.

                    Instances For
                      def QBSML.instReprFormula.repr {Var✝ : Type u_6} {Const✝ : Type u_7} {Pred✝ : Type u_8} [Repr Var✝] [Repr Const✝] [Repr Pred✝] :
                      Formula Var✝ Const✝ Pred✝Std.Format
                      Equations
                      • One or more equations did not get rendered due to their size.
                      • QBSML.instReprFormula.repr QBSML.Formula.ne prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ 1024 then 1 else 2) (Std.Format.text "QBSML.Formula.ne")).group prec✝
                      Instances For
                        @[instance_reducible]
                        instance QBSML.instReprFormula {Var✝ : Type u_6} {Const✝ : Type u_7} {Pred✝ : Type u_8} [Repr Var✝] [Repr Const✝] [Repr Pred✝] :
                        Repr (Formula Var✝ Const✝ Pred✝)
                        Equations
                        def QBSML.Formula.nec {Var : Type u_2} {Const : Type u_4} {Pred : Type u_5} (φ : Formula Var Const Pred) :
                        Formula Var Const Pred

                        Necessity, derived: □φ := ¬◇¬φ. [AvO23] takes primitive and ◇ := ¬□¬ derived; we invert this, so eval's poss clauses match the paper's derived -clauses and nec matches its primitive .

                        Equations
                        Instances For
                          inductive QBSML.Formula.NEFree {Var : Type u_2} {Const : Type u_4} {Pred : Type u_5} :
                          Formula Var Const PredProp

                          The NE-free fragment: formulas not containing the NE atom. On this fragment QBSML reduces to classical first-order modal logic ([AvO23] analogue of [Ant21] Proposition 2.2.16); see Logic/Team/QBSML/Properties.lean.

                          Instances For
                            theorem QBSML.Formula.NEFree.nec {Var : Type u_2} {Const : Type u_4} {Pred : Type u_5} {φ : Formula Var Const Pred} (h : φ.NEFree) :

                            The derived □φ := ¬◇¬φ preserves NE-freeness.

                            Atom substitution #

                            def QBSML.Formula.mapAtoms {Var : Type u_2} {Const : Type u_4} {Pred : Type u_5} (fp : PredVarFormula Var Const Pred) (fc : PredConstFormula Var Const Pred) :
                            Formula Var Const PredFormula Var Const Pred

                            Substitute a formula for each atom, commuting with every connective and quantifier (and fixing NE). The generic congruence machinery for atom-rewriting operations: an atom map whose images are bilaterally equivalent to the atoms is salva veritate (eval_mapAtoms_iff in Logic/Team/QBSML/Properties.lean), so each such operation — e.g. [Yan23]'s reinterpretation function in Studies/Yan2023.lean — needs only its two atom lemmas.

                            Equations
                            Instances For
                              theorem QBSML.Formula.NEFree.mapAtoms {Var : Type u_2} {Const : Type u_4} {Pred : Type u_5} {fp : PredVarFormula Var Const Pred} {fc : PredConstFormula Var Const Pred} (hfp : ∀ (P : Pred) (x : Var), (fp P x).NEFree) (hfc : ∀ (P : Pred) (c : Const), (fc P c).NEFree) {φ : Formula Var Const Pred} (h : φ.NEFree) :

                              An atom substitution with NE-free images preserves NE-freeness.

                              Models #

                              @[reducible, inline]
                              abbrev QBSML.Model (W : Type u_6) (Domain : Type u_7) (Const : Type u_8) (Pred : Type u_9) :
                              Type (max (max (max u_6 u_7) u_8) u_9)

                              A QBSML model ([AvO23] Definition 4.2: M = ⟨W, D, R, I⟩) is a constant-domain first-order Kripke structure over the monadic signature with constants: accessibility R plus the world-indexed interpretation I, carried as a family of mathlib structures (FirstOrder.Language.ModalStructure) — true by construction, not by bridge.

                              Equations
                              Instances For
                                def QBSML.Model.ofMonadic {W : Type u_6} {Domain : Type u_7} {Const : Type u_8} {Pred : Type u_9} (access : WFinset W) (κ : WConstDomain) (V : WPredDomainProp) :
                                Model W Domain Const Pred

                                The QBSML model with accessibility access, constant interpretation κ, and valuation V.

                                Equations
                                Instances For
                                  @[simp]
                                  theorem QBSML.predInterp_ofMonadic {W : Type u_6} {Domain : Type u_7} {Const : Type u_8} {Pred : Type u_9} (access : WFinset W) (κ : WConstDomain) (V : WPredDomainProp) (P : Pred) (w : W) (d : Domain) :
                                  @[simp]
                                  theorem QBSML.constInterp_ofMonadic {W : Type u_6} {Domain : Type u_7} {Const : Type u_8} {Pred : Type u_9} (access : WFinset W) (κ : WConstDomain) (V : WPredDomainProp) (c : Const) (w : W) :

                                  Bilateral evaluation #

                                  def QBSML.eval {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) :
                                  BoolFormula Var Const PredFinset (Index W Var Domain)Prop

                                  Bilateral evaluation of QBSML formulas ([AvO23] Definition 4.9): eval M true φ s is support (M, s ⊨ φ), eval M false φ s anti-support (M, s ⫤ φ). Negation flips the polarity, making double-negation elimination definitional.

                                  Equations
                                  Instances For
                                    @[reducible, inline]
                                    abbrev QBSML.support {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) (φ : Formula Var Const Pred) (s : Finset (Index W Var Domain)) :

                                    Support: positive evaluation.

                                    Equations
                                    Instances For
                                      @[reducible, inline]
                                      abbrev QBSML.antiSupport {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) (φ : Formula Var Const Pred) (s : Finset (Index W Var Domain)) :

                                      Anti-support: negative evaluation.

                                      Equations
                                      Instances For
                                        @[simp]
                                        theorem QBSML.support_neg {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) (φ : Formula Var Const Pred) (s : Finset (Index W Var Domain)) :
                                        support M φ.neg s antiSupport M φ s
                                        @[simp]
                                        theorem QBSML.antiSupport_neg {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) (φ : Formula Var Const Pred) (s : Finset (Index W Var Domain)) :
                                        antiSupport M φ.neg s support M φ s
                                        theorem QBSML.isBilateral {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [DecidableEq Var] [Fintype Var] [DecidableEq Domain] [Fintype Domain] (M : Model W Domain Const Pred) :

                                        support and antiSupport form a paraconsistent bilateral logic (Bilateral.IsBilateral) under Formula.neg, like BSML's isBilateral at the point type Index W Var Domain.

                                        Frame conditions via the world projection #

                                        def FirstOrder.Language.ModalStructure.IsStateBased {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] (M : QBSML.Model W Domain Const Pred) (s : Finset (QBSML.Index W Var Domain)) :

                                        R is state-based on (M, s): every world in s↓ sees exactly s↓ ([AvO23] Definition 4.10). Defined via Team.IsStateBased applied to State.worldProj s, sharing BSML's frame-condition substrate.

                                        Equations
                                        Instances For
                                          def FirstOrder.Language.ModalStructure.IsIndisputable {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] (M : QBSML.Model W Domain Const Pred) (s : Finset (QBSML.Index W Var Domain)) :

                                          R is indisputable on (M, s): all worlds in s↓ see the same accessible set ([AvO23] Definition 4.10).

                                          Equations
                                          Instances For
                                            @[instance_reducible]
                                            instance QBSML.instDecidableIsStateBasedOfFintype {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [Fintype W] (M : Model W Domain Const Pred) (s : Finset (Index W Var Domain)) :
                                            Equations
                                            @[instance_reducible]
                                            instance QBSML.instDecidableIsIndisputableOfFintype {W : Type u_1} {Var : Type u_2} {Domain : Type u_3} {Const : Type u_4} {Pred : Type u_5} [DecidableEq W] [Fintype W] (M : Model W Domain Const Pred) (s : Finset (Index W Var Domain)) :
                                            Equations