model_theory.encodingMathlib.ModelTheory.Encoding

This file has been ported!

Changes since the initial port

The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -131,7 +131,7 @@ protected def encoding : Encoding (L.term α)
   decode l := (listDecode l).head?.join
   decode_encode t := by
     have h := list_decode_encode_list [t]
-    rw [bind_singleton] at h 
+    rw [bind_singleton] at h
     simp only [h, Option.join, head', List.map, Option.some_bind, id.def]
 #align first_order.language.term.encoding FirstOrder.Language.Term.encoding
 -/
@@ -175,13 +175,13 @@ theorem card_sigma : (#Σ n, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σ
         ⟨⟨Sum.elim (fun i => ⟨0, var (Sum.inl i)⟩) fun F => ⟨1, func F.2 fun _ => var (Sum.inr 0)⟩,
             _⟩⟩
       · rintro (a | a) (b | b) h
-        · simp only [Sum.elim_inl, eq_self_iff_true, heq_iff_eq, true_and_iff] at h 
+        · simp only [Sum.elim_inl, eq_self_iff_true, heq_iff_eq, true_and_iff] at h
           rw [h]
-        · simp only [Sum.elim_inl, Sum.elim_inr, Nat.zero_ne_one, false_and_iff] at h 
+        · simp only [Sum.elim_inl, Sum.elim_inr, Nat.zero_ne_one, false_and_iff] at h
           exact h.elim
-        · simp only [Sum.elim_inr, Sum.elim_inl, Nat.one_ne_zero, false_and_iff] at h 
+        · simp only [Sum.elim_inr, Sum.elim_inl, Nat.one_ne_zero, false_and_iff] at h
           exact h.elim
-        · simp only [Sum.elim_inr, eq_self_iff_true, heq_iff_eq, true_and_iff] at h 
+        · simp only [Sum.elim_inr, eq_self_iff_true, heq_iff_eq, true_and_iff] at h
           rw [Sigma.ext_iff.2 ⟨h.1, h.2.1⟩]
 #align first_order.language.term.card_sigma FirstOrder.Language.Term.card_sigma
 -/
@@ -372,7 +372,7 @@ protected def encoding : Encoding (Σ n, L.BoundedFormula α n)
   decode l := (listDecode l).1
   decode_encode φ := by
     have h := list_decode_encode_list [φ]
-    rw [bind_singleton] at h 
+    rw [bind_singleton] at h
     rw [h]
     rfl
 #align first_order.language.bounded_formula.encoding FirstOrder.Language.BoundedFormula.encoding
Diff
@@ -3,10 +3,10 @@ Copyright (c) 2022 Aaron Anderson. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson
 -/
-import Mathbin.Computability.Encoding
-import Mathbin.Logic.Small.List
-import Mathbin.ModelTheory.Syntax
-import Mathbin.SetTheory.Cardinal.Ordinal
+import Computability.Encoding
+import Logic.Small.List
+import ModelTheory.Syntax
+import SetTheory.Cardinal.Ordinal
 
 #align_import model_theory.encoding from "leanprover-community/mathlib"@"8eb9c42d4d34c77f6ee84ea766ae4070233a973c"
 
Diff
@@ -264,7 +264,7 @@ def listDecode :
       simp only [List.sizeof, ← add_assoc]
       exact le_max_of_le_right le_add_self⟩
   | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l =>
-    ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft).get? i).join.isSome then
+    ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft?).get? i).join.isSome then
         if h' : ∀ i, (Option.get (h i)).1 = k then
           ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get (h i)).2⟩
         else default
@@ -314,7 +314,7 @@ theorem listDecode_encode_list (l : List (Σ n, L.BoundedFormula α n)) :
     · rw [list_encode, cons_append, cons_append, singleton_append, cons_append, list_decode]
       · have h :
           ∀ i : Fin φ_l,
