File: Mathlib/ModelTheory/Encoding.lean

full_name: FirstOrder.Language.Term.listEncode
code: /-- Encodes a term as a list of variables and function symbols. -/
def listEncode : L.Term α → List (α ⊕ (Σi, L.Functions i))
  
goal: L.Term α → List (α ⊕ (i : ℕ) × L.Functions i)

full_name: FirstOrder.Language.Term.listDecode
code: /-- Decodes a list of variables and function symbols as a list of terms. -/
def listDecode : List (α ⊕ (Σi, L.Functions i)) → List (L.Term α)
  
goal: List (α ⊕ (i : ℕ) × L.Functions i) → List (L.Term α)

full_name: FirstOrder.Language.Term.listDecode_encode_list
code: theorem listDecode_encode_list (l : List (L.Term α)) :
    listDecode (l.bind listEncode) = l 
goal: FirstOrder.Language.Term.listDecode (l.bind FirstOrder.Language.Term.listEncode) = l

full_name: FirstOrder.Language.Term.encoding
code: /-- An encoding of terms as lists. -/
@[simps]
protected def encoding : Encoding (L.Term α) 
goal: Computability.Encoding (L.Term α)

full_name: FirstOrder.Language.Term.encoding_Γ
code: /-- An encoding of terms as lists. -/
@[simps]
protected def encoding : Encoding (L.Term α) 
goal: FirstOrder.Language.Term.encoding.Γ = (α ⊕ (i : ℕ) × L.Functions i)

full_name: FirstOrder.Language.Term.encoding_encode
code: /-- An encoding of terms as lists. -/
@[simps]
protected def encoding : Encoding (L.Term α) 
goal: ∀ (a : L.Term α), FirstOrder.Language.Term.encoding.encode a = a.listEncode

full_name: FirstOrder.Language.Term.encoding_decode
code: /-- An encoding of terms as lists. -/
@[simps]
protected def encoding : Encoding (L.Term α) 
goal: FirstOrder.Language.Term.encoding.decode l =
  (do
      let a ← (FirstOrder.Language.Term.listDecode l).head?
      pure (some a)).join

full_name: FirstOrder.Language.Term.listEncode_injective
code: theorem listEncode_injective :
    Function.Injective (listEncode : L.Term α → List (α ⊕ (Σi, L.Functions i))) 
goal: Function.Injective FirstOrder.Language.Term.listEncode

full_name: FirstOrder.Language.Term.card_le
code: theorem card_le : #(L.Term α) ≤ max ℵ₀ #(α ⊕ (Σi, L.Functions i)) 
goal: Cardinal.mk (L.Term α) ≤ max Cardinal.aleph0 (Cardinal.mk (α ⊕ (i : ℕ) × L.Functions i))

full_name: FirstOrder.Language.Term.card_sigma
code: theorem card_sigma : #(Σn, L.Term (α ⊕ (Fin n))) = max ℵ₀ #(α ⊕ (Σi, L.Functions i)) 
goal: Cardinal.mk ((n : ℕ) × L.Term (α ⊕ Fin n)) = max Cardinal.aleph0 (Cardinal.mk (α ⊕ (i : ℕ) × L.Functions i))

full_name: FirstOrder.Language.Term.instEncodableOfSigmaNatFunctions
code: instance [Encodable α] [Encodable (Σi, L.Functions i)] : Encodable (L.Term α) 
goal: Encodable (L.Term α)

full_name: FirstOrder.Language.Term.instCountableOfSigmaNatFunctions
code: instance [h1 : Countable α] [h2 : Countable (Σl, L.Functions l)] : Countable (L.Term α) 
goal: Countable (L.Term α)

