Documentation

LeanPool.InfinitaryLogic.Mathlib.ModelTheory.Infinitary.IndexCoding

Index codings #

An IndexCoding ι κ is an injection encode : ι → κ together with a decoder that is a left inverse on encoded values (mirroring Encodable, the codomain- special case). Codings are how an ι-indexed infinitary connective is expressed at a larger carrier κ, and how infinitary formulas are transported between carriers (Infinitary/Reindex.lean).

Main definitions #

structure FirstOrder.IndexCoding (ι : Type uι) (κ : Type uκ) :
Type (max uι uκ)

A coding of the index type ι into κ: an injection encode together with a decoder that is a left inverse on encoded values. Values outside the range of encode may decode to none or to duplicate source branches; the padding semantics only ever relies on decode_encode.

  • encode : ικ

    The injection.

  • decode : κOption ι

    The decoder, a left inverse on encoded values.

  • decode_encode (i : ι) : self.decode (self.encode i) = some i

    Decoding recovers every encoded index.

Instances For
    theorem FirstOrder.IndexCoding.ext {ι : Type uι} {κ : Type uκ} {c₁ c₂ : IndexCoding ι κ} (he : c₁.encode = c₂.encode) (hd : c₁.decode = c₂.decode) :
    c₁ = c₂

    Two codings with the same encode and decode are equal; the coherence proof is irrelevant.

    theorem FirstOrder.IndexCoding.ext_iff {ι : Type uι} {κ : Type uκ} {c₁ c₂ : IndexCoding ι κ} :
    c₁ = c₂ c₁.encode = c₂.encode c₁.decode = c₂.decode

    encode is injective: decode_encode already provides a retraction.

    The identity coding.

    Equations
    Instances For
      def FirstOrder.IndexCoding.trans {ι : Type uι} {κ : Type uκ} {μ : Type uμ} (c₁ : IndexCoding ι κ) (c₂ : IndexCoding κ μ) :

      Forward composition of codings, in the Equiv.trans argument order: first c₁ : ι → κ, then c₂ : κ → μ.

      Equations
      Instances For
        def FirstOrder.IndexCoding.sumInl (ι : Type uι) (κ : Type uκ) :
        IndexCoding ι (ι κ)

        The canonical coding of the left summand into a sum.

        Equations
        Instances For
          def FirstOrder.IndexCoding.sumInr (ι : Type uι) (κ : Type uκ) :
          IndexCoding κ (ι κ)

          The canonical coding of the right summand into a sum.

          Equations
          Instances For

            Explicit-data variant of ofEncodable: build the coding from a given encoding value rather than by instance search. Code that stores a particular Encodable as data (e.g. a coded-family presentation that must not consult ambient instances) uses this, so the compiler enforces that the resulting syntax depends on the stored encoding.

            Equations
            Instances For
              def FirstOrder.IndexCoding.pad {ι : Type uι} {κ : Type uκ} {β : Sort u_1} (c : IndexCoding ι κ) (default : β) (f : ιβ) :
              κβ

              Total extension of a family along a coding: decoded indices select a branch, undecodable ones get the default.

              Equations
              Instances For
                @[simp]
                theorem FirstOrder.IndexCoding.pad_encode {ι : Type uι} {κ : Type uκ} {β : Sort u_1} (c : IndexCoding ι κ) (default : β) (f : ιβ) (i : ι) :
                c.pad default f (c.encode i) = f i
                theorem FirstOrder.IndexCoding.pad_of_decode_none {ι : Type uι} {κ : Type uκ} {β : Sort u_1} (c : IndexCoding ι κ) {default : β} {f : ιβ} {k : κ} (h : c.decode k = none) :
                c.pad default f k = default
                theorem FirstOrder.IndexCoding.pad_of_decode_some {ι : Type uι} {κ : Type uκ} {β : Sort u_1} (c : IndexCoding ι κ) {default : β} {f : ιβ} {k : κ} {i : ι} (h : c.decode k = some i) :
                c.pad default f k = f i