-            ((List.map Sum.getLeft
+            ((List.map Sum.getLeft?
                       (List.map
                           (fun i : Fin φ_l =>
                             Sum.inl
@@ -331,7 +331,7 @@ theorem listDecode_encode_list (l : List (Σ n, L.BoundedFormula α n)) :
           refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
           rw [nth_le_append, nth_le_map]
           ·
-            simp only [Sum.getLeft, nth_le_fin_range, Fin.eta, Function.comp_apply,
+            simp only [Sum.getLeft?, nth_le_fin_range, Fin.eta, Function.comp_apply,
               eq_self_iff_true, heq_iff_eq, and_self_iff]
           · exact lt_of_lt_of_le i.is_lt (ge_of_eq (length_fin_range _))
           · rw [length_map, length_fin_range]
Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Aaron Anderson. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson
-
-! This file was ported from Lean 3 source module model_theory.encoding
-! leanprover-community/mathlib commit 8eb9c42d4d34c77f6ee84ea766ae4070233a973c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Computability.Encoding
 import Mathbin.Logic.Small.List
 import Mathbin.ModelTheory.Syntax
 import Mathbin.SetTheory.Cardinal.Ordinal
 
+#align_import model_theory.encoding from "leanprover-community/mathlib"@"8eb9c42d4d34c77f6ee84ea766ae4070233a973c"
+
 /-! # Encodings and Cardinality of First-Order Syntax
 
 > THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
Diff
@@ -146,10 +146,13 @@ theorem listEncode_injective :
 #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective
 -/
 
+#print FirstOrder.Language.Term.card_le /-
 theorem card_le : (#L.term α) ≤ max ℵ₀ (#Sum α (Σ i, L.Functions i)) :=
   lift_le.1 (trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _)))
 #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
+-/
 
+#print FirstOrder.Language.Term.card_sigma /-
 theorem card_sigma : (#Σ n, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σ i, L.Functions i)) :=
   by
   refine' le_antisymm _ _
@@ -184,6 +187,7 @@ theorem card_sigma : (#Σ n, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σ
         · simp only [Sum.elim_inr, eq_self_iff_true, heq_iff_eq, true_and_iff] at h 
           rw [Sigma.ext_iff.2 ⟨h.1, h.2.1⟩]
 #align first_order.language.term.card_sigma FirstOrder.Language.Term.card_sigma
+-/
 
 instance [Encodable α] [Encodable (Σ i, L.Functions i)] : Encodable (L.term α) :=
   Encodable.ofLeftInjection listEncode (fun l => (listDecode l).head?.join) fun t =>
@@ -248,6 +252,7 @@ def sigmaImp : (Σ n, L.BoundedFormula α n) → (Σ n, L.BoundedFormula α n) 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FirstOrder.Language.BoundedFormula.listDecode /-
 /-- Decodes a list of symbols as a list of formulas. -/
 @[simp]
 def listDecode :
@@ -288,6 +293,7 @@ def listDecode :
       (list_decode l).2.2.trans (max_le_max le_rfl le_add_self)⟩
   | _ => ⟨default, [], le_max_left _ _⟩
 #align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecode
+-/
 
 #print FirstOrder.Language.BoundedFormula.listDecode_encode_list /-
 @[simp]
@@ -382,6 +388,7 @@ theorem listEncode_sigma_injective :
 #align first_order.language.bounded_formula.list_encode_sigma_injective FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
 -/
 
+#print FirstOrder.Language.BoundedFormula.card_le /-
 theorem card_le :
     (#Σ n, L.BoundedFormula α n) ≤
       max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card) :=
@@ -395,6 +402,7 @@ theorem card_le :
   rw [← add_assoc, add_comm, ← add_assoc, ← add_assoc, aleph_0_add_aleph_0, add_assoc,
     add_eq_max le_rfl, add_assoc, card, symbols, mk_sum, lift_add, lift_lift, lift_lift]
 #align first_order.language.bounded_formula.card_le FirstOrder.Language.BoundedFormula.card_le
+-/
 
 end BoundedFormula
 
Diff
@@ -58,10 +58,10 @@ namespace Term
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 #print FirstOrder.Language.Term.listEncode /-
 /-- Encodes a term as a list of variables and function symbols. -/
-def listEncode : L.term α → List (Sum α (Σi, L.Functions i))
+def listEncode : L.term α → List (Sum α (Σ i, L.Functions i))
   | var i => [Sum.inl i]
   | func f ts =>
-    Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode
+    Sum.inr (⟨_, f⟩ : Σ i, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode
 #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode
 -/
 
@@ -71,7 +71,7 @@ def listEncode : L.term α → List (Sum α (Σi, L.Functions i))
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 #print FirstOrder.Language.Term.listDecode /-
 /-- Decodes a list of variables and function symbols as a list of terms. -/
-def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.term α))
+def listDecode : List (Sum α (Σ i, L.Functions i)) → List (Option (L.term α))
   | [] => []
   | Sum.inl a::l => some (var a)::list_decode l
   | Sum.inr ⟨n, f⟩::l =>
@@ -87,7 +87,7 @@ theorem listDecode_encode_list (l : List (L.term α)) :
     listDecode (l.bind listEncode) = l.map Option.some :=
   by
   suffices h :
-    ∀ (t : L.term α) (l : List (Sum α (Σi, L.functions i))),
+    ∀ (t : L.term α) (l : List (Sum α (Σ i, L.functions i))),
       list_decode (t.listEncode ++ l) = some t::list_decode l
   · induction' l with t l lih
     · rfl
@@ -129,28 +129,28 @@ theorem listDecode_encode_list (l : List (L.term α)) :
 @[simps]
 protected def encoding : Encoding (L.term α)
     where
-  Γ := Sum α (Σi, L.Functions i)
+  Γ := Sum α (Σ i, L.Functions i)
   encode := listEncode
   decode l := (listDecode l).head?.join
   decode_encode t := by
     have h := list_decode_encode_list [t]
-    rw [bind_singleton] at h
+    rw [bind_singleton] at h 
     simp only [h, Option.join, head', List.map, Option.some_bind, id.def]
 #align first_order.language.term.encoding FirstOrder.Language.Term.encoding
 -/
 
 #print FirstOrder.Language.Term.listEncode_injective /-
 theorem listEncode_injective :
-    Function.Injective (listEncode : L.term α → List (Sum α (Σi, L.Functions i))) :=
+    Function.Injective (listEncode : L.term α → List (Sum α (Σ i, L.Functions i))) :=
   Term.encoding.encode_injective
 #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective
 -/
 
-theorem card_le : (#L.term α) ≤ max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
+theorem card_le : (#L.term α) ≤ max ℵ₀ (#Sum α (Σ i, L.Functions i)) :=
   lift_le.1 (trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _)))
 #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
 
-theorem card_sigma : (#Σn, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
+theorem card_sigma : (#Σ n, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σ i, L.Functions i)) :=
   by
   refine' le_antisymm _ _
   · rw [mk_sigma]
@@ -175,23 +175,23 @@ theorem card_sigma : (#Σn, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi,
         ⟨⟨Sum.elim (fun i => ⟨0, var (Sum.inl i)⟩) fun F => ⟨1, func F.2 fun _ => var (Sum.inr 0)⟩,
             _⟩⟩
       · rintro (a | a) (b | b) h
-        · simp only [Sum.elim_inl, eq_self_iff_true, heq_iff_eq, true_and_iff] at h
+        · simp only [Sum.elim_inl, eq_self_iff_true, heq_iff_eq, true_and_iff] at h 
           rw [h]
-        · simp only [Sum.elim_inl, Sum.elim_inr, Nat.zero_ne_one, false_and_iff] at h
+        · simp only [Sum.elim_inl, Sum.elim_inr, Nat.zero_ne_one, false_and_iff] at h 
           exact h.elim
-        · simp only [Sum.elim_inr, Sum.elim_inl, Nat.one_ne_zero, false_and_iff] at h
+        · simp only [Sum.elim_inr, Sum.elim_inl, Nat.one_ne_zero, false_and_iff] at h 
           exact h.elim
-        · simp only [Sum.elim_inr, eq_self_iff_true, heq_iff_eq, true_and_iff] at h
+        · simp only [Sum.elim_inr, eq_self_iff_true, heq_iff_eq, true_and_iff] at h 
           rw [Sigma.ext_iff.2 ⟨h.1, h.2.1⟩]
 #align first_order.language.term.card_sigma FirstOrder.Language.Term.card_sigma
 
-instance [Encodable α] [Encodable (Σi, L.Functions i)] : Encodable (L.term α) :=
+instance [Encodable α] [Encodable (Σ i, L.Functions i)] : Encodable (L.term α) :=
   Encodable.ofLeftInjection listEncode (fun l => (listDecode l).head?.join) fun t =>
     by
     rw [← bind_singleton list_encode, list_decode_encode_list]
     simp only [Option.join, head', List.map, Option.some_bind, id.def]
 
-instance [h1 : Countable α] [h2 : Countable (Σl, L.Functions l)] : Countable (L.term α) :=
+instance [h1 : Countable α] [h2 : Countable (Σ l, L.Functions l)] : Countable (L.term α) :=
   by
   refine' mk_le_aleph_0_iff.1 (card_le.trans (max_le_iff.2 _))
   simp only [le_refl, mk_sum, add_le_aleph_0, lift_le_aleph_0, true_and_iff]
@@ -213,7 +213,7 @@ namespace BoundedFormula
 /-- Encodes a bounded formula as a list of symbols. -/
 def listEncode :
     ∀ {n : ℕ},
-      L.BoundedFormula α n → List (Sum (Σk, L.term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ))
+      L.BoundedFormula α n → List (Sum (Σ k, L.term (Sum α (Fin k))) (Sum (Σ n, L.Relations n) ℕ))
   | n, falsum => [Sum.inr (Sum.inr (n + 2))]
   | n, equal t₁ t₂ => [Sum.inl ⟨_, t₁⟩, Sum.inl ⟨_, t₂⟩]
   | n, Rel R ts =>
@@ -227,7 +227,7 @@ def listEncode :
 #print FirstOrder.Language.BoundedFormula.sigmaAll /-
 /-- Applies the `forall` quantifier to an element of `(Σ n, L.bounded_formula α n)`,
 or returns `default` if not possible. -/
-def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
+def sigmaAll : (Σ n, L.BoundedFormula α n) → Σ n, L.BoundedFormula α n
   | ⟨n + 1, φ⟩ => ⟨n, φ.all⟩
   | _ => default
 #align first_order.language.bounded_formula.sigma_all FirstOrder.Language.BoundedFormula.sigmaAll
@@ -236,7 +236,7 @@ def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
 #print FirstOrder.Language.BoundedFormula.sigmaImp /-
 /-- Applies `imp` to two elements of `(Σ n, L.bounded_formula α n)`,
 or returns `default` if not possible. -/
-def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
+def sigmaImp : (Σ n, L.BoundedFormula α n) → (Σ n, L.BoundedFormula α n) → Σ n, L.BoundedFormula α n
   | ⟨m, φ⟩, ⟨n, ψ⟩ => if h : m = n then ⟨m, φ.imp (Eq.mp (by rw [h]) ψ)⟩ else default
 #align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImp
 -/
@@ -251,9 +251,9 @@ def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) →
 /-- Decodes a list of symbols as a list of formulas. -/
 @[simp]
 def listDecode :
-    ∀ l : List (Sum (Σk, L.term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)),
-      (Σn, L.BoundedFormula α n) ×
-        { l' : List (Sum (Σk, L.term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)) //
+    ∀ l : List (Sum (Σ k, L.term (Sum α (Fin k))) (Sum (Σ n, L.Relations n) ℕ)),
+      (Σ n, L.BoundedFormula α n) ×
+        { l' : List (Sum (Σ k, L.term (Sum α (Fin k))) (Sum (Σ n, L.Relations n) ℕ)) //
           l'.sizeOf ≤ max 1 l.sizeOf }
   | Sum.inr (Sum.inr (n + 2))::l => ⟨⟨n, falsum⟩, l, le_max_of_le_right le_add_self⟩
   | Sum.inl ⟨n₁, t₁⟩::Sum.inl ⟨n₂, t₂⟩::l =>
@@ -271,7 +271,7 @@ def listDecode :
   | Sum.inr (Sum.inr 0)::l =>
     have :
       (↑(list_decode l).2 :
-            List (Sum (Σk, L.term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ))).sizeOf <
+            List (Sum (Σ k, L.term (Sum α (Fin k))) (Sum (Σ n, L.Relations n) ℕ))).sizeOf <
         1 + (1 + 1) + l.sizeOf :=
       by
       refine' lt_of_le_of_lt (list_decode l).2.2 (max_lt _ (Nat.lt_add_of_pos_left (by decide)))
@@ -291,11 +291,11 @@ def listDecode :
 
 #print FirstOrder.Language.BoundedFormula.listDecode_encode_list /-
 @[simp]
-theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
+theorem listDecode_encode_list (l : List (Σ n, L.BoundedFormula α n)) :
     (listDecode (l.bind fun φ => φ.2.listEncode)).1 = l.headI :=
   by
   suffices h :
-    ∀ (φ : Σn, L.bounded_formula α n) (l),
+    ∀ (φ : Σ n, L.bounded_formula α n) (l),
       (list_decode (list_encode φ.2 ++ l)).1 = φ ∧ (list_decode (list_encode φ.2 ++ l)).2.1 = l
   · induction' l with φ l lih
     · rw [List.nil_bind]
@@ -315,8 +315,8 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
                       (List.map
                           (fun i : Fin φ_l =>
                             Sum.inl
-                              (⟨(⟨φ_n, Rel φ_R ts⟩ : Σn, L.bounded_formula α n).fst, ts i⟩ :
-                                Σn, L.term (Sum α (Fin n))))
+                              (⟨(⟨φ_n, Rel φ_R ts⟩ : Σ n, L.bounded_formula α n).fst, ts i⟩ :
+                                Σ n, L.term (Sum α (Fin n))))
                           (fin_range φ_l) ++
                         l)).get?
                   ↑i).join =
@@ -362,14 +362,14 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
 #print FirstOrder.Language.BoundedFormula.encoding /-
 /-- An encoding of bounded formulas as lists. -/
 @[simps]
-protected def encoding : Encoding (Σn, L.BoundedFormula α n)
+protected def encoding : Encoding (Σ n, L.BoundedFormula α n)
     where
-  Γ := Sum (Σk, L.term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ)
+  Γ := Sum (Σ k, L.term (Sum α (Fin k))) (Sum (Σ n, L.Relations n) ℕ)
   encode φ := φ.2.listEncode
   decode l := (listDecode l).1
   decode_encode φ := by
     have h := list_decode_encode_list [φ]
-    rw [bind_singleton] at h
+    rw [bind_singleton] at h 
     rw [h]
     rfl
 #align first_order.language.bounded_formula.encoding FirstOrder.Language.BoundedFormula.encoding
@@ -377,13 +377,13 @@ protected def encoding : Encoding (Σn, L.BoundedFormula α n)
 
 #print FirstOrder.Language.BoundedFormula.listEncode_sigma_injective /-
 theorem listEncode_sigma_injective :
-    Function.Injective fun φ : Σn, L.BoundedFormula α n => φ.2.listEncode :=
+    Function.Injective fun φ : Σ n, L.BoundedFormula α n => φ.2.listEncode :=
   BoundedFormula.encoding.encode_injective
 #align first_order.language.bounded_formula.list_encode_sigma_injective FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
 -/
 
 theorem card_le :
-    (#Σn, L.BoundedFormula α n) ≤
+    (#Σ n, L.BoundedFormula α n) ≤
       max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card) :=
   by
   refine' lift_le.1 (bounded_formula.encoding.card_le_card_list.trans _)
Diff
@@ -49,7 +49,7 @@ variable {M : Type w} {N P : Type _} [L.Structure M] [L.Structure N] [L.Structur
 
 variable {α : Type u'} {β : Type v'}
 
-open FirstOrder Cardinal
+open scoped FirstOrder Cardinal
 
 open Computability List Structure Cardinal Fin
 
Diff
@@ -146,22 +146,10 @@ theorem listEncode_injective :
 #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective
 -/
 
-/- warning: first_order.language.term.card_le -> FirstOrder.Language.Term.card_le is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.hasLe.{max u1 u3} (Cardinal.mk.{max u1 u3} (FirstOrder.Language.Term.{u1, u2, u3} L α)) (LinearOrder.max.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.linearOrder.{max u1 u3} Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instLECardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (FirstOrder.Language.Term.{u1, u2, u3} L α)) (Max.max.{succ (max u1 u3)} Cardinal.{max u1 u3} (CanonicallyLinearOrderedAddMonoid.toMax.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max u1 u3}) Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
-Case conversion may be inaccurate. Consider using '#align first_order.language.term.card_le FirstOrder.Language.Term.card_leₓ'. -/
 theorem card_le : (#L.term α) ≤ max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
   lift_le.1 (trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _)))
 #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
 
-/- warning: first_order.language.term.card_sigma -> FirstOrder.Language.Term.card_sigma is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, Eq.{succ (succ (max u1 u3))} Cardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))))) (LinearOrder.max.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.linearOrder.{max u1 u3} Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, Eq.{max (succ (succ u1)) (succ (succ u3))} Cardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))))) (Max.max.{succ (max u1 u3)} Cardinal.{max u1 u3} (CanonicallyLinearOrderedAddMonoid.toMax.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max u1 u3}) Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
-Case conversion may be inaccurate. Consider using '#align first_order.language.term.card_sigma FirstOrder.Language.Term.card_sigmaₓ'. -/
 theorem card_sigma : (#Σn, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
   by
   refine' le_antisymm _ _
@@ -253,12 +241,6 @@ def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) →
 #align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImp
 -/
 
-/- warning: first_order.language.bounded_formula.list_decode -> FirstOrder.Language.BoundedFormula.listDecode is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}} (l : List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))), Prod.{max u1 u2 u3, max (max u1 u3) u2} (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) (Subtype.{succ (max (max u1 u3) u2)} (List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (fun (l' : List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) => LE.le.{0} Nat Nat.hasLe (List.sizeof.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum.hasSizeof.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum.hasSizeof.{u3, 0} α (Fin a) (defaultHasSizeof.{succ u3} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma.hasSizeof.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a))) Nat.hasSizeof)) l') (LinearOrder.max.{0} Nat Nat.linearOrder (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) (List.sizeof.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum.hasSizeof.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum.hasSizeof.{u3, 0} α (Fin a) (defaultHasSizeof.{succ u3} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma.hasSizeof.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a))) Nat.hasSizeof)) l))))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}} (l : List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))), Prod.{max (max u1 u2) u3, max (max u1 u3) u2} (Sigma.{0, max (max u1 u2) u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) (Subtype.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (fun (l' : List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) => LE.le.{0} Nat instLENat (SizeOf.sizeOf.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (List._sizeOf_inst.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum._sizeOf_inst.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma._sizeOf_inst.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))) instSizeOfNat (fun (a : Nat) => FirstOrder.Language.Term._sizeOf_inst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum._sizeOf_inst.{u3, 0} α (Fin a) (instSizeOf.{succ u3} α) (Fin._sizeOf_inst a)))) (Sum._sizeOf_inst.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma._sizeOf_inst.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) instSizeOfNat (fun (a._@.Init.Core._hyg.2531 : Nat) => instSizeOf.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a._@.Init.Core._hyg.2531))) instSizeOfNat))) l') (Max.max.{0} Nat Nat.instMaxNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) (SizeOf.sizeOf.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (List._sizeOf_inst.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum._sizeOf_inst.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma._sizeOf_inst.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))) instSizeOfNat (fun (a : Nat) => FirstOrder.Language.Term._sizeOf_inst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum._sizeOf_inst.{u3, 0} α (Fin a) (instSizeOf.{succ u3} α) (Fin._sizeOf_inst a)))) (Sum._sizeOf_inst.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma._sizeOf_inst.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) instSizeOfNat (fun (a._@.Init.Core._hyg.2531 : Nat) => instSizeOf.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a._@.Init.Core._hyg.2531))) instSizeOfNat))) l))))
-Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecodeₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -400,12 +382,6 @@ theorem listEncode_sigma_injective :
 #align first_order.language.bounded_formula.list_encode_sigma_injective FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
 -/
 
