Documentation

InfinitaryLogic.Lomega1omega.Operations

Operations on Lω₁ω Formulas #

This file defines operations on Lω₁ω formulas including relabeling, casting, and substitution.

Main Definitions #

Implementation Notes #

The operations here closely mirror those in Linf/Operations.lean. See that file's implementation notes for discussion of the duplication.

Maps the last variable of Fin (n+1) to a bound variable position, keeping the first n as free variables. Used for quantifying over the last position.

This function is used by openBounds (for the all case) and by existsLastVar/forallLastVar in Scott/Formula.lean.

Equations
Instances For
    theorem FirstOrder.Language.BoundedFormulaω.castLE_refl {L : Language} {α : Type u'} {n : } (φ : L.BoundedFormulaω α n) :
    castLE φ = φ

    castLE (le_refl n) is the identity on formulas.

    theorem FirstOrder.Language.BoundedFormulaω.realize_castLE_of_eq {L : Language} {α : Type u'} {M : Type u_1} [L.Structure M] {m n : } (φ : L.BoundedFormulaω α m) (h : m n) (heq : m = n) (v : αM) (xs : Fin nM) :
    (castLE h φ).Realize v xs φ.Realize v (xs Fin.cast heq)

    castLE over a proof of m ≤ m preserves semantics. This is more general than matching on le_refl directly, as it works for any proof h : m ≤ m regardless of how it was constructed.

    theorem FirstOrder.Language.BoundedFormulaω.realize_castLE_refl {L : Language} {α : Type u'} {M : Type u_1} [L.Structure M] {n : } (φ : L.BoundedFormulaω α n) (v : αM) (xs : Fin nM) :
    (castLE φ).Realize v xs φ.Realize v xs

    castLE (le_refl n) preserves semantics.

    theorem FirstOrder.Language.BoundedFormulaω.realize_castLE_self {L : Language} {α : Type u'} {M : Type u_1} [L.Structure M] {n : } (φ : L.BoundedFormulaω α n) (h : n n) (v : αM) (xs : Fin nM) :
    (castLE h φ).Realize v xs φ.Realize v xs

    castLE over any proof h : n ≤ n preserves semantics. This handles the case where the proof term is not definitionally le_refl (e.g., constructed via rewriting or other means).

    def FirstOrder.Language.BoundedFormulaω.relabelAux {α β : Type u'} {n : } (g : αβ Fin n) (k : ) :
    α Fin kβ Fin (n + k)

    A function to help relabel the variables in bounded formulas.

    Equations
    Instances For
      theorem FirstOrder.Language.BoundedFormulaω.realize_relabel_sumInr {L : Language} {M : Type u_1} [L.Structure M] {n k : } (φ : L.BoundedFormulaω (Fin n) k) (xs : Fin (n + k)M) :

      Realize commutes with relabel Sum.inr: relabeling free variables Fin n into bound positions via Sum.inr shifts them into the first n bound variable slots.

      For φ : L.BoundedFormulaω (Fin n) k:

      • The relabeled formula φ.relabel Sum.inr has type L.BoundedFormulaω Empty (n + k)
      • Realizing with Empty.elim and xs : Fin (n + k) → M is equivalent to realizing the original formula with xs ∘ Fin.castAdd k for free variables and xs ∘ Fin.natAdd n for bound variables.

      Specialization of realize_relabel_sumInr for formulas (k = 0 bound variables).

      For φ : L.Formulaω (Fin n) (a formula with n free variables and 0 bound variables):

      • φ.relabel Sum.inr : L.BoundedFormulaω Empty n has 0 free vars and n bound vars
      • Realizing the relabeled formula with bound assignment xs : Fin n → M is equivalent to realizing the original formula with free variable assignment xs.
      def FirstOrder.Language.BoundedFormulaω.subst {L : Language} {α β : Type u'} {n : } :
      L.BoundedFormulaω α n(αL.Term β)L.BoundedFormulaω β n

      Substitutes the free variables in a bounded formula with terms.

      Equations
      Instances For
        def FirstOrder.Language.BoundedFormulaω.mapFreeVars {L : Language} {α β : Type u'} (f : αβ) {n : } :

        Renames free variables in a bounded formula using a function f : α → β.

        Unlike relabel, which can move free variables into bound positions, mapFreeVars simply renames free variables while preserving the bound variable structure.

        Equations
        Instances For
          theorem FirstOrder.Language.BoundedFormulaω.realize_mapFreeVars {L : Language} {α β : Type u'} {n : } {M : Type u_2} [L.Structure M] (f : αβ) (φ : L.BoundedFormulaω α n) (v : βM) (xs : Fin nM) :
          (mapFreeVars f φ).Realize v xs φ.Realize (v f) xs

          Realization commutes with free variable renaming.

          @[simp]
          theorem FirstOrder.Language.BoundedFormulaω.realize_subst {L : Language} {α β : Type u'} {n : } {M : Type u_2} [L.Structure M] (tf : αL.Term β) (φ : L.BoundedFormulaω α n) (v : βM) (xs : Fin nM) :
          (φ.subst tf).Realize v xs φ.Realize (fun (a : α) => Term.realize v (tf a)) xs

          Realization commutes with free variable substitution.

          This is the Lω₁ω analogue of Mathlib's BoundedFormula.realize_subst.

          Convert a BoundedFormulaω Empty n to a Formulaω (Fin n) by reinterpreting bound variables as free variables. Since there are no free variables (Empty), the bound variables Fin n become the only variables, now treated as free.

          For the all case, the last free variable is re-bound using relabel with insertLastBound.

          Equations
          Instances For

            Bridge: openBounds ∘ relabel Sum.inr roundtrip #

            theorem FirstOrder.Language.BoundedFormulaω.castLE_self {L : Language} {α : Type u'} {n : } (φ : L.BoundedFormulaω α n) (h : n n) :
            castLE h φ = φ

            castLE h φ = φ for any proof h : n ≤ n, not just le_refl.

            theorem FirstOrder.Language.BoundedFormulaω.castLE_eq_cast {L : Language} {α : Type u'} {n m : } (φ : L.BoundedFormulaω α m) (h : m n) (heq : m = n) :
            castLE h φ = heq φ

            castLE with a proof of m = n is transport.

            insertLastBound is the inverse of finSumFinEquiv restricted to splitting the last element of Fin (n+1) into Fin n ⊕ Fin 1.

            Roundtrip: openBounds after relabel Sum.inr is the identity on Formulaω (Fin n).

            This bridges between the two representations of a formula with one free variable: BoundedFormulaω Empty 1 (free variable as bound) and Formulaω (Fin 1) (free variable as free). Used to connect the proof system's all_elim with ConsistencyPropertyEq's C7.

            Language Maps #

            Lifts a bounded Lω₁ω formula along a language homomorphism L →ᴸ L'.

            This maps function and relation symbols in the formula using the language homomorphism, while preserving the variable structure. It is the Lω₁ω analogue of Mathlib's LHom.onBoundedFormula.

            Equations
            Instances For
              theorem FirstOrder.Language.BoundedFormulaω.realize_mapLanguage {L : Language} {α : Type u'} {n : } {L' : Language} (g : L →ᴸ L') {M : Type u_2} [L.Structure M] [L'.Structure M] [g.IsExpansionOn M] (φ : L.BoundedFormulaω α n) (v : αM) (xs : Fin nM) :
              (mapLanguage g φ).Realize v xs φ.Realize v xs

              Realization of a formula is preserved by language homomorphisms that are expansions.

              If g : L →ᴸ L' is an expansion on M (i.e., g maps symbols to the corresponding symbols in M's L'-structure), then (φ.mapLanguage g).Realize v xs ↔ φ.Realize v xs where the left side uses the L'-structure and the right side uses the L-structure.

              @[simp]
              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_not {L : Language} {α : Type u'} {n : } {L' : Language} (g : L →ᴸ L') (φ : L.BoundedFormulaω α n) :

              mapLanguage commutes with not.

              @[simp]
              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_imp {L : Language} {α : Type u'} {n : } {L' : Language} (g : L →ᴸ L') (φ ψ : L.BoundedFormulaω α n) :
              mapLanguage g (φ.imp ψ) = (mapLanguage g φ).imp (mapLanguage g ψ)

              mapLanguage commutes with imp.

              @[simp]
              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_ex {L : Language} {α : Type u'} {n : } {L' : Language} (g : L →ᴸ L') (φ : L.BoundedFormulaω α (n + 1)) :

              mapLanguage commutes with ex.

              theorem FirstOrder.Language.BoundedFormulaω.LHom.onTerm_relabel {L L' : Language} (g : L →ᴸ L') {γ : Type u_2} {δ : Type u_3} (f : γδ) (t : L.Term γ) :

              LHom.onTerm commutes with Term.relabel.

              theorem FirstOrder.Language.BoundedFormulaω.LHom.onTerm_subst {L L' : Language} (g : L →ᴸ L') {γ : Type u_2} {δ : Type u_3} (tf : γL.Term δ) (t : L.Term γ) :
              g.onTerm (t.subst tf) = (g.onTerm t).subst fun (a : γ) => g.onTerm (tf a)

              LHom.onTerm commutes with Term.subst.

              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_castLE {L : Language} {α : Type u'} {n m : } {L' : Language} (g : L →ᴸ L') (h : m n) (φ : L.BoundedFormulaω α m) :

              mapLanguage commutes with castLE.

              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_relabel {L : Language} {α : Type u'} {n m : } {L' : Language} (g : L →ᴸ L') {γ : Type u'} (f : αγ Fin n) (φ : L.BoundedFormulaω α m) :

              mapLanguage commutes with relabel.

              theorem FirstOrder.Language.BoundedFormulaω.mapLanguage_subst {L : Language} {α β : Type u'} {n : } {L' : Language} (g : L →ᴸ L') (tf : αL.Term β) (φ : L.BoundedFormulaω α n) :
              mapLanguage g (φ.subst tf) = (mapLanguage g φ).subst fun (a : α) => g.onTerm (tf a)

              mapLanguage commutes with subst.

              Converts a formula with Fin 0 free variables to a sentence (with Empty free variables).

              Since both Fin 0 and Empty are empty types, this is a purely type-theoretic conversion that does not change the semantics of the formula.

              Equations
              Instances For

                toSentenceω preserves semantics: the sentence realizes in M iff the original formula realizes with the Fin.elim0 assignment.

                @[simp]
                theorem FirstOrder.Language.BoundedFormula.realize_toLω {L : Language} {α : Type u'} {n : } {M : Type u_1} [L.Structure M] {v : αM} {xs : Fin nM} (φ : L.BoundedFormula α n) :
                φ.toLω.Realize v xs φ.Realize v xs
                def FirstOrder.Language.Formula.toLω {L : Language} {α : Type u'} (φ : L.Formula α) :

                Embeds a first-order formula into Lω₁ω.

                Equations
                Instances For
                  @[simp]
                  theorem FirstOrder.Language.Formula.realize_toLω {L : Language} {α : Type u'} {M : Type u_1} [L.Structure M] {v : αM} (φ : L.Formula α) :

                  Embeds a first-order sentence into Lω₁ω.

                  Equations
                  Instances For
                    @[simp]