full_name: FirstOrder.Language.Term.small
code: instance small [Small.{u} α] : Small.{u} (L.Term α) 
goal: Small.{u, max u u'} (L.Term α)

full_name: FirstOrder.Language.BoundedFormula.listEncode
code: /-- Encodes a bounded formula as a list of symbols. -/
def listEncode : ∀ {n : ℕ},
    L.BoundedFormula α n → List ((Σk, L.Term (α ⊕ Fin k)) ⊕ ((Σn, L.Relations n) ⊕ ℕ))
  
goal: L.BoundedFormula α n → List ((k : ℕ) × L.Term (α ⊕ Fin k) ⊕ (n : ℕ) × L.Relations n ⊕ ℕ)

full_name: FirstOrder.Language.BoundedFormula.sigmaAll
code: /-- Applies the `forall` quantifier to an element of `(Σ n, L.BoundedFormula α n)`,
or returns `default` if not possible. -/
def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
  
goal: (n : ℕ) × L.BoundedFormula α n → (n : ℕ) × L.BoundedFormula α n

full_name: FirstOrder.Language.BoundedFormula.sigmaAll_apply
code: @[simp]
lemma sigmaAll_apply {n} {φ : L.BoundedFormula α (n + 1)} :
    sigmaAll ⟨n + 1, φ⟩ = ⟨n, φ.all⟩ 
goal: FirstOrder.Language.BoundedFormula.sigmaAll ⟨n + 1, φ⟩ = ⟨n, φ.all⟩

full_name: FirstOrder.Language.BoundedFormula.sigmaImp
code: /-- Applies `imp` to two elements of `(Σ n, L.BoundedFormula α n)`,
or returns `default` if not possible. -/
def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
  
goal: (n : ℕ) × L.BoundedFormula α n → (n : ℕ) × L.BoundedFormula α n → (n : ℕ) × L.BoundedFormula α n

full_name: FirstOrder.Language.BoundedFormula.sigmaImp_apply
code: @[simp]
lemma sigmaImp_apply {n} {φ ψ : L.BoundedFormula α n} :
    sigmaImp ⟨n, φ⟩ ⟨n, ψ⟩ = ⟨n, φ.imp ψ⟩ 
goal: FirstOrder.Language.BoundedFormula.sigmaImp ⟨n, φ⟩ ⟨n, ψ⟩ = ⟨n, φ.imp ψ⟩

full_name: FirstOrder.Language.BoundedFormula.listDecode
code: /-- Decodes a list of symbols as a list of formulas. -/
def listDecode :
    List ((Σk, L.Term (α ⊕ Fin k)) ⊕ ((Σn, L.Relations n) ⊕ ℕ)) → List (Σn, L.BoundedFormula α n)
  
goal: List ((k : ℕ) × L.Term (α ⊕ Fin k) ⊕ (n : ℕ) × L.Relations n ⊕ ℕ) → List ((n : ℕ) × L.BoundedFormula α n)

full_name: FirstOrder.Language.BoundedFormula.listDecode_encode_list
code: @[simp]
theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
    listDecode (l.bind (fun φ => φ.2.listEncode)) = l 
goal: FirstOrder.Language.BoundedFormula.listDecode (l.bind fun φ => φ.snd.listEncode) = l

full_name: FirstOrder.Language.BoundedFormula.encoding_Γ
code: /-- An encoding of bounded formulas as lists. -/
@[simps]
protected def encoding : Encoding (Σn, L.BoundedFormula α n) 
goal: FirstOrder.Language.BoundedFormula.encoding.Γ = ((k : ℕ) × L.Term (α ⊕ Fin k) ⊕ (n : ℕ) × L.Relations n ⊕ ℕ)

full_name: FirstOrder.Language.BoundedFormula.encoding_decode
code: /-- An encoding of bounded formulas as lists. -/
@[simps]
protected def encoding : Encoding (Σn, L.BoundedFormula α n) 
goal: FirstOrder.Language.BoundedFormula.encoding.decode l = (FirstOrder.Language.BoundedFormula.listDecode l)[0]?

full_name: FirstOrder.Language.BoundedFormula.encoding_encode
code: /-- An encoding of bounded formulas as lists. -/
@[simps]
protected def encoding : Encoding (Σn, L.BoundedFormula α n) 
goal: FirstOrder.Language.BoundedFormula.encoding.encode φ = φ.snd.listEncode

full_name: FirstOrder.Language.BoundedFormula.encoding
code: /-- An encoding of bounded formulas as lists. -/
@[simps]
protected def encoding : Encoding (Σn, L.BoundedFormula α n) 
goal: Computability.Encoding ((n : ℕ) × L.BoundedFormula α n)

full_name: FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
code: theorem listEncode_sigma_injective :
    Function.Injective fun φ : Σn, L.BoundedFormula α n => φ.2.listEncode 
goal: Function.Injective fun φ => φ.snd.listEncode

full_name: FirstOrder.Language.BoundedFormula.card_le
code: theorem card_le : #(Σn, L.BoundedFormula α n) ≤
    max ℵ₀ (Cardinal.lift.{max u v} #α + Cardinal.lift.{u'} L.card) 
goal: Cardinal.mk ((n : ℕ) × L.BoundedFormula α n) ≤
  max Cardinal.aleph0 (Cardinal.lift.{max u v, u'} (Cardinal.mk α) + Cardinal.lift.{u', max u v} L.card)