-/- warning: first_order.language.bounded_formula.card_le -> FirstOrder.Language.BoundedFormula.card_le is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.hasLe.{max u1 u2 u3} (Cardinal.mk.{max u1 u2 u3} (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))) (LinearOrder.max.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.linearOrder.{max u1 u2 u3} Cardinal.aleph0.{max u1 u2 u3} (HAdd.hAdd.{succ (max u1 u2 u3), succ (max u1 u2 u3), succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.{max u1 u2 u3} Cardinal.{max u1 u2 u3} (instHAdd.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.hasAdd.{max u1 u2 u3}) (Cardinal.lift.{max u1 u2, u3} (Cardinal.mk.{u3} α)) (Cardinal.lift.{u3, max u1 u2} (FirstOrder.Language.card.{u1, u2} L))))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max (max u1 u2) u3} Cardinal.instLECardinal.{max (max u1 u3) u2} (Cardinal.mk.{max (max u1 u2) u3} (Sigma.{0, max (max u1 u2) u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))) (Max.max.{succ (max (max u1 u3) u2)} Cardinal.{max (max u1 u3) u2} (CanonicallyLinearOrderedAddMonoid.toMax.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max (max u1 u3) u2} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max (max u1 u3) u2}) Cardinal.aleph0.{max (max u1 u3) u2} (HAdd.hAdd.{max (max (succ u1) (succ u3)) (succ u2), max (max (succ u1) (succ u3)) (succ u2), max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max u3 u1 u2} Cardinal.{max (max u1 u2) u3} Cardinal.{max u3 u1 u2} (instHAdd.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max u3 u1 u2} Cardinal.instAddCardinal.{max (max u1 u3) u2}) (Cardinal.lift.{max u1 u2, u3} (Cardinal.mk.{u3} α)) (Cardinal.lift.{u3, max u1 u2} (FirstOrder.Language.card.{u1, u2} L))))
-Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.card_le FirstOrder.Language.BoundedFormula.card_leₓ'. -/
 theorem card_le :
     (#Σn, L.BoundedFormula α n) ≤
       max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card) :=
Diff
@@ -351,11 +351,9 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
           · exact lt_of_lt_of_le i.is_lt (ge_of_eq (length_fin_range _))
           · rw [length_map, length_fin_range]
             exact i.2
-        rw [dif_pos]
-        swap
+        rw [dif_pos]; swap
         · exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩
-        rw [dif_pos]
-        swap
+        rw [dif_pos]; swap
         · intro i
           obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
           rw [h2]
