Documentation

InfinitaryLogic.Lomega1omega.Operations

Operations on Lω₁ω Formulas #

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

Main Definitions #

Implementation Notes #

These are the ω-facing operations, defined over BoundedFormulaInf ℕ. An operation that makes sense at an arbitrary branching carrier belongs upstream on BoundedFormulaInf; IndexCoding handles transport between carriers.

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 n → M) :
    (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 n → M) :
    (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 n → M) :
    (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ω.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 n → M) :
        (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 n → M) :
        (φ.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.

        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.

        Composing relabel insertLastBound and relabel finSumFinEquiv.symm at the formula level.

        relabel (fun i => finSumFinEquiv.symm i) at k = 0 is the identity, since finSumFinEquiv.symm : Fin n → Fin n ⊕ Fin 0 maps everything to Sum.inl.

        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 n → M) :
          (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.

            Closed-term substitution #

            Substituting a closed term into a term with no real variables reduces to the plain relabel. Shared by the maximal-consistency term model and the proof-theoretic consistency family; it lives here so that neither needs to import the other.

            @[simp]
            theorem FirstOrder.Language.BoundedFormula.realize_toLω {L : Language} {α : Type u'} {n : ℕ} {M : Type u_1} [L.Structure M] {v : α → M} {xs : Fin n → M} (φ : 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]