Documentation

LeanPool.MatchingLogic.Core

MatchingLogic.Core #

A one-sorted finitary signature: a set of symbols, each with an arity. Symbols of arity 0 are constants (paper, Section 2).

  • Sym : Type

    The type of operation symbols.

  • arity : self.Sym

    The number of arguments of each operation symbol.

Instances For
    inductive MatchingLogic.Pattern (S : Signature) (Var : Type) :

    Patterns of basic matching logic: no definedness, no set variables, no fixpoints (paper, Section 2). Primitives are implication and .

    Instances For
      @[reducible, inline]
      abbrev MatchingLogic.Pattern.nt {S : Signature} {Var : Type} (φ : Pattern S Var) :
      Pattern S Var

      ¬φ := φ → ⊥

      Equations
      Instances For
        @[reducible, inline]
        abbrev MatchingLogic.Pattern.tp {S : Signature} {Var : Type} :
        Pattern S Var

        ⊤ := ⊥ → ⊥

        Equations
        Instances For
          @[reducible, inline]
          abbrev MatchingLogic.Pattern.or {S : Signature} {Var : Type} (φ ψ : Pattern S Var) :
          Pattern S Var

          φ ∨ ψ := ¬φ → ψ

          Equations
          Instances For
            @[reducible, inline]
            abbrev MatchingLogic.Pattern.and {S : Signature} {Var : Type} (φ ψ : Pattern S Var) :
            Pattern S Var

            φ ∧ ψ := ¬(φ → ¬ψ)

            Equations
            Instances For
              @[reducible, inline]
              abbrev MatchingLogic.Pattern.al {S : Signature} {Var : Type} (x : Var) (φ : Pattern S Var) :
              Pattern S Var

              ∀x.φ := ¬∃x.¬φ

              Equations
              Instances For

                A model: a nonempty carrier together with, for each symbol of arity n, a map Mⁿ → 𝒫(M) (paper, Section 2).

                Instances For
                  def MatchingLogic.Model.app {S : Signature} (M : Model S) (σ : S.Sym) (A : Fin (S.arity σ)Set M.carrier) :

                  The pointwise extension of a symbol to sets: σ_M(A₁,…,Aₙ) = ⋃ {σ_M(a₁,…,aₙ) | aᵢ ∈ Aᵢ}. It is as soon as some Aᵢ is (paper, Section 2).

                  Equations
                  Instances For
                    def MatchingLogic.Model.denote {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) :
                    (VarM.carrier)Pattern S VarSet M.carrier

                    The denotation ρ(φ) ⊆ M (paper, Section 2).

                    Equations
                    Instances For
                      @[simp]
                      theorem MatchingLogic.denote_var {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (x : Var) :
                      M.denote ρ (Pattern.var x) = {ρ x}
                      @[simp]
                      theorem MatchingLogic.denote_bot {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) :
                      @[simp]
                      theorem MatchingLogic.denote_app {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (σ : S.Sym) (f : Fin (S.arity σ)Pattern S Var) :
                      M.denote ρ (Pattern.app σ f) = M.app σ fun (i : Fin (S.arity σ)) => M.denote ρ (f i)
                      @[simp]
                      theorem MatchingLogic.denote_imp {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (φ ψ : Pattern S Var) :
                      M.denote ρ (φ.imp ψ) = (M.denote ρ φ) M.denote ρ ψ
                      @[simp]
                      theorem MatchingLogic.denote_ex {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (x : Var) (φ : Pattern S Var) :
                      M.denote ρ (Pattern.ex x φ) = ⋃ (a : M.carrier), M.denote (Function.update ρ x a) φ

                      Derived clauses (paper, Section 2): these are the positive controls on the definitions above -- if any of them failed, denote would be wrong.

                      theorem MatchingLogic.denote_nt {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (φ : Pattern S Var) :
                      M.denote ρ φ.nt = (M.denote ρ φ)
                      theorem MatchingLogic.denote_tp {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) :
                      theorem MatchingLogic.denote_al {S : Signature} {Var : Type} [DecidableEq Var] (M : Model S) (ρ : VarM.carrier) (x : Var) (φ : Pattern S Var) :
                      M.denote ρ (Pattern.al x φ) = ⋂ (a : M.carrier), M.denote (Function.update ρ x a) φ
                      def MatchingLogic.Model.Step {S : Signature} (M : Model S) (u v : M.carrier) :

                      One backward step: u ⇝ v when u ∈ σ_M(a₁,…,aₙ) for some tuple a with v = a i (paper, Definition 2). Constants contribute no steps, since Fin 0 is empty.

                      Equations
                      Instances For

                        C is backward closed when ⇝[C] ⊆ C (paper, Definition 2).

                        Equations
                        Instances For
                          theorem MatchingLogic.Model.BackwardClosed.mem_of_interp {S : Signature} (M : Model S) {C : Set M.carrier} (hC : M.BackwardClosed C) {σ : S.Sym} {a : Fin (S.arity σ)M.carrier} {u : M.carrier} (hu : u C) (ha : u M.interp σ a) (i : Fin (S.arity σ)) :
                          a i C

                          The concrete form used in the proofs: if a point of C is produced by a tuple, every component of that tuple lies in C (paper, Definition 2, second sentence).