Diff
@@ -168,14 +168,14 @@ theorem card_sigma : (#Σn, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi,
   · rw [mk_sigma]
     refine' (sum_le_supr_lift _).trans _
     rw [mk_nat, lift_aleph_0, mul_eq_max_of_aleph_0_le_left le_rfl, max_le_iff,
-      csupᵢ_le_iff' (bdd_above_range _)]
+      ciSup_le_iff' (bdd_above_range _)]
     · refine' ⟨le_max_left _ _, fun i => card_le.trans _⟩
       refine' max_le (le_max_left _ _) _
       rw [← add_eq_max le_rfl, mk_sum, mk_sum, mk_sum, add_comm (Cardinal.lift (#α)), lift_add,
         add_assoc, lift_lift, lift_lift, mk_fin, lift_nat_cast]
       exact add_le_add_right (nat_lt_aleph_0 _).le _
     · rw [← one_le_iff_ne_zero]
-      refine' trans _ (le_csupᵢ (bdd_above_range _) 1)
+      refine' trans _ (le_ciSup (bdd_above_range _) 1)
       rw [one_le_iff_ne_zero, mk_ne_zero_iff]
       exact ⟨var (Sum.inr 0)⟩
   · rw [max_le_iff, ← infinite_iff]
Diff
@@ -282,7 +282,7 @@ def listDecode :
   | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l =>
     ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft).get? i).join.isSome then
         if h' : ∀ i, (Option.get (h i)).1 = k then
-          ⟨k, BoundedFormula.Rel R fun i => Eq.mp (by rw [h' i]) (Option.get (h i)).2⟩
+          ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get (h i)).2⟩
         else default
       else default,
       l.drop n, le_max_of_le_right (le_add_left (le_add_left (List.drop_sizeOf_le _ _)))⟩
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson
 
 ! This file was ported from Lean 3 source module model_theory.encoding
-! leanprover-community/mathlib commit 91288e351d51b3f0748f0a38faa7613fb0ae2ada
+! leanprover-community/mathlib commit 8eb9c42d4d34c77f6ee84ea766ae4070233a973c
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -15,6 +15,9 @@ import Mathbin.SetTheory.Cardinal.Ordinal
 
 /-! # Encodings and Cardinality of First-Order Syntax
 
+> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
+> Any changes to this file require a corresponding PR to mathlib4.
+
 ## Main Definitions
 * `first_order.language.term.encoding` encodes terms as lists.
 * `first_order.language.bounded_formula.encoding` encodes bounded formulas as lists.
Diff
@@ -52,30 +52,21 @@ open Computability List Structure Cardinal Fin
 
 namespace Term
 
-/- warning: first_order.language.term.list_encode -> FirstOrder.Language.Term.listEncode is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, (FirstOrder.Language.Term.{u1, u2, u3} L α) -> (List.{max u3 u1} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i))))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}}, (FirstOrder.Language.Term.{u1, u3, u2} L α) -> (List.{max u2 u1} (Sum.{u2, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u3} L i))))
-Case conversion may be inaccurate. Consider using '#align first_order.language.term.list_encode FirstOrder.Language.Term.listEncodeₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FirstOrder.Language.Term.listEncode /-
 /-- Encodes a term as a list of variables and function symbols. -/
 def listEncode : L.term α → List (Sum α (Σi, L.Functions i))
   | var i => [Sum.inl i]
   | func f ts =>
     Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode
 #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode
+-/
 
-/- warning: first_order.language.term.list_decode -> FirstOrder.Language.Term.listDecode is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, (List.{max u3 u1} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))) -> (List.{max u1 u3} (Option.{max u1 u3} (FirstOrder.Language.Term.{u1, u2, u3} L α)))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}}, (List.{max u2 u1} (Sum.{u2, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u3} L i)))) -> (List.{max u1 u2} (Option.{max u1 u2} (FirstOrder.Language.Term.{u1, u3, u2} L α)))
-Case conversion may be inaccurate. Consider using '#align first_order.language.term.list_decode FirstOrder.Language.Term.listDecodeₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FirstOrder.Language.Term.listDecode /-
 /-- Decodes a list of variables and function symbols as a list of terms. -/
 def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.term α))
   | [] => []
@@ -85,8 +76,10 @@ def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.term α)
       (func f fun i => Option.get (h i))::(list_decode l).drop n
     else [none]
 #align first_order.language.term.list_decode FirstOrder.Language.Term.listDecode
+-/
 
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FirstOrder.Language.Term.listDecode_encode_list /-
 theorem listDecode_encode_list (l : List (L.term α)) :
     listDecode (l.bind listEncode) = l.map Option.some :=
   by
@@ -126,7 +119,9 @@ theorem listDecode_encode_list (l : List (L.term α)) :
       · rw [h, drop_left']
         rw [length_map, length_fin_range]
 #align first_order.language.term.list_decode_encode_list FirstOrder.Language.Term.listDecode_encode_list
+-/
 
+#print FirstOrder.Language.Term.encoding /-
 /-- An encoding of terms as lists. -/
 @[simps]
 protected def encoding : Encoding (L.term α)
@@ -139,16 +134,31 @@ protected def encoding : Encoding (L.term α)
     rw [bind_singleton] at h
     simp only [h, Option.join, head', List.map, Option.some_bind, id.def]
 #align first_order.language.term.encoding FirstOrder.Language.Term.encoding
+-/
 
+#print FirstOrder.Language.Term.listEncode_injective /-
 theorem listEncode_injective :
     Function.Injective (listEncode : L.term α → List (Sum α (Σi, L.Functions i))) :=
   Term.encoding.encode_injective
 #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective
+-/
 
+/- warning: first_order.language.term.card_le -> FirstOrder.Language.Term.card_le is a dubious translation:
+lean 3 declaration is
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.hasLe.{max u1 u3} (Cardinal.mk.{max u1 u3} (FirstOrder.Language.Term.{u1, u2, u3} L α)) (LinearOrder.max.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.linearOrder.{max u1 u3} Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
+but is expected to have type
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instLECardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (FirstOrder.Language.Term.{u1, u2, u3} L α)) (Max.max.{succ (max u1 u3)} Cardinal.{max u1 u3} (CanonicallyLinearOrderedAddMonoid.toMax.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max u1 u3}) Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
+Case conversion may be inaccurate. Consider using '#align first_order.language.term.card_le FirstOrder.Language.Term.card_leₓ'. -/
 theorem card_le : (#L.term α) ≤ max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
   lift_le.1 (trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _)))
 #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
 
+/- warning: first_order.language.term.card_sigma -> FirstOrder.Language.Term.card_sigma is a dubious translation:
+lean 3 declaration is
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, Eq.{succ (succ (max u1 u3))} Cardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))))) (LinearOrder.max.{succ (max u1 u3)} Cardinal.{max u1 u3} Cardinal.linearOrder.{max u1 u3} Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
+but is expected to have type
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, Eq.{max (succ (succ u1)) (succ (succ u3))} Cardinal.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))))) (Max.max.{succ (max u1 u3)} Cardinal.{max u1 u3} (CanonicallyLinearOrderedAddMonoid.toMax.{max (succ u1) (succ u3)} Cardinal.{max u1 u3} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max u1 u3}) Cardinal.aleph0.{max u1 u3} (Cardinal.mk.{max u1 u3} (Sum.{u3, u1} α (Sigma.{0, u1} Nat (fun (i : Nat) => FirstOrder.Language.Functions.{u1, u2} L i)))))
+Case conversion may be inaccurate. Consider using '#align first_order.language.term.card_sigma FirstOrder.Language.Term.card_sigmaₓ'. -/
 theorem card_sigma : (#Σn, L.term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
   by
   refine' le_antisymm _ _
@@ -196,22 +206,19 @@ instance [h1 : Countable α] [h2 : Countable (Σl, L.Functions l)] : Countable (
   simp only [le_refl, mk_sum, add_le_aleph_0, lift_le_aleph_0, true_and_iff]
   exact ⟨Cardinal.mk_le_aleph0, Cardinal.mk_le_aleph0⟩
 
+#print FirstOrder.Language.Term.small /-
 instance small [Small.{u} α] : Small.{u} (L.term α) :=
   small_of_injective listEncode_injective
 #align first_order.language.term.small FirstOrder.Language.Term.small
+-/
 
 end Term
 
 namespace BoundedFormula
 
-/- warning: first_order.language.bounded_formula.list_encode -> FirstOrder.Language.BoundedFormula.listEncode is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}} {n : Nat}, (FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n) -> (List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}} {n : Nat}, (FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n) -> (List.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat)))
-Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.list_encode FirstOrder.Language.BoundedFormula.listEncodeₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
+#print FirstOrder.Language.BoundedFormula.listEncode /-
 /-- Encodes a bounded formula as a list of symbols. -/
 def listEncode :
     ∀ {n : ℕ},
@@ -224,37 +231,30 @@ def listEncode :
   | n, imp φ₁ φ₂ => (Sum.inr (Sum.inr 0)::φ₁.listEncode) ++ φ₂.listEncode
   | n, all φ => Sum.inr (Sum.inr 1)::φ.listEncode
 #align first_order.language.bounded_formula.list_encode FirstOrder.Language.BoundedFormula.listEncode
