Documentation

Linglib.Semantics.Composition.Reduction

Reduction: the FO fragment of type-driven composition #

Compiles the first-order fragment of [HK98] trees into mathlib FirstOrder.Language.Formulas and proves agreement with the engine: whenever compileFO succeeds, the denotation Tree.interp composes is equivalent to mathlib Realize of the compiled formula over the model — the same triangle Semantics/Dynamic/DRS/Reduction.lean proves for DRT.

Trace indices are the formulas' free-variable type (), so the Heim-Kratzer bind index is the variable name, and assignment update g[n ↦ x] on the engine side is literally Function.update on the realize side. Quantifiers bind exactly one trace, so closure is by the computable singleton binders Formula.all₁ / Formula.ex₁ (mathlib's iAlls/iExs are noncomputable).

Main declarations #

Most (and the other proportional determiners) is deliberately outside the compiled fragment: its first-order undefinability is the planned Barwise-Cooper payoff theorem, and the principled reason compileFO is partial.

The logical vocabulary #

Word forms for the compiled logical vocabulary, parameterizable per fragment/language.

  • every : String
  • some_ : String
  • no : String
  • not_ : String
  • and_ : String
  • or_ : String
Instances For

    The logical vocabulary's lexicon entries: GQ denotations from Quantification, truth-functional connectives from Intensional. The connectives flip arguments so that [t₁ [and t₂]] composes to ⟦t₁⟧ ∧ ⟦t₂⟧.

    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Semantics.Composition.Model.lexiconFO {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) :

      A naming-map lexicon extended with the logical vocabulary. Content words take priority; FOWords.FreshFor rules out collisions.

      Equations
      Instances For
        def Semantics.Composition.FOWords.FreshFor {L : FirstOrder.Language} (fw : FOWords) (nm : LexNaming L) :

        The logical word forms are fresh for the naming maps.

        Equations
        Instances For
          structure Semantics.Composition.LexNaming.Disjoint {L : FirstOrder.Language} (nm : LexNaming L) :

          Each word form names at most one kind of symbol, so the compiler's classification of a word agrees with the lexicon's lookup order.

          • names_of_preds₁ (s : String) (R : L.Relations 1) : nm.preds₁ s = some Rnm.names s = none
          • names_of_preds₂ (s : String) (R : L.Relations 2) : nm.preds₂ s = some Rnm.names s = none
          • preds₁_of_preds₂ (s : String) (R : L.Relations 2) : nm.preds₂ s = some Rnm.preds₁ s = none
          Instances For

            The compiler #

            Recognized (QR'd Heim-Kratzer) shapes: name/trace–verb predication with optional object, sentence negation [not t], sentence coordination [t₁ [and t₂]], and quantified clauses [[Q N] [bind k body]]. Everything else — in particular most — is outside the fragment and compiles to none.

            def Semantics.Composition.compileTerm {L : FirstOrder.Language} (nm : LexNaming L) :
            Syntax.Tree Unit StringOption (L.Term )

            Compile an entity subtree: a proper name or a trace.

            Equations
            Instances For
              def Semantics.Composition.compilePred {L : FirstOrder.Language} (nm : LexNaming L) (τ : L.Term ) :
              Syntax.Tree Unit StringOption (L.Formula )

              Compile a predicate subtree applied to a subject term: an intransitive verb, or a transitive verb with a name/trace object.

              Equations
              Instances For
                def Semantics.Composition.compileFO {L : FirstOrder.Language} (fw : FOWords) (nm : LexNaming L) :
                Syntax.Tree Unit StringOption (L.Formula )

                Compile the FO fragment of a tree to a first-order formula with trace indices as free variables. Partial: none outside the fragment.

                Equations
                Instances For

                  Lookup lemmas #

                  The six logical word forms are pairwise distinct.

                  Equations
                  Instances For
                    theorem Semantics.Composition.Model.lexiconFO_names {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) {s : String} {c : L.Constants} (h : nm.names s = some c) :
                    m.lexiconFO fw nm w s = some { ty := Intensional.Ty.e, denot := m.const c w }
                    theorem Semantics.Composition.Model.lexiconFO_preds₁ {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) {s : String} {R : L.Relations 1} (h : nm.preds₁ s = some R) (h₀ : nm.names s = none) :
                    m.lexiconFO fw nm w s = some { ty := Intensional.Ty.e Intensional.Ty.t, denot := m.pred₁ext R w }
                    theorem Semantics.Composition.Model.lexiconFO_preds₂ {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) {s : String} {R : L.Relations 2} (h : nm.preds₂ s = some R) (h₀ : nm.names s = none) (h₁ : nm.preds₁ s = none) :
                    theorem Semantics.Composition.Model.lexiconFO_fresh {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) {s : String} (h₀ : nm.names s = none) (h₁ : nm.preds₁ s = none) (h₂ : nm.preds₂ s = none) :
                    m.lexiconFO fw nm w s = fw.lexicon m.E m.W s

                    At a word fresh for the naming maps, lookup falls through to the logical vocabulary.

                    theorem Semantics.Composition.FOWords.FreshFor.at {L : FirstOrder.Language} {fw : FOWords} {nm : LexNaming L} (h : fw.FreshFor nm) {s : String} (hs : s [fw.every, fw.some_, fw.no, fw.not_, fw.and_, fw.or_]) :
                    nm.names s = none nm.preds₁ s = none nm.preds₂ s = none

                    Extract the naming-map-freshness triple for a logical word.

                    Realization at a model's world #

                    Model carries structures as terms, so Realize needs the instance fixed per world; realizeAt/termAt package that.

                    def Semantics.Composition.Model.realizeAt {L : FirstOrder.Language} (m : Model L) (w : m.W) (φ : L.Formula ) (g : Core.Assignment m.E) :

                    Realize a formula over the model's structure at world w.

                    Equations
                    Instances For
                      def Semantics.Composition.Model.termAt {L : FirstOrder.Language} (m : Model L) (w : m.W) (τ : L.Term ) (g : Core.Assignment m.E) :
                      m.E

                      Realize a term over the model's structure at world w.

                      Equations
                      • m.termAt w τ g = FirstOrder.Language.Term.realize g τ
                      Instances For
                        theorem Semantics.Composition.Model.termAt_var {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (k : ) :
                        m.termAt w (FirstOrder.Language.var k) g = g k
                        theorem Semantics.Composition.Model.termAt_const {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (c : L.Constants) :
                        m.termAt w c.term g = m.const c w
                        theorem Semantics.Composition.Model.realizeAt_not {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (φ : L.Formula ) :
                        m.realizeAt w φ.not g ¬m.realizeAt w φ g
                        theorem Semantics.Composition.Model.realizeAt_inf {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (φ ψ : L.Formula ) :
                        m.realizeAt w (φψ) g m.realizeAt w φ g m.realizeAt w ψ g
                        theorem Semantics.Composition.Model.realizeAt_sup {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (φ ψ : L.Formula ) :
                        m.realizeAt w (φψ) g m.realizeAt w φ g m.realizeAt w ψ g
                        theorem Semantics.Composition.Model.realizeAt_imp {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (φ ψ : L.Formula ) :
                        m.realizeAt w (φ.imp ψ) g m.realizeAt w φ gm.realizeAt w ψ g
                        theorem Semantics.Composition.Model.realizeAt_all₁ {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (k : ) (φ : L.Formula ) :
                        m.realizeAt w (FirstOrder.Language.Formula.all₁ k φ) g ∀ (x : m.E), m.realizeAt w φ (Function.update g k x)
                        theorem Semantics.Composition.Model.realizeAt_ex₁ {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (k : ) (φ : L.Formula ) :
                        m.realizeAt w (FirstOrder.Language.Formula.ex₁ k φ) g ∃ (x : m.E), m.realizeAt w φ (Function.update g k x)
                        theorem Semantics.Composition.Model.realizeAt_formula₁ {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (R : L.Relations 1) (τ : L.Term ) :
                        m.realizeAt w (R.formula₁ τ) g m.pred₁ext R w (m.termAt w τ g)

                        Atomic agreement, unary: realization of R(τ) is the model-sourced extensional predicate at the term's value.

                        theorem Semantics.Composition.Model.realizeAt_formula₂ {L : FirstOrder.Language} (m : Model L) (w : m.W) (g : Core.Assignment m.E) (R : L.Relations 2) (τ₁ τ₂ : L.Term ) :
                        m.realizeAt w (R.formula₂ τ₁ τ₂) g m.pred₂ext R w (m.termAt w τ₂ g) (m.termAt w τ₁ g)

                        Atomic agreement, binary: realization of R(τ₁, τ₂) is the model-sourced object-first relation at the terms' values (subject first in the vector).

                        Engine reduction helpers (at M = Id) #

                        Agreement #

                        theorem Semantics.Composition.interp_compileTerm {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) (g : Core.Assignment m.E) {t : Syntax.Tree Unit String} {τ : L.Term } :
                        compileTerm nm t = some τTree.interp m.E m.W (m.lexiconFO fw nm w) g t = some { ty := Intensional.Ty.e, val := m.termAt w τ g }

                        Entity-subtree agreement: a compiled term's engine value is its realization over the model.

                        theorem Semantics.Composition.interp_compilePred {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) (hdj : nm.Disjoint) (g : Core.Assignment m.E) {subj : Syntax.Tree Unit String} {τ : L.Term } (hsubj : compileTerm nm subj = some τ) {r : Syntax.Tree Unit String} {φ : L.Formula } :
                        compilePred nm τ r = some φ∀ (c : Unit), Tree.interp m.E m.W (m.lexiconFO fw nm w) g (Syntax.Tree.node c [subj, r]) = some { ty := Intensional.Ty.t, val := m.realizeAt w φ g }

                        Predication agreement: subject term + predicate subtree compose to the compiled atom's realization.

                        theorem Semantics.Composition.interp_compileFO {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) (hnd : fw.Nodup) (hfr : fw.FreshFor nm) (hdj : nm.Disjoint) (t : Syntax.Tree Unit String) {φ : L.Formula } (g : Core.Assignment m.E) :
                        compileFO fw nm t = some φTree.interp m.E m.W (m.lexiconFO fw nm w) g t = some { ty := Intensional.Ty.t, val := m.realizeAt w φ g }

                        The agreement theorem: whenever the compiler succeeds, the engine's composed denotation is the realization of the compiled formula over the model at w — the DRT triangle for type-driven composition.

                        Truth and consequence transfer #

                        def Semantics.Composition.HoldsAt {L : FirstOrder.Language} (m : Model L) (lex : Montague.Lexicon m.E m.W) (g : Core.Assignment m.E) (t : Syntax.Tree Unit String) :

                        Truth of a tree at a model's world under an assignment: it composes to a true truth value.

                        Equations
                        • One or more equations did not get rendered due to their size.
                        Instances For
                          theorem Semantics.Composition.holdsAt_iff_realize {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) (hnd : fw.Nodup) (hfr : fw.FreshFor nm) (hdj : nm.Disjoint) {t : Syntax.Tree Unit String} {φ : L.Formula } (h : compileFO fw nm t = some φ) (g : Core.Assignment m.E) :
                          HoldsAt m (m.lexiconFO fw nm w) g t m.realizeAt w φ g
                          theorem Semantics.Composition.holdsAt_of_models {L : FirstOrder.Language} (m : Model L) (fw : FOWords) (nm : LexNaming L) (w : m.W) (hnd : fw.Nodup) (hfr : fw.FreshFor nm) (hdj : nm.Disjoint) {t₁ t₂ : Syntax.Tree Unit String} {φ₁ φ₂ : L.Formula } (h₁ : compileFO fw nm t₁ = some φ₁) (h₂ : compileFO fw nm t₂ = some φ₂) (hmod : ∀ (M : Type) (S : L.Structure M) (v : M), φ₁.Realize vφ₂.Realize v) (g : Core.Assignment m.E) :
                          HoldsAt m (m.lexiconFO fw nm w) g t₁HoldsAt m (m.lexiconFO fw nm w) g t₂

                          Consequence transfer: first-order consequence between compiled formulas yields cross-model entailment between the trees — for every composition model, world, and assignment.

                          The default logical vocabulary is pairwise distinct.

                          Bridge to mathlib Theory consequence #

                          For universe-0 languages, composition models and mathlib's bundled models coincide: tree entailment over nonempty-domain composition models is first-order consequence over the empty theory, and compactness transfers to families of trees. (ModelType requires nonempty carriers, hence the nonempty-domain restriction — standard in the GQ literature.)

                          def Semantics.Composition.Model.ofStructure {L₀ : FirstOrder.Language} (M : Type) (S : L₀.Structure M) :
                          Model L₀

                          A first-order structure as a one-world composition model.

                          Equations
                          Instances For
                            theorem Semantics.Composition.models_imp_iff_entails {L₀ : FirstOrder.Language} (fw : FOWords) (nm : LexNaming L₀) (hnd : fw.Nodup) (hfr : fw.FreshFor nm) (hdj : nm.Disjoint) {t₁ t₂ : Syntax.Tree Unit String} {φ₁ φ₂ : L₀.Formula } (h₁ : compileFO fw nm t₁ = some φ₁) (h₂ : compileFO fw nm t₂ = some φ₂) :
                            ⊨ᵇ φ₁.imp φ₂ ∀ (m : Model L₀), Nonempty m.E∀ (w : m.W) (g : Core.Assignment m.E), HoldsAt m (m.lexiconFO fw nm w) g t₁HoldsAt m (m.lexiconFO fw nm w) g t₂

                            Tree entailment is first-order consequence: mathlib's ⊨ᵇ over the empty theory coincides with cross-model entailment between compiled trees, over nonempty-domain composition models.

                            Closed trees as sentences, and compactness #

                            theorem Semantics.Composition.holdsAt_compactness {L₀ : FirstOrder.Language} (fw : FOWords) (nm : LexNaming L₀) (hnd : fw.Nodup) (hfr : fw.FreshFor nm) (hdj : nm.Disjoint) {ι : Type} (trees : ιSyntax.Tree Unit String) (φs : ιL₀.Formula ) (hc : ∀ (i : ι), compileFO fw nm (trees i) = some (φs i)) (hcl : ∀ (i : ι), FirstOrder.Language.BoundedFormula.freeVarFinset (φs i) = ) :
                            (∃ (m : Model L₀) (_ : Nonempty m.E) (w : m.W) (g : Core.Assignment m.E), ∀ (i : ι), HoldsAt m (m.lexiconFO fw nm w) g (trees i)) ∀ (s : Finset ι), ∃ (m : Model L₀) (_ : Nonempty m.E) (w : m.W) (g : Core.Assignment m.E), is, HoldsAt m (m.lexiconFO fw nm w) g (trees i)

                            Compactness at the tree level: a family of closed fragment trees is jointly satisfiable in a nonempty-domain composition model iff every finite subfamily is. The nontrivial direction is mathlib's compactness theorem (Theory.isSatisfiable_iff_isFinitelySatisfiable, via ultraproducts).