+-/
 
-/- warning: first_order.language.bounded_formula.sigma_all -> FirstOrder.Language.BoundedFormula.sigmaAll is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) -> (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}}, (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n)) -> (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n))
-Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.sigma_all FirstOrder.Language.BoundedFormula.sigmaAllₓ'. -/
+#print FirstOrder.Language.BoundedFormula.sigmaAll /-
 /-- Applies the `forall` quantifier to an element of `(Σ n, L.bounded_formula α n)`,
 or returns `default` if not possible. -/
 def sigmaAll : (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
   | ⟨n + 1, φ⟩ => ⟨n, φ.all⟩
   | _ => default
 #align first_order.language.bounded_formula.sigma_all FirstOrder.Language.BoundedFormula.sigmaAll
+-/
 
-/- warning: first_order.language.bounded_formula.sigma_imp -> FirstOrder.Language.BoundedFormula.sigmaImp is a dubious translation:
-lean 3 declaration is
-  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) -> (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) -> (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))
-but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}}, (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n)) -> (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n)) -> (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n))
-Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImpₓ'. -/
+#print FirstOrder.Language.BoundedFormula.sigmaImp /-
 /-- Applies `imp` to two elements of `(Σ n, L.bounded_formula α n)`,
 or returns `default` if not possible. -/
 def sigmaImp : (Σn, L.BoundedFormula α n) → (Σn, L.BoundedFormula α n) → Σn, L.BoundedFormula α n
   | ⟨m, φ⟩, ⟨n, ψ⟩ => if h : m = n then ⟨m, φ.imp (Eq.mp (by rw [h]) ψ)⟩ else default
 #align first_order.language.bounded_formula.sigma_imp FirstOrder.Language.BoundedFormula.sigmaImp
+-/
 
 /- warning: first_order.language.bounded_formula.list_decode -> FirstOrder.Language.BoundedFormula.listDecode is a dubious translation:
 lean 3 declaration is
   forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}} (l : List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))), Prod.{max u1 u2 u3, max (max u1 u3) u2} (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) (Subtype.{succ (max (max u1 u3) u2)} (List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (fun (l' : List.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) => LE.le.{0} Nat Nat.hasLe (List.sizeof.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum.hasSizeof.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum.hasSizeof.{u3, 0} α (Fin a) (defaultHasSizeof.{succ u3} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma.hasSizeof.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a))) Nat.hasSizeof)) l') (LinearOrder.max.{0} Nat Nat.linearOrder (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) (List.sizeof.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum.hasSizeof.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum.hasSizeof.{u3, 0} α (Fin a) (defaultHasSizeof.{succ u3} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma.hasSizeof.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a))) Nat.hasSizeof)) l))))
 but is expected to have type
-  forall {L : FirstOrder.Language.{u1, u3}} {α : Type.{u2}} (l : List.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat))), Prod.{max u1 u3 u2, max (max u1 u2) u3} (Sigma.{0, max u1 u3 u2} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u3, u2} L α n)) (Subtype.{succ (max (max u1 u2) u3)} (List.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat))) (fun (l' : List.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat))) => LE.le.{0} Nat Nat.hasLe (List.sizeof.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat)) (Sum.hasSizeof.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u3, u2} L (Sum.{u2, 0} α (Fin a)) (Sum.hasSizeof.{u2, 0} α (Fin a) (defaultHasSizeof.{succ u2} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat (Sigma.hasSizeof.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u3} (FirstOrder.Language.Relations.{u1, u3} L a))) Nat.hasSizeof)) l') (LinearOrder.max.{0} Nat Nat.linearOrder (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))) (List.sizeof.{max (max u1 u2) u3} (Sum.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat)) (Sum.hasSizeof.{max u1 u2, u3} (Sigma.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k)))) (Sum.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat) (Sigma.hasSizeof.{0, max u1 u2} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u3, u2} L (Sum.{u2, 0} α (Fin k))) Nat.hasSizeof (fun (a : Nat) => FirstOrder.Language.Term.hasSizeofInst.{u1, u3, u2} L (Sum.{u2, 0} α (Fin a)) (Sum.hasSizeof.{u2, 0} α (Fin a) (defaultHasSizeof.{succ u2} α) (Fin.hasSizeofInst a)))) (Sum.hasSizeof.{u3, 0} (Sigma.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n)) Nat (Sigma.hasSizeof.{0, u3} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u3} L n) Nat.hasSizeof (fun (a : Nat) => defaultHasSizeof.{succ u3} (FirstOrder.Language.Relations.{u1, u3} L a))) Nat.hasSizeof)) l))))
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}} (l : List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))), Prod.{max (max u1 u2) u3, max (max u1 u3) u2} (Sigma.{0, max (max u1 u2) u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n)) (Subtype.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (fun (l' : List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) => LE.le.{0} Nat instLENat (SizeOf.sizeOf.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (List._sizeOf_inst.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum._sizeOf_inst.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma._sizeOf_inst.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))) instSizeOfNat (fun (a : Nat) => FirstOrder.Language.Term._sizeOf_inst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum._sizeOf_inst.{u3, 0} α (Fin a) (instSizeOf.{succ u3} α) (Fin._sizeOf_inst a)))) (Sum._sizeOf_inst.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma._sizeOf_inst.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) instSizeOfNat (fun (a._@.Init.Core._hyg.2531 : Nat) => instSizeOf.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a._@.Init.Core._hyg.2531))) instSizeOfNat))) l') (Max.max.{0} Nat Nat.instMaxNat (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)) (SizeOf.sizeOf.{max (max (succ u1) (succ u3)) (succ u2)} (List.{max u2 u1 u3} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat))) (List._sizeOf_inst.{max (max u1 u3) u2} (Sum.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (k : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin k)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat)) (Sum._sizeOf_inst.{max u1 u3, u2} (Sigma.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n)))) (Sum.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat) (Sigma._sizeOf_inst.{0, max u1 u3} Nat (fun (n : Nat) => FirstOrder.Language.Term.{u1, u2, u3} L (Sum.{u3, 0} α (Fin n))) instSizeOfNat (fun (a : Nat) => FirstOrder.Language.Term._sizeOf_inst.{u1, u2, u3} L (Sum.{u3, 0} α (Fin a)) (Sum._sizeOf_inst.{u3, 0} α (Fin a) (instSizeOf.{succ u3} α) (Fin._sizeOf_inst a)))) (Sum._sizeOf_inst.{u2, 0} (Sigma.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n)) Nat (Sigma._sizeOf_inst.{0, u2} Nat (fun (n : Nat) => FirstOrder.Language.Relations.{u1, u2} L n) instSizeOfNat (fun (a._@.Init.Core._hyg.2531 : Nat) => instSizeOf.{succ u2} (FirstOrder.Language.Relations.{u1, u2} L a._@.Init.Core._hyg.2531))) instSizeOfNat))) l))))
 Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecodeₓ'. -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
 /- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
@@ -304,6 +304,7 @@ def listDecode :
   | _ => ⟨default, [], le_max_left _ _⟩
 #align first_order.language.bounded_formula.list_decode FirstOrder.Language.BoundedFormula.listDecode
 
+#print FirstOrder.Language.BoundedFormula.listDecode_encode_list /-
 @[simp]
 theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
     (listDecode (l.bind fun φ => φ.2.listEncode)).1 = l.headI :=
@@ -373,7 +374,9 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
       rw [(ih _).1, (ih _).2, sigma_all]
       exact ⟨rfl, rfl⟩
 #align first_order.language.bounded_formula.list_decode_encode_list FirstOrder.Language.BoundedFormula.listDecode_encode_list
+-/
 
+#print FirstOrder.Language.BoundedFormula.encoding /-
 /-- An encoding of bounded formulas as lists. -/
 @[simps]
 protected def encoding : Encoding (Σn, L.BoundedFormula α n)
@@ -387,12 +390,21 @@ protected def encoding : Encoding (Σn, L.BoundedFormula α n)
     rw [h]
     rfl
 #align first_order.language.bounded_formula.encoding FirstOrder.Language.BoundedFormula.encoding
+-/
 
+#print FirstOrder.Language.BoundedFormula.listEncode_sigma_injective /-
 theorem listEncode_sigma_injective :
     Function.Injective fun φ : Σn, L.BoundedFormula α n => φ.2.listEncode :=
   BoundedFormula.encoding.encode_injective
 #align first_order.language.bounded_formula.list_encode_sigma_injective FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
+-/
 
+/- warning: first_order.language.bounded_formula.card_le -> FirstOrder.Language.BoundedFormula.card_le is a dubious translation:
+lean 3 declaration is
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.hasLe.{max u1 u2 u3} (Cardinal.mk.{max u1 u2 u3} (Sigma.{0, max u1 u2 u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))) (LinearOrder.max.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.linearOrder.{max u1 u2 u3} Cardinal.aleph0.{max u1 u2 u3} (HAdd.hAdd.{succ (max u1 u2 u3), succ (max u1 u2 u3), succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.{max u1 u2 u3} Cardinal.{max u1 u2 u3} (instHAdd.{succ (max u1 u2 u3)} Cardinal.{max u1 u2 u3} Cardinal.hasAdd.{max u1 u2 u3}) (Cardinal.lift.{max u1 u2, u3} (Cardinal.mk.{u3} α)) (Cardinal.lift.{u3, max u1 u2} (FirstOrder.Language.card.{u1, u2} L))))
+but is expected to have type
+  forall {L : FirstOrder.Language.{u1, u2}} {α : Type.{u3}}, LE.le.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max (max u1 u2) u3} Cardinal.instLECardinal.{max (max u1 u3) u2} (Cardinal.mk.{max (max u1 u2) u3} (Sigma.{0, max (max u1 u2) u3} Nat (fun (n : Nat) => FirstOrder.Language.BoundedFormula.{u1, u2, u3} L α n))) (Max.max.{succ (max (max u1 u3) u2)} Cardinal.{max (max u1 u3) u2} (CanonicallyLinearOrderedAddMonoid.toMax.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max (max u1 u3) u2} Cardinal.instCanonicallyLinearOrderedAddMonoidCardinal.{max (max u1 u3) u2}) Cardinal.aleph0.{max (max u1 u3) u2} (HAdd.hAdd.{max (max (succ u1) (succ u3)) (succ u2), max (max (succ u1) (succ u3)) (succ u2), max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max u3 u1 u2} Cardinal.{max (max u1 u2) u3} Cardinal.{max u3 u1 u2} (instHAdd.{max (max (succ u1) (succ u3)) (succ u2)} Cardinal.{max u3 u1 u2} Cardinal.instAddCardinal.{max (max u1 u3) u2}) (Cardinal.lift.{max u1 u2, u3} (Cardinal.mk.{u3} α)) (Cardinal.lift.{u3, max u1 u2} (FirstOrder.Language.card.{u1, u2} L))))
+Case conversion may be inaccurate. Consider using '#align first_order.language.bounded_formula.card_le FirstOrder.Language.BoundedFormula.card_leₓ'. -/
 theorem card_le :
     (#Σn, L.BoundedFormula α n) ≤
       max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card) :=
Diff
@@ -279,7 +279,7 @@ def listDecode :
   | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l =>
     ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft).get? i).join.isSome then
         if h' : ∀ i, (Option.get (h i)).1 = k then
-          ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get (h i)).2⟩
+          ⟨k, BoundedFormula.Rel R fun i => Eq.mp (by rw [h' i]) (Option.get (h i)).2⟩
         else default
       else default,
       l.drop n, le_max_of_le_right (le_add_left (le_add_left (List.drop_sizeOf_le _ _)))⟩

Changes in mathlib4

mathlib3
mathlib4
chore: avoid id.def (adaptation for nightly-2024-03-27) (#11829)

Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com>

Diff
@@ -107,7 +107,7 @@ protected def encoding : Encoding (L.Term α) where
   decode_encode t := by
     have h := listDecode_encode_list [t]
     rw [bind_singleton] at h
-    simp only [h, Option.join, head?, List.map, Option.some_bind, id.def]
+    simp only [h, Option.join, head?, List.map, Option.some_bind, id]
 #align first_order.language.term.encoding FirstOrder.Language.Term.encoding
 
 theorem listEncode_injective :
@@ -155,7 +155,7 @@ instance [Encodable α] [Encodable (Σi, L.Functions i)] : Encodable (L.Term α)
   Encodable.ofLeftInjection listEncode (fun l => (listDecode l).head?.join) fun t => by
     simp only
     rw [← bind_singleton listEncode, listDecode_encode_list]
-    simp only [Option.join, head?, List.map, Option.some_bind, id.def]
+    simp only [Option.join, head?, List.map, Option.some_bind, id]
 
 instance [h1 : Countable α] [h2 : Countable (Σl, L.Functions l)] : Countable (L.Term α) := by
   refine' mk_le_aleph0_iff.1 (card_le.trans (max_le_iff.2 _))
@@ -252,7 +252,7 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
         Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
           Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by
         intro i
-        simp only [Option.join, map_append, map_map, Option.bind_eq_some, id.def, exists_eq_right,
+        simp only [Option.join, map_append, map_map, Option.bind_eq_some, id, exists_eq_right,
           get?_eq_some, length_append, length_map, length_finRange]
         refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
         rw [get_append, get_map]
chore(*): remove empty lines between variable statements (#11418)

Empty lines were removed by executing the following Python script twice

import os
import re


# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
  for filename in files:
    if filename.endswith('.lean'):
      file_path = os.path.join(dir_path, filename)

      # Open the file and read its contents
      with open(file_path, 'r') as file:
        content = file.read()

      # Use a regular expression to replace sequences of "variable" lines separated by empty lines
      # with sequences without empty lines
      modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)

      # Write the modified content back to the file
      with open(file_path, 'w') as file:
        file.write(modified_content)
Diff
@@ -38,9 +38,7 @@ namespace FirstOrder
 namespace Language
 
 variable {L : Language.{u, v}}
-
 variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P]
-
 variable {α : Type u'} {β : Type v'}
 
 open FirstOrder Cardinal
chore: remove stream-of-consciousness uses of have, replace and suffices (#10640)

No changes to tactic file, it's just boring fixes throughout the library.

This follows on from #6964.

Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>

Diff
@@ -69,35 +69,35 @@ def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α)
 theorem listDecode_encode_list (l : List (L.Term α)) :
     listDecode (l.bind listEncode) = l.map Option.some := by
   suffices h : ∀ (t : L.Term α) (l : List (Sum α (Σi, L.Functions i))),
-      listDecode (t.listEncode ++ l) = some t::listDecode l
-  · induction' l with t l lih
+      listDecode (t.listEncode ++ l) = some t::listDecode l by
+    induction' l with t l lih
     · rfl
     · rw [cons_bind, h t (l.bind listEncode), lih, List.map]
-  · intro t
-    induction' t with a n f ts ih <;> intro l
-    · rw [listEncode, singleton_append, listDecode]
-    · rw [listEncode, cons_append, listDecode]
-      have h : listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l) =
-          (finRange n).map (Option.some ∘ ts) ++ listDecode l := by
-        induction' finRange n with i l' l'ih
-        · rfl
-        · rw [cons_bind, List.append_assoc, ih, map_cons, l'ih, cons_append, Function.comp]
-      have h' : ∀ i : Fin n,
-          (listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l)).get? ↑i =
-            some (some (ts i)) := by
-        intro i
-        rw [h, get?_append, get?_map]
-        · simp only [Option.map_eq_some', Function.comp_apply, get?_eq_some]
-          refine' ⟨i, ⟨lt_of_lt_of_le i.2 (ge_of_eq (length_finRange _)), _⟩, rfl⟩
-          rw [get_finRange, Fin.eta]
-        · refine' lt_of_lt_of_le i.2 _
-          simp
-      refine' (dif_pos fun i => Option.isSome_iff_exists.2 ⟨ts i, _⟩).trans _
-      · rw [Option.join_eq_some, h']
-      refine' congr (congr rfl (congr rfl (congr rfl (funext fun i => Option.get_of_mem _ _)))) _
-      · simp [h']
-      · rw [h, drop_left']
-        rw [length_map, length_finRange]
+  intro t
+  induction' t with a n f ts ih <;> intro l
+  · rw [listEncode, singleton_append, listDecode]
+  · rw [listEncode, cons_append, listDecode]
+    have h : listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l) =
+        (finRange n).map (Option.some ∘ ts) ++ listDecode l := by
+      induction' finRange n with i l' l'ih
+      · rfl
+      · rw [cons_bind, List.append_assoc, ih, map_cons, l'ih, cons_append, Function.comp]
+    have h' : ∀ i : Fin n,
+        (listDecode (((finRange n).bind fun i : Fin n => (ts i).listEncode) ++ l)).get? ↑i =
+          some (some (ts i)) := by
+      intro i
+      rw [h, get?_append, get?_map]
+      · simp only [Option.map_eq_some', Function.comp_apply, get?_eq_some]
+        refine' ⟨i, ⟨lt_of_lt_of_le i.2 (ge_of_eq (length_finRange _)), _⟩, rfl⟩
+        rw [get_finRange, Fin.eta]
+      · refine' lt_of_lt_of_le i.2 _
+        simp
+    refine' (dif_pos fun i => Option.isSome_iff_exists.2 ⟨ts i, _⟩).trans _
+    · rw [Option.join_eq_some, h']
+    refine' congr (congr rfl (congr rfl (congr rfl (funext fun i => Option.get_of_mem _ _)))) _
+    · simp [h']
+    · rw [h, drop_left']
+      rw [length_map, length_finRange]
 #align first_order.language.term.list_decode_encode_list FirstOrder.Language.Term.listDecode_encode_list
 
 /-- An encoding of terms as lists. -/
@@ -237,56 +237,56 @@ def listDecode : ∀ l : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.R
 theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
     (listDecode (l.bind fun φ => φ.2.listEncode)).1 = l.headI := by
   suffices h : ∀ (φ : Σn, L.BoundedFormula α n) (l),
-      (listDecode (listEncode φ.2 ++ l)).1 = φ ∧ (listDecode (listEncode φ.2 ++ l)).2.1 = l
-  · induction' l with φ l _
+      (listDecode (listEncode φ.2 ++ l)).1 = φ ∧ (listDecode (listEncode φ.2 ++ l)).2.1 = l by
+    induction' l with φ l _
     · rw [List.nil_bind]
       simp [listDecode]
     · rw [cons_bind, (h φ _).1, headI_cons]
-  · rintro ⟨n, φ⟩
-    induction' φ with _ _ _ _ φ_n φ_l φ_R ts _ _ _ ih1 ih2 _ _ ih <;> intro l
-    · rw [listEncode, singleton_append, listDecode]
-      simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
-    · rw [listEncode, cons_append, cons_append, listDecode, dif_pos]
-      · simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append]
-      · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
-    · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode]
-      · have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft? (List.map (fun i : Fin φ_l =>
-          Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
-            Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by
-          intro i
-          simp only [Option.join, map_append, map_map, Option.bind_eq_some, id.def, exists_eq_right,
-            get?_eq_some, length_append, length_map, length_finRange]
-          refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
-          rw [get_append, get_map]
-          · simp only [Sum.getLeft?, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true,
-              heq_iff_eq, and_self_iff]
-          · simp only [length_map, length_finRange, is_lt]
-        rw [dif_pos]
-        swap
-        · exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩
-        rw [dif_pos]
-        swap
-        · intro i
-          obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
-          rw [h2]
-        simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and]
-        refine' ⟨funext fun i => _, _⟩
-        · obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
-          rw [eq_mp_eq_cast, cast_eq_iff_heq]
-          exact (Sigma.ext_iff.1 ((Sigma.eta (Option.get _ h1)).trans h2)).2
-        rw [List.drop_append_eq_append_drop, length_map, length_finRange, Nat.sub_self, drop,
-          drop_eq_nil_of_le, nil_append]
-        rw [length_map, length_finRange]
-    · rw [listEncode, List.append_assoc, cons_append, listDecode]
-      simp only [] at *
-      rw [(ih1 _).1, (ih1 _).2, (ih2 _).1, (ih2 _).2, sigmaImp]
-      simp only [dite_true]
-      exact ⟨rfl, trivial⟩
-    · rw [listEncode, cons_append, listDecode]
-      simp only
-      simp only [] at *
-      rw [(ih _).1, (ih _).2, sigmaAll]
-      exact ⟨rfl, rfl⟩
+  rintro ⟨n, φ⟩
+  induction' φ with _ _ _ _ φ_n φ_l φ_R ts _ _ _ ih1 ih2 _ _ ih <;> intro l
+  · rw [listEncode, singleton_append, listDecode]
+    simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
+  · rw [listEncode, cons_append, cons_append, listDecode, dif_pos]
+    · simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append]
+    · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
+  · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode]
+    · have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft? (List.map (fun i : Fin φ_l =>
+        Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
+          Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by
+        intro i
+        simp only [Option.join, map_append, map_map, Option.bind_eq_some, id.def, exists_eq_right,
+          get?_eq_some, length_append, length_map, length_finRange]
+        refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
+        rw [get_append, get_map]
+        · simp only [Sum.getLeft?, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true,
+            heq_iff_eq, and_self_iff]
+        · simp only [length_map, length_finRange, is_lt]
+      rw [dif_pos]
+      swap
+      · exact fun i => Option.isSome_iff_exists.2 ⟨⟨_, ts i⟩, h i⟩
+      rw [dif_pos]
+      swap
+      · intro i
+        obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
+        rw [h2]
+      simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and]
+      refine' ⟨funext fun i => _, _⟩
+      · obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
+        rw [eq_mp_eq_cast, cast_eq_iff_heq]
+        exact (Sigma.ext_iff.1 ((Sigma.eta (Option.get _ h1)).trans h2)).2
+      rw [List.drop_append_eq_append_drop, length_map, length_finRange, Nat.sub_self, drop,
+        drop_eq_nil_of_le, nil_append]
+      rw [length_map, length_finRange]
+  · rw [listEncode, List.append_assoc, cons_append, listDecode]
+    simp only [] at *
+    rw [(ih1 _).1, (ih1 _).2, (ih2 _).1, (ih2 _).2, sigmaImp]
+    simp only [dite_true]
+    exact ⟨rfl, trivial⟩
+  · rw [listEncode, cons_append, listDecode]
+    simp only
+    simp only [] at *
+    rw [(ih _).1, (ih _).2, sigmaAll]
+    exact ⟨rfl, rfl⟩
 #align first_order.language.bounded_formula.list_decode_encode_list FirstOrder.Language.BoundedFormula.listDecode_encode_list
 
 /-- An encoding of bounded formulas as lists. -/
fix(Data/Sum/Basic): Add ? to Sum-get function names. (#6665)

As the getLeft and getRight functions are to Option, they should have a ? on the end.

Diff
@@ -208,7 +208,7 @@ def listDecode : ∀ l : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.R
       simp only [SizeOf.sizeOf, List._sizeOf_1, ← add_assoc]
       exact le_max_of_le_right le_add_self⟩
   | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l =>
-    ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft).get? i).join.isSome then
+    ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft?).get? i).join.isSome then
         if h' : ∀ i, (Option.get _ (h i)).1 = k then
           ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get _ (h i)).2⟩
         else default
@@ -250,7 +250,7 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
       · simp only [eq_mp_eq_cast, cast_eq, eq_self_iff_true, heq_iff_eq, and_self_iff, nil_append]
       · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
     · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode]
-      · have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft (List.map (fun i : Fin φ_l =>
+      · have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft? (List.map (fun i : Fin φ_l =>
           Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
             Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by
           intro i
@@ -258,7 +258,7 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
             get?_eq_some, length_append, length_map, length_finRange]
           refine' ⟨lt_of_lt_of_le i.2 le_self_add, _⟩
           rw [get_append, get_map]
-          · simp only [Sum.getLeft, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true,
+          · simp only [Sum.getLeft?, get_finRange, Fin.eta, Function.comp_apply, eq_self_iff_true,
               heq_iff_eq, and_self_iff]
           · simp only [length_map, length_finRange, is_lt]
         rw [dif_pos]
chore: banish Type _ and Sort _ (#6499)

We remove all possible occurences of Type _ and Sort _ in favor of Type* and Sort*.

This has nice performance benefits.

Diff
@@ -39,7 +39,7 @@ namespace Language
 
 variable {L : Language.{u, v}}
 
-variable {M : Type w} {N P : Type _} [L.Structure M] [L.Structure N] [L.Structure P]
+variable {M : Type w} {N P : Type*} [L.Structure M] [L.Structure N] [L.Structure P]
 
 variable {α : Type u'} {β : Type v'}
 
chore: script to replace headers with #align_import statements (#5979)

Open in Gitpod

Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -2,17 +2,14 @@
 Copyright (c) 2022 Aaron Anderson. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Aaron Anderson
-
-! This file was ported from Lean 3 source module model_theory.encoding
-! leanprover-community/mathlib commit 91288e351d51b3f0748f0a38faa7613fb0ae2ada
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Computability.Encoding
 import Mathlib.Logic.Small.List
 import Mathlib.ModelTheory.Syntax
 import Mathlib.SetTheory.Cardinal.Ordinal
 
+#align_import model_theory.encoding from "leanprover-community/mathlib"@"91288e351d51b3f0748f0a38faa7613fb0ae2ada"
+
 /-! # Encodings and Cardinality of First-Order Syntax
 
 ## Main Definitions
fix: precedence of # (#5623)
Diff
@@ -24,7 +24,7 @@ import Mathlib.SetTheory.Cardinal.Ordinal
 `max ℵ₀ # (α ⊕ Σ i, L.Functions i)`.
 * `FirstOrder.Language.BoundedFormula.card_le` shows that the number of bounded formulas in
 `Σ n, L.BoundedFormula α n` is at most
-`max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card)`.
+`max ℵ₀ (Cardinal.lift.{max u v} #α + Cardinal.lift.{u'} L.card)`.
 
 ## TODO
 * `Primcodable` instances for terms and formulas, based on the `encoding`s
@@ -120,11 +120,11 @@ theorem listEncode_injective :
   Term.encoding.encode_injective
 #align first_order.language.term.list_encode_injective FirstOrder.Language.Term.listEncode_injective
 
-theorem card_le : (#L.Term α) ≤ max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
+theorem card_le : #(L.Term α) ≤ max ℵ₀ #(Sum α (Σi, L.Functions i)) :=
   lift_le.1 (_root_.trans Term.encoding.card_le_card_list (lift_le.2 (mk_list_le_max _)))
 #align first_order.language.term.card_le FirstOrder.Language.Term.card_le
 
-theorem card_sigma : (#Σn, L.Term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi, L.Functions i)) := by
+theorem card_sigma : #(Σn, L.Term (Sum α (Fin n))) = max ℵ₀ #(Sum α (Σi, L.Functions i)) := by
   refine' le_antisymm _ _
   · rw [mk_sigma]
     refine' (sum_le_iSup_lift _).trans _
@@ -132,7 +132,7 @@ theorem card_sigma : (#Σn, L.Term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi,
       ciSup_le_iff' (bddAbove_range _)]
     · refine' ⟨le_max_left _ _, fun i => card_le.trans _⟩
       refine' max_le (le_max_left _ _) _
-      rw [← add_eq_max le_rfl, mk_sum, mk_sum, mk_sum, add_comm (Cardinal.lift (#α)), lift_add,
+      rw [← add_eq_max le_rfl, mk_sum, mk_sum, mk_sum, add_comm (Cardinal.lift #α), lift_add,
         add_assoc, lift_lift, lift_lift, mk_fin, lift_natCast]
       exact add_le_add_right (nat_lt_aleph0 _).le _
     · rw [← one_le_iff_ne_zero]
@@ -311,8 +311,8 @@ theorem listEncode_sigma_injective :
   BoundedFormula.encoding.encode_injective
 #align first_order.language.bounded_formula.list_encode_sigma_injective FirstOrder.Language.BoundedFormula.listEncode_sigma_injective
 
-theorem card_le : (#Σn, L.BoundedFormula α n) ≤
-    max ℵ₀ (Cardinal.lift.{max u v} (#α) + Cardinal.lift.{u'} L.card) := by
+theorem card_le : #(Σn, L.BoundedFormula α n) ≤
+    max ℵ₀ (Cardinal.lift.{max u v} #α + Cardinal.lift.{u'} L.card) := by
   refine' lift_le.1 (BoundedFormula.encoding.card_le_card_list.trans _)
   rw [encoding_Γ, mk_list_eq_max_mk_aleph0, lift_max, lift_aleph0, lift_max, lift_aleph0,
     max_le_iff]
chore: Rename to sSup/iSup (#3938)

As discussed on Zulip

Renames

  • supₛsSup
  • infₛsInf
  • supᵢiSup
  • infᵢiInf
  • bsupₛbsSup
  • binfₛbsInf
  • bsupᵢbiSup
  • binfᵢbiInf
  • csupₛcsSup
  • cinfₛcsInf
  • csupᵢciSup
  • cinfᵢciInf
  • unionₛsUnion
  • interₛsInter
  • unionᵢiUnion
  • interᵢiInter
  • bunionₛbsUnion
  • binterₛbsInter
  • bunionᵢbiUnion
  • binterᵢbiInter

Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -127,16 +127,16 @@ theorem card_le : (#L.Term α) ≤ max ℵ₀ (#Sum α (Σi, L.Functions i)) :=
 theorem card_sigma : (#Σn, L.Term (Sum α (Fin n))) = max ℵ₀ (#Sum α (Σi, L.Functions i)) := by
   refine' le_antisymm _ _
   · rw [mk_sigma]
-    refine' (sum_le_supᵢ_lift _).trans _
+    refine' (sum_le_iSup_lift _).trans _
     rw [mk_nat, lift_aleph0, mul_eq_max_of_aleph0_le_left le_rfl, max_le_iff,
-      csupᵢ_le_iff' (bddAbove_range _)]
+      ciSup_le_iff' (bddAbove_range _)]
     · refine' ⟨le_max_left _ _, fun i => card_le.trans _⟩
       refine' max_le (le_max_left _ _) _
       rw [← add_eq_max le_rfl, mk_sum, mk_sum, mk_sum, add_comm (Cardinal.lift (#α)), lift_add,
         add_assoc, lift_lift, lift_lift, mk_fin, lift_natCast]
       exact add_le_add_right (nat_lt_aleph0 _).le _
     · rw [← one_le_iff_ne_zero]
-      refine' _root_.trans _ (le_csupᵢ (bddAbove_range _) 1)
+      refine' _root_.trans _ (le_ciSup (bddAbove_range _) 1)
       rw [one_le_iff_ne_zero, mk_ne_zero_iff]
       exact ⟨var (Sum.inr 0)⟩
   · rw [max_le_iff, ← infinite_iff]
chore: tidy various files (#3530)
Diff
@@ -180,7 +180,7 @@ def listEncode : ∀ {n : ℕ},
     L.BoundedFormula α n → List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.Relations n) ℕ))
   | n, falsum => [Sum.inr (Sum.inr (n + 2))]
   | _, equal t₁ t₂ => [Sum.inl ⟨_, t₁⟩, Sum.inl ⟨_, t₂⟩]
-  | n, Rel R ts => [Sum.inr (Sum.inl ⟨_, R⟩), Sum.inr (Sum.inr n)] ++
+  | n, rel R ts => [Sum.inr (Sum.inl ⟨_, R⟩), Sum.inr (Sum.inr n)] ++
       (List.finRange _).map fun i => Sum.inl ⟨n, ts i⟩
   | _, imp φ₁ φ₂ => (Sum.inr (Sum.inr 0)::φ₁.listEncode) ++ φ₂.listEncode
   | _, all φ => Sum.inr (Sum.inr 1)::φ.listEncode
@@ -213,7 +213,7 @@ def listDecode : ∀ l : List (Sum (Σk, L.Term (Sum α (Fin k))) (Sum (Σn, L.R
   | Sum.inr (Sum.inl ⟨n, R⟩)::Sum.inr (Sum.inr k)::l =>
     ⟨if h : ∀ i : Fin n, ((l.map Sum.getLeft).get? i).join.isSome then
         if h' : ∀ i, (Option.get _ (h i)).1 = k then
-          ⟨k, BoundedFormula.Rel R fun i => Eq.mp (by rw [h' i]) (Option.get _ (h i)).2⟩
+          ⟨k, BoundedFormula.rel R fun i => Eq.mp (by rw [h' i]) (Option.get _ (h i)).2⟩
         else default
       else default,
       l.drop n, le_max_of_le_right (le_add_left (le_add_left (List.drop_sizeOf_le _ _)))⟩
@@ -254,7 +254,7 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
       · simp only [eq_self_iff_true, heq_iff_eq, and_self_iff]
     · rw [listEncode, cons_append, cons_append, singleton_append, cons_append, listDecode]
       · have h : ∀ i : Fin φ_l, ((List.map Sum.getLeft (List.map (fun i : Fin φ_l =>
-          Sum.inl (⟨(⟨φ_n, Rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
+          Sum.inl (⟨(⟨φ_n, rel φ_R ts⟩ : Σn, L.BoundedFormula α n).fst, ts i⟩ :
             Σn, L.Term (Sum α (Fin n)))) (finRange φ_l) ++ l)).get? ↑i).join = some ⟨_, ts i⟩ := by
           intro i
           simp only [Option.join, map_append, map_map, Option.bind_eq_some, id.def, exists_eq_right,
@@ -272,7 +272,7 @@ theorem listDecode_encode_list (l : List (Σn, L.BoundedFormula α n)) :
         · intro i
           obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
           rw [h2]
-        simp only [Sigma.mk.inj_iff, heq_eq_eq, Rel.injEq, true_and]
+        simp only [Sigma.mk.inj_iff, heq_eq_eq, rel.injEq, true_and]
         refine' ⟨funext fun i => _, _⟩
         · obtain ⟨h1, h2⟩ := Option.eq_some_iff_get_eq.1 (h i)
           rw [eq_mp_eq_cast, cast_eq_iff_heq]
chore: bump std4 (#3529)
Diff
@@ -59,7 +59,6 @@ def listEncode : L.Term α → List (Sum α (Σi, L.Functions i))
     Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode
 #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode
 
-set_option compiler.extract_closed false in -- https://github.com/leanprover/lean4/issues/1965
 /-- Decodes a list of variables and function symbols as a list of terms. -/
 def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α))
   | [] => []
fix: disable unsafe closed term extraction (#3509)

The compiler extracts the closed term Option.get none ◾ here, which causes a segfault in compiled code depending on mathlib, like e.g. mathport.

Diff
@@ -59,6 +59,7 @@ def listEncode : L.Term α → List (Sum α (Σi, L.Functions i))
     Sum.inr (⟨_, f⟩ : Σi, L.Functions i)::(List.finRange _).bind fun i => (ts i).listEncode
 #align first_order.language.term.list_encode FirstOrder.Language.Term.listEncode
 
+set_option compiler.extract_closed false in -- https://github.com/leanprover/lean4/issues/1965
 /-- Decodes a list of variables and function symbols as a list of terms. -/
 def listDecode : List (Sum α (Σi, L.Functions i)) → List (Option (L.Term α))
   | [] => []
feat: port ModelTheory.Encoding (#3494)

Dependencies 8 + 359

360 files ported (97.8%)
148240 lines ported (97.9%)
Show graph

The unported dependencies are