combinatorics.colexMathlib.Combinatorics.Colex

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)

(last sync)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -185,14 +185,14 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
       specialize z t
       by_contra h₂
       simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm'] at h₂
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm] at h₂
       apply not_le_of_lt th (z h₂)
     · left
       refine' ⟨k, fun t th => _, hk.2, hk.1⟩
       specialize z t
       by_contra h₃
       simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm', or_comm'] at h₃
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm, or_comm] at h₃
       apply not_le_of_lt th (z h₃)
   rw [nonempty_iff_ne_empty]
   intro a
@@ -209,7 +209,7 @@ instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (
       (by
         rw [Colex.lt_def]
         apply exists_congr
-        simp only [mem_union, exists_prop, or_imp, and_comm' (_ ∈ B), and_assoc']
+        simp only [mem_union, exists_prop, or_imp, and_comm (_ ∈ B), and_assoc]
         intro k
         refine' and_congr_left' (forall_congr' _)
         tauto)
@@ -275,7 +275,7 @@ theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t
 theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r :=
   by
-  simp only [lt_def, mem_singleton, ← and_assoc', exists_eq_right]
+  simp only [lt_def, mem_singleton, ← and_assoc, exists_eq_right]
   constructor
   · intro t x hx
     rw [← not_le]
Diff
@@ -108,7 +108,7 @@ theorem Nat.geomSum_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A → x
   by
   apply lt_of_le_of_lt (sum_le_sum_of_subset fun t => mem_range.2 ∘ h₁)
   have z := geom_sum_mul_add 1 k
-  rw [mul_one, one_add_one_eq_two] at z 
+  rw [mul_one, one_add_one_eq_two] at z
   rw [← z]
   apply Nat.lt_succ_self
 #align nat.sum_two_pow_lt Nat.geomSum_lt
@@ -135,7 +135,7 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
       first
       | rwa [← z _]
       | rwa [z _]
-      rwa [StrictMono.lt_iff_lt h₁] at hx 
+      rwa [StrictMono.lt_iff_lt h₁] at hx
   · simp only [h₁.injective, Function.Injective.eq_iff]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
@@ -177,26 +177,26 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   by_cases h₁ : A = B
   · tauto
   rcases exists_max_image (A \ B ∪ B \ A) id _ with ⟨k, hk, z⟩
-  · simp only [mem_union, mem_sdiff] at hk 
+  · simp only [mem_union, mem_sdiff] at hk
     cases hk
     · right
       right
       refine' ⟨k, fun t th => _, hk.2, hk.1⟩
       specialize z t
       by_contra h₂
-      simp only [mem_union, mem_sdiff, id.def] at z 
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm'] at h₂ 
+      simp only [mem_union, mem_sdiff, id.def] at z
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm'] at h₂
       apply not_le_of_lt th (z h₂)
     · left
       refine' ⟨k, fun t th => _, hk.2, hk.1⟩
       specialize z t
       by_contra h₃
-      simp only [mem_union, mem_sdiff, id.def] at z 
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm', or_comm'] at h₃ 
+      simp only [mem_union, mem_sdiff, id.def] at z
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm', or_comm'] at h₃
       apply not_le_of_lt th (z h₃)
   rw [nonempty_iff_ne_empty]
   intro a
-  simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a 
+  simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a
   apply h₁ (subset.antisymm a.1 a.2)
 #align colex.lt_trichotomy Colex.lt_trichotomy
 
@@ -261,7 +261,7 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
     (h₁ : A.toColex < B.toColex) (h₂ : ∀ x ∈ B, x < t) : ∀ x ∈ A, x < t :=
   by
-  rw [Colex.lt_def] at h₁ 
+  rw [Colex.lt_def] at h₁
   rcases h₁ with ⟨k, z, _, _⟩
   intro x hx
   apply lt_of_not_ge
@@ -414,7 +414,7 @@ theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     apply lt_of_le_of_ne (le_of_not_lt fun kx => _)
     · apply ne_of_mem_of_not_mem hx kA
     have := (z kx).1 hx
-    rw [mem_sdiff] at this hx 
+    rw [mem_sdiff] at this hx
     exact hx.2 this.1
   refine'
     ⟨fun h => (lt_trichotomy A B).resolve_right fun h₁ => h₁.elim _ (not_lt_of_gt h ∘ z _ _), z A B⟩
Diff
@@ -70,21 +70,17 @@ deriving Inhabited
 #align finset.colex Finset.Colex
 -/
 
-#print Finset.toColex /-
 /-- A convenience constructor to turn a `finset α` into a `finset.colex α`, useful in order to
 use the colex ordering rather than the subset ordering.
 -/
 def Finset.toColex {α} (s : Finset α) : Finset.Colex α :=
   s
 #align finset.to_colex Finset.toColex
--/
 
-#print Colex.eq_iff /-
 @[simp]
 theorem Colex.eq_iff (A B : Finset α) : A.toColex = B.toColex ↔ A = B :=
   Iff.rfl
 #align colex.eq_iff Colex.eq_iff
--/
 
 /-- `A` is less than `B` in the colex ordering if the largest thing that's not in both sets is in B.
 In other words, `max (A ∆ B) ∈ B` (if the maximum exists).
@@ -96,36 +92,30 @@ instance [LT α] : LT (Finset.Colex α) :=
 instance [LT α] : LE (Finset.Colex α) :=
   ⟨fun A B => A < B ∨ A = B⟩
 
-#print Colex.lt_def /-
 theorem Colex.lt_def [LT α] (A B : Finset α) :
     A.toColex < B.toColex ↔ ∃ k, (∀ {x}, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A ∧ k ∈ B :=
   Iff.rfl
 #align colex.lt_def Colex.lt_def
--/
 
-#print Colex.le_def /-
 theorem Colex.le_def [LT α] (A B : Finset α) :
     A.toColex ≤ B.toColex ↔ A.toColex < B.toColex ∨ A = B :=
   Iff.rfl
 #align colex.le_def Colex.le_def
--/
 
-#print Nat.sum_two_pow_lt /-
+#print Nat.geomSum_lt /-
 /-- If everything in `A` is less than `k`, we can bound the sum of powers. -/
-theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A → x < k) :
-    A.Sum (pow 2) < 2 ^ k :=
+theorem Nat.geomSum_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A → x < k) : A.Sum (pow 2) < 2 ^ k :=
   by
   apply lt_of_le_of_lt (sum_le_sum_of_subset fun t => mem_range.2 ∘ h₁)
   have z := geom_sum_mul_add 1 k
   rw [mul_one, one_add_one_eq_two] at z 
   rw [← z]
   apply Nat.lt_succ_self
-#align nat.sum_two_pow_lt Nat.sum_two_pow_lt
+#align nat.sum_two_pow_lt Nat.geomSum_lt
 -/
 
 namespace Colex
 
-#print Colex.hom_lt_iff /-
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
     (h₁ : StrictMono f) (A B : Finset α) :
@@ -149,9 +139,7 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
   · simp only [h₁.injective, Function.Injective.eq_iff]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
--/
 
-#print Colex.hom_fin_lt_iff /-
 /-- A special case of `colex.hom_lt_iff` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -159,12 +147,10 @@ theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
       A.toColex < B.toColex :=
   Colex.hom_lt_iff (fun x y k => k) _ _
 #align colex.hom_fin_lt_iff Colex.hom_fin_lt_iff
--/
 
 instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
   ⟨fun A h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
 
-#print Colex.lt_trans /-
 @[trans]
 theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c → a < c :=
   by
@@ -177,19 +163,15 @@ theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c 
     rw [k₁z hx]
     apply k₂z (trans h hx)
 #align colex.lt_trans Colex.lt_trans
--/
 
-#print Colex.le_trans /-
 @[trans]
 theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤ c → a ≤ c := fun AB BC =>
   AB.elim (fun k => BC.elim (fun t => Or.inl (lt_trans k t)) fun t => t ▸ AB) fun k => k.symm ▸ BC
 #align colex.le_trans Colex.le_trans
--/
 
 instance [LinearOrder α] : IsTrans (Finset.Colex α) (· < ·) :=
   ⟨fun _ _ _ => Colex.lt_trans⟩
 
-#print Colex.lt_trichotomy /-
 theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B ∨ B < A :=
   by
   by_cases h₁ : A = B
@@ -217,12 +199,10 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a 
   apply h₁ (subset.antisymm a.1 a.2)
 #align colex.lt_trichotomy Colex.lt_trichotomy
--/
 
 instance [LinearOrder α] : IsTrichotomous (Finset.Colex α) (· < ·) :=
   ⟨lt_trichotomy⟩
 
-#print Colex.decidableLt /-
 instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (A < B) :=
   show ∀ A B : Finset α, Decidable (A.toColex < B.toColex) from fun A B =>
     decidable_of_iff' (∃ k ∈ B, (∀ x ∈ A ∪ B, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A)
@@ -234,7 +214,6 @@ instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (
         refine' and_congr_left' (forall_congr' _)
         tauto)
 #align colex.decidable_lt Colex.decidableLt
--/
 
 instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
   { Finset.Colex.hasLt,
@@ -263,15 +242,12 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
 example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
-#print Colex.hom_le_iff /-
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
--/
 
-#print Colex.hom_fin_le_iff /-
 /-- A special case of `colex_hom` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -279,9 +255,7 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
       A.toColex ≤ B.toColex :=
   Colex.hom_le_iff (fun x y k => k) _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
--/
 
-#print Colex.forall_lt_of_colex_lt_of_forall_lt /-
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
 -/
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
@@ -296,9 +270,7 @@ theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t
   rwa [← z]
   apply lt_of_lt_of_le (h₂ k ‹_›) a
 #align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_lt
--/
 
-#print Colex.lt_singleton_iff_mem_lt /-
 /-- `s.to_colex < {r}.to_colex` iff all elements of `s` are less than `r`. -/
 theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r :=
@@ -315,33 +287,25 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     exact fun h =>
       ⟨fun z hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩, by simpa using h r⟩
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
--/
 
-#print Colex.mem_le_of_singleton_le /-
 /-- If {r} is less than or equal to s in the colexicographical sense,
   then s contains an element greater than or equal to r. -/
 theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
     ({r} : Finset α).toColex ≤ s.toColex ↔ ∃ x ∈ s, r ≤ x := by rw [← not_lt];
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
--/
 
-#print Colex.singleton_lt_iff_lt /-
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_lt_iff_lt [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex < ({s} : Finset α).toColex ↔ r < s := by simp [lt_singleton_iff_mem_lt]
 #align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_lt
--/
 
-#print Colex.singleton_le_iff_le /-
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_le_iff_le [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex ≤ ({s} : Finset α).toColex ↔ r ≤ s := by
   rw [le_iff_le_iff_lt_iff_lt, singleton_lt_iff_lt]
 #align colex.singleton_le_iff_le Colex.singleton_le_iff_le
--/
 
-#print Colex.sdiff_lt_sdiff_iff_lt /-
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
@@ -362,18 +326,14 @@ theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
     intro x hx
     rw [z hx]
 #align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
--/
 
-#print Colex.sdiff_le_sdiff_iff_le /-
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
     (A \ B).toColex ≤ (B \ A).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
 #align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
--/
 
-#print Colex.empty_toColex_lt /-
 theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
     (∅ : Finset α).toColex < A.toColex :=
   by
@@ -383,19 +343,15 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
   intro x hx t
   apply not_le_of_lt hx (le_max' _ _ t)
 #align colex.empty_to_colex_lt Colex.empty_toColex_lt
--/
 
-#print Colex.colex_lt_of_ssubset /-
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
-theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
+theorem colex_lt_of_sSubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
   by
   rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
   exact empty_to_colex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
-#align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
--/
+#align colex.colex_lt_of_ssubset Colex.colex_lt_of_sSubset
 
-#print Colex.empty_toColex_le /-
 @[simp]
 theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex :=
   by
@@ -403,9 +359,7 @@ theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).to
   · simp
   · apply (empty_to_colex_lt hA).le
 #align colex.empty_to_colex_le Colex.empty_toColex_le
--/
 
-#print Colex.colex_le_of_subset /-
 /-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
 linear order. -/
 theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.toColex ≤ B.toColex :=
@@ -413,9 +367,7 @@ theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.
   rw [← sdiff_le_sdiff_iff_le, sdiff_eq_empty_iff_subset.2 h]
   apply empty_to_colex_le
 #align colex.colex_le_of_subset Colex.colex_le_of_subset
--/
 
-#print Colex.toColexRelHom /-
 /-- The function from finsets to finsets with the colex order is a relation homomorphism. -/
 @[simps]
 def toColexRelHom [LinearOrder α] :
@@ -424,7 +376,6 @@ def toColexRelHom [LinearOrder α] :
   toFun := Finset.toColex
   map_rel' A B := colex_le_of_subset
 #align colex.to_colex_rel_hom Colex.toColexRelHom
--/
 
 instance [LinearOrder α] : OrderBot (Finset.Colex α)
     where
@@ -444,7 +395,6 @@ instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
   { (by infer_instance : OrderTop (Finset.Colex α)),
     (by infer_instance : OrderBot (Finset.Colex α)) with }
 
-#print Colex.sum_two_pow_lt_iff_lt /-
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i ↔ A.toColex < B.toColex :=
@@ -458,7 +408,7 @@ theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     conv_rhs => rw [← sdiff_union_inter B A]
     rw [sum_union (disjoint_sdiff_inter _ _), sum_union (disjoint_sdiff_inter _ _), inter_comm,
       add_lt_add_iff_right]
-    apply lt_of_lt_of_le (@Nat.sum_two_pow_lt k (A \ B) _)
+    apply lt_of_lt_of_le (@Nat.geomSum_lt k (A \ B) _)
     · apply single_le_sum (fun _ _ => Nat.zero_le _) kB
     intro x hx
     apply lt_of_le_of_ne (le_of_not_lt fun kx => _)
@@ -471,15 +421,12 @@ theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
   rintro rfl
   apply irrefl _ h
 #align colex.sum_two_pow_lt_iff_lt Colex.sum_two_pow_lt_iff_lt
--/
 
-#print Colex.sum_two_pow_le_iff_lt /-
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_le_iff_lt (A B : Finset ℕ) :
     ∑ i in A, 2 ^ i ≤ ∑ i in B, 2 ^ i ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sum_two_pow_lt_iff_lt]
 #align colex.sum_two_pow_le_iff_lt Colex.sum_two_pow_le_iff_lt
--/
 
 end Colex
 
Diff
@@ -3,8 +3,8 @@ Copyright (c) 2020 Bhavik Mehta. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Bhavik Mehta, Alena Gusakov
 -/
-import Mathbin.Data.Fintype.Basic
-import Mathbin.Algebra.GeomSum
+import Data.Fintype.Basic
+import Algebra.GeomSum
 
 #align_import combinatorics.colex from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
 
Diff
@@ -2,15 +2,12 @@
 Copyright (c) 2020 Bhavik Mehta. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Bhavik Mehta, Alena Gusakov
-
-! This file was ported from Lean 3 source module combinatorics.colex
-! leanprover-community/mathlib commit 0a0ec35061ed9960bf0e7ffb0335f44447b58977
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Fintype.Basic
 import Mathbin.Algebra.GeomSum
 
+#align_import combinatorics.colex from "leanprover-community/mathlib"@"0a0ec35061ed9960bf0e7ffb0335f44447b58977"
+
 /-!
 # Colex
 
Diff
@@ -154,6 +154,7 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
 #align colex.hom_lt_iff Colex.hom_lt_iff
 -/
 
+#print Colex.hom_fin_lt_iff /-
 /-- A special case of `colex.hom_lt_iff` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -161,6 +162,7 @@ theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
       A.toColex < B.toColex :=
   Colex.hom_lt_iff (fun x y k => k) _ _
 #align colex.hom_fin_lt_iff Colex.hom_fin_lt_iff
+-/
 
 instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
   ⟨fun A h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
@@ -272,6 +274,7 @@ theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → 
 #align colex.hom_le_iff Colex.hom_le_iff
 -/
 
+#print Colex.hom_fin_le_iff /-
 /-- A special case of `colex_hom` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -279,6 +282,7 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
       A.toColex ≤ B.toColex :=
   Colex.hom_le_iff (fun x y k => k) _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
+-/
 
 #print Colex.forall_lt_of_colex_lt_of_forall_lt /-
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
@@ -316,12 +320,14 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
 -/
 
+#print Colex.mem_le_of_singleton_le /-
 /-- If {r} is less than or equal to s in the colexicographical sense,
   then s contains an element greater than or equal to r. -/
 theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
     ({r} : Finset α).toColex ≤ s.toColex ↔ ∃ x ∈ s, r ≤ x := by rw [← not_lt];
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
+-/
 
 #print Colex.singleton_lt_iff_lt /-
 /-- Colex is an extension of the base ordering on α. -/
Diff
@@ -444,9 +444,9 @@ instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
 #print Colex.sum_two_pow_lt_iff_lt /-
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
-    ((∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i) ↔ A.toColex < B.toColex :=
+    ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i ↔ A.toColex < B.toColex :=
   by
-  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → (∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i :=
+  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i :=
     by
     intro A B
     rw [← sdiff_lt_sdiff_iff_lt, Colex.lt_def]
@@ -473,7 +473,7 @@ theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
 #print Colex.sum_two_pow_le_iff_lt /-
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_le_iff_lt (A B : Finset ℕ) :
-    ((∑ i in A, 2 ^ i) ≤ ∑ i in B, 2 ^ i) ↔ A.toColex ≤ B.toColex := by
+    ∑ i in A, 2 ^ i ≤ ∑ i in B, 2 ^ i ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sum_two_pow_lt_iff_lt]
 #align colex.sum_two_pow_le_iff_lt Colex.sum_two_pow_le_iff_lt
 -/
Diff
@@ -68,7 +68,8 @@ open scoped BigOperators
 rather than the natural subset ordering.
 -/
 def Finset.Colex (α) :=
-  Finset α deriving Inhabited
+  Finset α
+deriving Inhabited
 #align finset.colex Finset.Colex
 -/
 
@@ -119,7 +120,7 @@ theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A 
   by
   apply lt_of_le_of_lt (sum_le_sum_of_subset fun t => mem_range.2 ∘ h₁)
   have z := geom_sum_mul_add 1 k
-  rw [mul_one, one_add_one_eq_two] at z
+  rw [mul_one, one_add_one_eq_two] at z 
   rw [← z]
   apply Nat.lt_succ_self
 #align nat.sum_two_pow_lt Nat.sum_two_pow_lt
@@ -144,8 +145,10 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
     any_goals
       rintro ⟨x', hx', rfl⟩
       refine' ⟨x', _, rfl⟩
-      first |rwa [← z _]|rwa [z _]
-      rwa [StrictMono.lt_iff_lt h₁] at hx
+      first
+      | rwa [← z _]
+      | rwa [z _]
+      rwa [StrictMono.lt_iff_lt h₁] at hx 
   · simp only [h₁.injective, Function.Injective.eq_iff]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
@@ -193,26 +196,26 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   by_cases h₁ : A = B
   · tauto
   rcases exists_max_image (A \ B ∪ B \ A) id _ with ⟨k, hk, z⟩
-  · simp only [mem_union, mem_sdiff] at hk
+  · simp only [mem_union, mem_sdiff] at hk 
     cases hk
     · right
       right
       refine' ⟨k, fun t th => _, hk.2, hk.1⟩
       specialize z t
       by_contra h₂
-      simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm'] at h₂
+      simp only [mem_union, mem_sdiff, id.def] at z 
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm'] at h₂ 
       apply not_le_of_lt th (z h₂)
     · left
       refine' ⟨k, fun t th => _, hk.2, hk.1⟩
       specialize z t
       by_contra h₃
-      simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm', or_comm'] at h₃
+      simp only [mem_union, mem_sdiff, id.def] at z 
+      rw [not_iff, iff_iff_and_or_not_and_not, Classical.not_not, and_comm', or_comm'] at h₃ 
       apply not_le_of_lt th (z h₃)
   rw [nonempty_iff_ne_empty]
   intro a
-  simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a
+  simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a 
   apply h₁ (subset.antisymm a.1 a.2)
 #align colex.lt_trichotomy Colex.lt_trichotomy
 -/
@@ -283,7 +286,7 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
     (h₁ : A.toColex < B.toColex) (h₂ : ∀ x ∈ B, x < t) : ∀ x ∈ A, x < t :=
   by
-  rw [Colex.lt_def] at h₁
+  rw [Colex.lt_def] at h₁ 
   rcases h₁ with ⟨k, z, _, _⟩
   intro x hx
   apply lt_of_not_ge
@@ -458,7 +461,7 @@ theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     apply lt_of_le_of_ne (le_of_not_lt fun kx => _)
     · apply ne_of_mem_of_not_mem hx kA
     have := (z kx).1 hx
-    rw [mem_sdiff] at this hx
+    rw [mem_sdiff] at this hx 
     exact hx.2 this.1
   refine'
     ⟨fun h => (lt_trichotomy A B).resolve_right fun h₁ => h₁.elim _ (not_lt_of_gt h ∘ z _ _), z A B⟩
Diff
@@ -61,7 +61,7 @@ variable {α : Type _}
 
 open Finset
 
-open BigOperators
+open scoped BigOperators
 
 #print Finset.Colex /-
 /-- We define this type synonym to refer to the colexicographic ordering on finsets
@@ -127,6 +127,7 @@ theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A 
 
 namespace Colex
 
+#print Colex.hom_lt_iff /-
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
     (h₁ : StrictMono f) (A B : Finset α) :
@@ -148,6 +149,7 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
   · simp only [h₁.injective, Function.Injective.eq_iff]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
+-/
 
 /-- A special case of `colex.hom_lt_iff` which is sometimes useful. -/
 @[simp]
@@ -160,6 +162,7 @@ theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
 instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
   ⟨fun A h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
 
+#print Colex.lt_trans /-
 @[trans]
 theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c → a < c :=
   by
@@ -172,15 +175,19 @@ theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c 
     rw [k₁z hx]
     apply k₂z (trans h hx)
 #align colex.lt_trans Colex.lt_trans
+-/
 
+#print Colex.le_trans /-
 @[trans]
 theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤ c → a ≤ c := fun AB BC =>
   AB.elim (fun k => BC.elim (fun t => Or.inl (lt_trans k t)) fun t => t ▸ AB) fun k => k.symm ▸ BC
 #align colex.le_trans Colex.le_trans
+-/
 
 instance [LinearOrder α] : IsTrans (Finset.Colex α) (· < ·) :=
   ⟨fun _ _ _ => Colex.lt_trans⟩
 
+#print Colex.lt_trichotomy /-
 theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B ∨ B < A :=
   by
   by_cases h₁ : A = B
@@ -208,10 +215,12 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a
   apply h₁ (subset.antisymm a.1 a.2)
 #align colex.lt_trichotomy Colex.lt_trichotomy
+-/
 
 instance [LinearOrder α] : IsTrichotomous (Finset.Colex α) (· < ·) :=
   ⟨lt_trichotomy⟩
 
+#print Colex.decidableLt /-
 instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (A < B) :=
   show ∀ A B : Finset α, Decidable (A.toColex < B.toColex) from fun A B =>
     decidable_of_iff' (∃ k ∈ B, (∀ x ∈ A ∪ B, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A)
@@ -223,6 +232,7 @@ instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (
         refine' and_congr_left' (forall_congr' _)
         tauto)
 #align colex.decidable_lt Colex.decidableLt
+-/
 
 instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
   { Finset.Colex.hasLt,
@@ -251,11 +261,13 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
 example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
+#print Colex.hom_le_iff /-
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
+-/
 
 /-- A special case of `colex_hom` which is sometimes useful. -/
 @[simp]
@@ -265,6 +277,7 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
   Colex.hom_le_iff (fun x y k => k) _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
 
+#print Colex.forall_lt_of_colex_lt_of_forall_lt /-
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
 -/
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
@@ -279,7 +292,9 @@ theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t
   rwa [← z]
   apply lt_of_lt_of_le (h₂ k ‹_›) a
 #align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_lt
+-/
 
+#print Colex.lt_singleton_iff_mem_lt /-
 /-- `s.to_colex < {r}.to_colex` iff all elements of `s` are less than `r`. -/
 theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r :=
@@ -296,6 +311,7 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     exact fun h =>
       ⟨fun z hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩, by simpa using h r⟩
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
+-/
 
 /-- If {r} is less than or equal to s in the colexicographical sense,
   then s contains an element greater than or equal to r. -/
@@ -304,16 +320,20 @@ theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
 
+#print Colex.singleton_lt_iff_lt /-
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_lt_iff_lt [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex < ({s} : Finset α).toColex ↔ r < s := by simp [lt_singleton_iff_mem_lt]
 #align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_lt
+-/
 
+#print Colex.singleton_le_iff_le /-
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_le_iff_le [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex ≤ ({s} : Finset α).toColex ↔ r ≤ s := by
   rw [le_iff_le_iff_lt_iff_lt, singleton_lt_iff_lt]
 #align colex.singleton_le_iff_le Colex.singleton_le_iff_le
+-/
 
 #print Colex.sdiff_lt_sdiff_iff_lt /-
 /-- Colex doesn't care if you remove the other set -/
@@ -338,13 +358,16 @@ theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
 #align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
 -/
 
+#print Colex.sdiff_le_sdiff_iff_le /-
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
     (A \ B).toColex ≤ (B \ A).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
 #align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
+-/
 
+#print Colex.empty_toColex_lt /-
 theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
     (∅ : Finset α).toColex < A.toColex :=
   by
@@ -354,7 +377,9 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
   intro x hx t
   apply not_le_of_lt hx (le_max' _ _ t)
 #align colex.empty_to_colex_lt Colex.empty_toColex_lt
+-/
 
+#print Colex.colex_lt_of_ssubset /-
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
 theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
@@ -362,7 +387,9 @@ theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A
   rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
   exact empty_to_colex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
 #align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
+-/
 
+#print Colex.empty_toColex_le /-
 @[simp]
 theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex :=
   by
@@ -370,7 +397,9 @@ theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).to
   · simp
   · apply (empty_to_colex_lt hA).le
 #align colex.empty_to_colex_le Colex.empty_toColex_le
+-/
 
+#print Colex.colex_le_of_subset /-
 /-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
 linear order. -/
 theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.toColex ≤ B.toColex :=
@@ -378,7 +407,9 @@ theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.
   rw [← sdiff_le_sdiff_iff_le, sdiff_eq_empty_iff_subset.2 h]
   apply empty_to_colex_le
 #align colex.colex_le_of_subset Colex.colex_le_of_subset
+-/
 
+#print Colex.toColexRelHom /-
 /-- The function from finsets to finsets with the colex order is a relation homomorphism. -/
 @[simps]
 def toColexRelHom [LinearOrder α] :
@@ -387,6 +418,7 @@ def toColexRelHom [LinearOrder α] :
   toFun := Finset.toColex
   map_rel' A B := colex_le_of_subset
 #align colex.to_colex_rel_hom Colex.toColexRelHom
+-/
 
 instance [LinearOrder α] : OrderBot (Finset.Colex α)
     where
Diff
@@ -127,12 +127,6 @@ theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A 
 
 namespace Colex
 
-/- warning: colex.hom_lt_iff -> Colex.hom_lt_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Preorder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) _inst_3 f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LT.lt.{u2} (Finset.Colex.{u2} β) (Finset.Colex.hasLt.{u2} β (Preorder.toHasLt.{u2} β _inst_3)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f B))) (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Preorder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) _inst_3 f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LT.lt.{u2} (Finset.Colex.{u2} β) (instLTColex.{u2} β (Preorder.toLT.{u2} β _inst_3)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f B))) (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-Case conversion may be inaccurate. Consider using '#align colex.hom_lt_iff Colex.hom_lt_iffₓ'. -/
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
     (h₁ : StrictMono f) (A B : Finset α) :
@@ -155,12 +149,6 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
 
-/- warning: colex.hom_fin_lt_iff -> Colex.hom_fin_lt_iff is a dubious translation:
-lean 3 declaration is
-  forall {n : Nat} (A : Finset.{0} (Fin n)) (B : Finset.{0} (Fin n)), Iff (LT.lt.{0} (Finset.Colex.{0} Nat) (Finset.Colex.hasLt.{0} Nat Nat.hasLt) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => Nat.decidableEq a b) (fun (i : Fin n) => (fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) i) A)) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => Nat.decidableEq a b) (fun (i : Fin n) => (fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) i) B))) (LT.lt.{0} (Finset.Colex.{0} (Fin n)) (Finset.Colex.hasLt.{0} (Fin n) (Fin.hasLt n)) (Finset.toColex.{0} (Fin n) A) (Finset.toColex.{0} (Fin n) B))
-but is expected to have type
-  forall {n : Nat} (A : Finset.{0} (Fin n)) (B : Finset.{0} (Fin n)), Iff (LT.lt.{0} (Finset.Colex.{0} Nat) (instLTColex.{0} Nat instLTNat) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => instDecidableEqNat a b) (fun (i : Fin n) => Fin.val n i) A)) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => instDecidableEqNat a b) (fun (i : Fin n) => Fin.val n i) B))) (LT.lt.{0} (Finset.Colex.{0} (Fin n)) (instLTColex.{0} (Fin n) (instLTFin n)) (Finset.toColex.{0} (Fin n) A) (Finset.toColex.{0} (Fin n) B))
-Case conversion may be inaccurate. Consider using '#align colex.hom_fin_lt_iff Colex.hom_fin_lt_iffₓ'. -/
 /-- A special case of `colex.hom_lt_iff` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -172,12 +160,6 @@ theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
 instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
   ⟨fun A h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
 
-/- warning: colex.lt_trans -> Colex.lt_trans is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {a : Finset.Colex.{u1} α} {b : Finset.Colex.{u1} α} {c : Finset.Colex.{u1} α}, (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a b) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) b c) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a c)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {a : Finset.Colex.{u1} α} {b : Finset.Colex.{u1} α} {c : Finset.Colex.{u1} α}, (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a b) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) b c) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a c)
-Case conversion may be inaccurate. Consider using '#align colex.lt_trans Colex.lt_transₓ'. -/
 @[trans]
 theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c → a < c :=
   by
@@ -191,12 +173,6 @@ theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c 
     apply k₂z (trans h hx)
 #align colex.lt_trans Colex.lt_trans
 
-/- warning: colex.le_trans -> Colex.le_trans is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (a : Finset.Colex.{u1} α) (b : Finset.Colex.{u1} α) (c : Finset.Colex.{u1} α), (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a b) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) b c) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a c)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (a : Finset.Colex.{u1} α) (b : Finset.Colex.{u1} α) (c : Finset.Colex.{u1} α), (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a b) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) b c) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a c)
-Case conversion may be inaccurate. Consider using '#align colex.le_trans Colex.le_transₓ'. -/
 @[trans]
 theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤ c → a ≤ c := fun AB BC =>
   AB.elim (fun k => BC.elim (fun t => Or.inl (lt_trans k t)) fun t => t ▸ AB) fun k => k.symm ▸ BC
@@ -205,12 +181,6 @@ theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤
 instance [LinearOrder α] : IsTrans (Finset.Colex α) (· < ·) :=
   ⟨fun _ _ _ => Colex.lt_trans⟩
 
-/- warning: colex.lt_trichotomy -> Colex.lt_trichotomy is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.Colex.{u1} α) (B : Finset.Colex.{u1} α), Or (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) A B) (Or (Eq.{succ u1} (Finset.Colex.{u1} α) A B) (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) B A))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.Colex.{u1} α) (B : Finset.Colex.{u1} α), Or (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) A B) (Or (Eq.{succ u1} (Finset.Colex.{u1} α) A B) (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) B A))
-Case conversion may be inaccurate. Consider using '#align colex.lt_trichotomy Colex.lt_trichotomyₓ'. -/
 theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B ∨ B < A :=
   by
   by_cases h₁ : A = B
@@ -242,12 +212,6 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
 instance [LinearOrder α] : IsTrichotomous (Finset.Colex α) (· < ·) :=
   ⟨lt_trichotomy⟩
 
-/- warning: colex.decidable_lt -> Colex.decidableLt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.Colex.{u1} α} {B : Finset.Colex.{u1} α}, Decidable (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) A B)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.Colex.{u1} α} {B : Finset.Colex.{u1} α}, Decidable (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) A B)
-Case conversion may be inaccurate. Consider using '#align colex.decidable_lt Colex.decidableLtₓ'. -/
 instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (A < B) :=
   show ∀ A B : Finset α, Decidable (A.toColex < B.toColex) from fun A B =>
     decidable_of_iff' (∃ k ∈ B, (∀ x ∈ A ∪ B, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A)
@@ -287,24 +251,12 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
 example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
-/- warning: colex.hom_le_iff -> Colex.hom_le_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (Finset.Colex.hasLe.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (instLEColex.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-Case conversion may be inaccurate. Consider using '#align colex.hom_le_iff Colex.hom_le_iffₓ'. -/
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
 
-/- warning: colex.hom_fin_le_iff -> Colex.hom_fin_le_iff is a dubious translation:
-lean 3 declaration is
-  forall {n : Nat} (A : Finset.{0} (Fin n)) (B : Finset.{0} (Fin n)), Iff (LE.le.{0} (Finset.Colex.{0} Nat) (Finset.Colex.hasLe.{0} Nat Nat.hasLt) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => Nat.decidableEq a b) (fun (i : Fin n) => (fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) i) A)) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => Nat.decidableEq a b) (fun (i : Fin n) => (fun (a : Type) (b : Type) [self : HasLiftT.{1, 1} a b] => self.0) (Fin n) Nat (HasLiftT.mk.{1, 1} (Fin n) Nat (CoeTCₓ.coe.{1, 1} (Fin n) Nat (coeBase.{1, 1} (Fin n) Nat (Fin.coeToNat n)))) i) B))) (LE.le.{0} (Finset.Colex.{0} (Fin n)) (Finset.Colex.hasLe.{0} (Fin n) (Fin.hasLt n)) (Finset.toColex.{0} (Fin n) A) (Finset.toColex.{0} (Fin n) B))
-but is expected to have type
-  forall {n : Nat} (A : Finset.{0} (Fin n)) (B : Finset.{0} (Fin n)), Iff (LE.le.{0} (Finset.Colex.{0} Nat) (instLEColex.{0} Nat instLTNat) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => instDecidableEqNat a b) (fun (i : Fin n) => Fin.val n i) A)) (Finset.toColex.{0} Nat (Finset.image.{0, 0} (Fin n) Nat (fun (a : Nat) (b : Nat) => instDecidableEqNat a b) (fun (i : Fin n) => Fin.val n i) B))) (LE.le.{0} (Finset.Colex.{0} (Fin n)) (instLEColex.{0} (Fin n) (instLTFin n)) (Finset.toColex.{0} (Fin n) A) (Finset.toColex.{0} (Fin n) B))
-Case conversion may be inaccurate. Consider using '#align colex.hom_fin_le_iff Colex.hom_fin_le_iffₓ'. -/
 /-- A special case of `colex_hom` which is sometimes useful. -/
 @[simp]
 theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
@@ -313,12 +265,6 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
   Colex.hom_le_iff (fun x y k => k) _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
 
-/- warning: colex.forall_lt_of_colex_lt_of_forall_lt -> Colex.forall_lt_of_colex_lt_of_forall_lt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α} (t : α), (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)) -> (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x B) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x t)) -> (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x A) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x t))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α} (t : α), (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)) -> (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x B) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x t)) -> (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x A) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x t))
-Case conversion may be inaccurate. Consider using '#align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_ltₓ'. -/
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
 -/
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
@@ -334,12 +280,6 @@ theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t
   apply lt_of_lt_of_le (h₂ k ‹_›) a
 #align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_lt
 
-/- warning: colex.lt_singleton_iff_mem_lt -> Colex.lt_singleton_iff_mem_lt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α s) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r))) (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x r))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α s) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r))) (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x r))
-Case conversion may be inaccurate. Consider using '#align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_ltₓ'. -/
 /-- `s.to_colex < {r}.to_colex` iff all elements of `s` are less than `r`. -/
 theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r :=
@@ -357,12 +297,6 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
       ⟨fun z hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩, by simpa using h r⟩
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
 
-/- warning: colex.mem_le_of_singleton_le -> Colex.mem_le_of_singleton_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α s)) (Exists.{succ u1} α (fun (x : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) (fun (H : Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) => LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r x)))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α s)) (Exists.{succ u1} α (fun (x : α) => And (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r x)))
-Case conversion may be inaccurate. Consider using '#align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_leₓ'. -/
 /-- If {r} is less than or equal to s in the colexicographical sense,
   then s contains an element greater than or equal to r. -/
 theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
@@ -370,23 +304,11 @@ theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
 
-/- warning: colex.singleton_lt_iff_lt -> Colex.singleton_lt_iff_lt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) s))) (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r s)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) s))) (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r s)
-Case conversion may be inaccurate. Consider using '#align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_ltₓ'. -/
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_lt_iff_lt [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex < ({s} : Finset α).toColex ↔ r < s := by simp [lt_singleton_iff_mem_lt]
 #align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_lt
 
-/- warning: colex.singleton_le_iff_le -> Colex.singleton_le_iff_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) s))) (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r s)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) s))) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r s)
-Case conversion may be inaccurate. Consider using '#align colex.singleton_le_iff_le Colex.singleton_le_iff_leₓ'. -/
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_le_iff_le [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex ≤ ({s} : Finset α).toColex ↔ r ≤ s := by
@@ -416,12 +338,6 @@ theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
 #align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
 -/
 
-/- warning: colex.sdiff_le_sdiff_iff_le -> Colex.sdiff_le_sdiff_iff_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-Case conversion may be inaccurate. Consider using '#align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_leₓ'. -/
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
@@ -429,12 +345,6 @@ theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
   rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
 #align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
 
-/- warning: colex.empty_to_colex_lt -> Colex.empty_toColex_lt is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, (Finset.Nonempty.{u1} α A) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.hasEmptyc.{u1} α))) (Finset.toColex.{u1} α A))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, (Finset.Nonempty.{u1} α A) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.instEmptyCollectionFinset.{u1} α))) (Finset.toColex.{u1} α A))
-Case conversion may be inaccurate. Consider using '#align colex.empty_to_colex_lt Colex.empty_toColex_ltₓ'. -/
 theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
     (∅ : Finset α).toColex < A.toColex :=
   by
@@ -445,12 +355,6 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
   apply not_le_of_lt hx (le_max' _ _ t)
 #align colex.empty_to_colex_lt Colex.empty_toColex_lt
 
-/- warning: colex.colex_lt_of_ssubset -> Colex.colex_lt_of_ssubset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSSubset.SSubset.{u1} (Finset.{u1} α) (Finset.hasSsubset.{u1} α) A B) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSSubset.SSubset.{u1} (Finset.{u1} α) (Finset.instHasSSubsetFinset.{u1} α) A B) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-Case conversion may be inaccurate. Consider using '#align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubsetₓ'. -/
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
 theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
@@ -459,12 +363,6 @@ theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A
   exact empty_to_colex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
 #align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
 
-/- warning: colex.empty_to_colex_le -> Colex.empty_toColex_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.hasEmptyc.{u1} α))) (Finset.toColex.{u1} α A)
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.instEmptyCollectionFinset.{u1} α))) (Finset.toColex.{u1} α A)
-Case conversion may be inaccurate. Consider using '#align colex.empty_to_colex_le Colex.empty_toColex_leₓ'. -/
 @[simp]
 theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex :=
   by
@@ -473,12 +371,6 @@ theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).to
   · apply (empty_to_colex_lt hA).le
 #align colex.empty_to_colex_le Colex.empty_toColex_le
 
-/- warning: colex.colex_le_of_subset -> Colex.colex_le_of_subset is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) A B) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.instHasSubsetFinset.{u1} α) A B) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-Case conversion may be inaccurate. Consider using '#align colex.colex_le_of_subset Colex.colex_le_of_subsetₓ'. -/
 /-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
 linear order. -/
 theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.toColex ≤ B.toColex :=
@@ -487,12 +379,6 @@ theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.
   apply empty_to_colex_le
 #align colex.colex_le_of_subset Colex.colex_le_of_subset
 
-/- warning: colex.to_colex_rel_hom -> Colex.toColexRelHom is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], RelHom.{u1, u1} (Finset.{u1} α) (Finset.Colex.{u1} α) (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α)) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], RelHom.{u1, u1} (Finset.{u1} α) (Finset.Colex.{u1} α) (fun (x._@.Mathlib.Combinatorics.Colex._hyg.3796 : Finset.{u1} α) (x._@.Mathlib.Combinatorics.Colex._hyg.3798 : Finset.{u1} α) => HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.instHasSubsetFinset.{u1} α) x._@.Mathlib.Combinatorics.Colex._hyg.3796 x._@.Mathlib.Combinatorics.Colex._hyg.3798) (fun (x._@.Mathlib.Combinatorics.Colex._hyg.3820 : Finset.Colex.{u1} α) (x._@.Mathlib.Combinatorics.Colex._hyg.3822 : Finset.Colex.{u1} α) => LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) x._@.Mathlib.Combinatorics.Colex._hyg.3820 x._@.Mathlib.Combinatorics.Colex._hyg.3822)
-Case conversion may be inaccurate. Consider using '#align colex.to_colex_rel_hom Colex.toColexRelHomₓ'. -/
 /-- The function from finsets to finsets with the colex order is a relation homomorphism. -/
 @[simps]
 def toColexRelHom [LinearOrder α] :
Diff
@@ -366,9 +366,7 @@ Case conversion may be inaccurate. Consider using '#align colex.mem_le_of_single
 /-- If {r} is less than or equal to s in the colexicographical sense,
   then s contains an element greater than or equal to r. -/
 theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
-    ({r} : Finset α).toColex ≤ s.toColex ↔ ∃ x ∈ s, r ≤ x :=
-  by
-  rw [← not_lt]
+    ({r} : Finset α).toColex ≤ s.toColex ↔ ∃ x ∈ s, r ≤ x := by rw [← not_lt];
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
 
Diff
@@ -127,7 +127,12 @@ theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A 
 
 namespace Colex
 
-#print Colex.hom_lt_iff /-
+/- warning: colex.hom_lt_iff -> Colex.hom_lt_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Preorder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) _inst_3 f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LT.lt.{u2} (Finset.Colex.{u2} β) (Finset.Colex.hasLt.{u2} β (Preorder.toHasLt.{u2} β _inst_3)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f B))) (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : DecidableEq.{succ u2} β] [_inst_3 : Preorder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) _inst_3 f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LT.lt.{u2} (Finset.Colex.{u2} β) (instLTColex.{u2} β (Preorder.toLT.{u2} β _inst_3)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => _inst_2 a b) f B))) (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
+Case conversion may be inaccurate. Consider using '#align colex.hom_lt_iff Colex.hom_lt_iffₓ'. -/
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
     (h₁ : StrictMono f) (A B : Finset α) :
@@ -149,7 +154,6 @@ theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β]
   · simp only [h₁.injective, Function.Injective.eq_iff]
     exact fun x hx => ne_of_mem_of_not_mem hx ka
 #align colex.hom_lt_iff Colex.hom_lt_iff
--/
 
 /- warning: colex.hom_fin_lt_iff -> Colex.hom_fin_lt_iff is a dubious translation:
 lean 3 declaration is
@@ -168,7 +172,12 @@ theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
 instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
   ⟨fun A h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
 
-#print Colex.lt_trans /-
+/- warning: colex.lt_trans -> Colex.lt_trans is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {a : Finset.Colex.{u1} α} {b : Finset.Colex.{u1} α} {c : Finset.Colex.{u1} α}, (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a b) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) b c) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a c)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {a : Finset.Colex.{u1} α} {b : Finset.Colex.{u1} α} {c : Finset.Colex.{u1} α}, (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a b) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) b c) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a c)
+Case conversion may be inaccurate. Consider using '#align colex.lt_trans Colex.lt_transₓ'. -/
 @[trans]
 theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c → a < c :=
   by
@@ -181,19 +190,27 @@ theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c 
     rw [k₁z hx]
     apply k₂z (trans h hx)
 #align colex.lt_trans Colex.lt_trans
--/
 
-#print Colex.le_trans /-
+/- warning: colex.le_trans -> Colex.le_trans is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (a : Finset.Colex.{u1} α) (b : Finset.Colex.{u1} α) (c : Finset.Colex.{u1} α), (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a b) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) b c) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) a c)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (a : Finset.Colex.{u1} α) (b : Finset.Colex.{u1} α) (c : Finset.Colex.{u1} α), (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a b) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) b c) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) a c)
+Case conversion may be inaccurate. Consider using '#align colex.le_trans Colex.le_transₓ'. -/
 @[trans]
 theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤ c → a ≤ c := fun AB BC =>
   AB.elim (fun k => BC.elim (fun t => Or.inl (lt_trans k t)) fun t => t ▸ AB) fun k => k.symm ▸ BC
 #align colex.le_trans Colex.le_trans
--/
 
 instance [LinearOrder α] : IsTrans (Finset.Colex α) (· < ·) :=
   ⟨fun _ _ _ => Colex.lt_trans⟩
 
-#print Colex.lt_trichotomy /-
+/- warning: colex.lt_trichotomy -> Colex.lt_trichotomy is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.Colex.{u1} α) (B : Finset.Colex.{u1} α), Or (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) A B) (Or (Eq.{succ u1} (Finset.Colex.{u1} α) A B) (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) B A))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.Colex.{u1} α) (B : Finset.Colex.{u1} α), Or (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) A B) (Or (Eq.{succ u1} (Finset.Colex.{u1} α) A B) (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) B A))
+Case conversion may be inaccurate. Consider using '#align colex.lt_trichotomy Colex.lt_trichotomyₓ'. -/
 theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B ∨ B < A :=
   by
   by_cases h₁ : A = B
@@ -221,12 +238,16 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a
   apply h₁ (subset.antisymm a.1 a.2)
 #align colex.lt_trichotomy Colex.lt_trichotomy
--/
 
 instance [LinearOrder α] : IsTrichotomous (Finset.Colex α) (· < ·) :=
   ⟨lt_trichotomy⟩
 
-#print Colex.decidableLt /-
+/- warning: colex.decidable_lt -> Colex.decidableLt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.Colex.{u1} α} {B : Finset.Colex.{u1} α}, Decidable (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) A B)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.Colex.{u1} α} {B : Finset.Colex.{u1} α}, Decidable (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) A B)
+Case conversion may be inaccurate. Consider using '#align colex.decidable_lt Colex.decidableLtₓ'. -/
 instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (A < B) :=
   show ∀ A B : Finset α, Decidable (A.toColex < B.toColex) from fun A B =>
     decidable_of_iff' (∃ k ∈ B, (∀ x ∈ A ∪ B, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A)
@@ -238,7 +259,6 @@ instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (
         refine' and_congr_left' (forall_congr' _)
         tauto)
 #align colex.decidable_lt Colex.decidableLt
--/
 
 instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
   { Finset.Colex.hasLt,
@@ -267,13 +287,17 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
 example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
-#print Colex.hom_le_iff /-
+/- warning: colex.hom_le_iff -> Colex.hom_le_iff is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (Finset.Colex.hasLe.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (instLEColex.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
+Case conversion may be inaccurate. Consider using '#align colex.hom_le_iff Colex.hom_le_iffₓ'. -/
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
--/
 
 /- warning: colex.hom_fin_le_iff -> Colex.hom_fin_le_iff is a dubious translation:
 lean 3 declaration is
@@ -289,7 +313,12 @@ theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
   Colex.hom_le_iff (fun x y k => k) _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
 
-#print Colex.forall_lt_of_colex_lt_of_forall_lt /-
+/- warning: colex.forall_lt_of_colex_lt_of_forall_lt -> Colex.forall_lt_of_colex_lt_of_forall_lt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α} (t : α), (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)) -> (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x B) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x t)) -> (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x A) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x t))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α} (t : α), (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)) -> (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x B) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x t)) -> (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x A) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x t))
+Case conversion may be inaccurate. Consider using '#align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_ltₓ'. -/
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
 -/
 theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
@@ -304,9 +333,13 @@ theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t
   rwa [← z]
   apply lt_of_lt_of_le (h₂ k ‹_›) a
 #align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_lt
--/
 
-#print Colex.lt_singleton_iff_mem_lt /-
+/- warning: colex.lt_singleton_iff_mem_lt -> Colex.lt_singleton_iff_mem_lt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α s) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r))) (forall (x : α), (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) -> (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x r))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α s) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r))) (forall (x : α), (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s) -> (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x r))
+Case conversion may be inaccurate. Consider using '#align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_ltₓ'. -/
 /-- `s.to_colex < {r}.to_colex` iff all elements of `s` are less than `r`. -/
 theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r :=
@@ -323,11 +356,10 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     exact fun h =>
       ⟨fun z hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩, by simpa using h r⟩
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
--/
 
 /- warning: colex.mem_le_of_singleton_le -> Colex.mem_le_of_singleton_le is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α s)) (Exists.{succ u1} α (fun (x : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) (fun (H : Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) => LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r x)))
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α s)) (Exists.{succ u1} α (fun (x : α) => Exists.{0} (Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) (fun (H : Membership.Mem.{u1, u1} α (Finset.{u1} α) (Finset.hasMem.{u1} α) x s) => LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r x)))
 but is expected to have type
   forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : Finset.{u1} α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α s)) (Exists.{succ u1} α (fun (x : α) => And (Membership.mem.{u1, u1} α (Finset.{u1} α) (Finset.instMembershipFinset.{u1} α) x s) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r x)))
 Case conversion may be inaccurate. Consider using '#align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_leₓ'. -/
@@ -340,20 +372,28 @@ theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
   simp [lt_singleton_iff_mem_lt]
 #align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
 
-#print Colex.singleton_lt_iff_lt /-
+/- warning: colex.singleton_lt_iff_lt -> Colex.singleton_lt_iff_lt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) s))) (LT.lt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r s)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) s))) (LT.lt.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r s)
+Case conversion may be inaccurate. Consider using '#align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_ltₓ'. -/
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_lt_iff_lt [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex < ({s} : Finset α).toColex ↔ r < s := by simp [lt_singleton_iff_mem_lt]
 #align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_lt
--/
 
-#print Colex.singleton_le_iff_le /-
+/- warning: colex.singleton_le_iff_le -> Colex.singleton_le_iff_le is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.hasSingleton.{u1} α) s))) (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) r s)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {r : α} {s : α}, Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) r)) (Finset.toColex.{u1} α (Singleton.singleton.{u1, u1} α (Finset.{u1} α) (Finset.instSingletonFinset.{u1} α) s))) (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) r s)
+Case conversion may be inaccurate. Consider using '#align colex.singleton_le_iff_le Colex.singleton_le_iff_leₓ'. -/
 /-- Colex is an extension of the base ordering on α. -/
 theorem singleton_le_iff_le [LinearOrder α] {r s : α} :
     ({r} : Finset α).toColex ≤ ({s} : Finset α).toColex ↔ r ≤ s := by
   rw [le_iff_le_iff_lt_iff_lt, singleton_lt_iff_lt]
 #align colex.singleton_le_iff_le Colex.singleton_le_iff_le
--/
 
 #print Colex.sdiff_lt_sdiff_iff_lt /-
 /-- Colex doesn't care if you remove the other set -/
@@ -378,16 +418,25 @@ theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
 #align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
 -/
 
-#print Colex.sdiff_le_sdiff_iff_le /-
+/- warning: colex.sdiff_le_sdiff_iff_le -> Colex.sdiff_le_sdiff_iff_le is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+Case conversion may be inaccurate. Consider using '#align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_leₓ'. -/
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
     (A \ B).toColex ≤ (B \ A).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
 #align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
--/
 
-#print Colex.empty_toColex_lt /-
+/- warning: colex.empty_to_colex_lt -> Colex.empty_toColex_lt is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, (Finset.Nonempty.{u1} α A) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.hasEmptyc.{u1} α))) (Finset.toColex.{u1} α A))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, (Finset.Nonempty.{u1} α A) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.instEmptyCollectionFinset.{u1} α))) (Finset.toColex.{u1} α A))
+Case conversion may be inaccurate. Consider using '#align colex.empty_to_colex_lt Colex.empty_toColex_ltₓ'. -/
 theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
     (∅ : Finset α).toColex < A.toColex :=
   by
@@ -397,9 +446,13 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
   intro x hx t
   apply not_le_of_lt hx (le_max' _ _ t)
 #align colex.empty_to_colex_lt Colex.empty_toColex_lt
--/
 
-#print Colex.colex_lt_of_ssubset /-
+/- warning: colex.colex_lt_of_ssubset -> Colex.colex_lt_of_ssubset is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSSubset.SSubset.{u1} (Finset.{u1} α) (Finset.hasSsubset.{u1} α) A B) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLt.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSSubset.SSubset.{u1} (Finset.{u1} α) (Finset.instHasSSubsetFinset.{u1} α) A B) -> (LT.lt.{u1} (Finset.Colex.{u1} α) (instLTColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+Case conversion may be inaccurate. Consider using '#align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubsetₓ'. -/
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
 theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
@@ -407,9 +460,13 @@ theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A
   rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
   exact empty_to_colex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
 #align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
--/
 
-#print Colex.empty_toColex_le /-
+/- warning: colex.empty_to_colex_le -> Colex.empty_toColex_le is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.hasEmptyc.{u1} α))) (Finset.toColex.{u1} α A)
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α}, LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (EmptyCollection.emptyCollection.{u1} (Finset.{u1} α) (Finset.instEmptyCollectionFinset.{u1} α))) (Finset.toColex.{u1} α A)
+Case conversion may be inaccurate. Consider using '#align colex.empty_to_colex_le Colex.empty_toColex_leₓ'. -/
 @[simp]
 theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex :=
   by
@@ -417,9 +474,13 @@ theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).to
   · simp
   · apply (empty_to_colex_lt hA).le
 #align colex.empty_to_colex_le Colex.empty_toColex_le
--/
 
-#print Colex.colex_le_of_subset /-
+/- warning: colex.colex_le_of_subset -> Colex.colex_le_of_subset is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α) A B) -> (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {A : Finset.{u1} α} {B : Finset.{u1} α}, (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.instHasSubsetFinset.{u1} α) A B) -> (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
+Case conversion may be inaccurate. Consider using '#align colex.colex_le_of_subset Colex.colex_le_of_subsetₓ'. -/
 /-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
 linear order. -/
 theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.toColex ≤ B.toColex :=
@@ -427,9 +488,13 @@ theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.
   rw [← sdiff_le_sdiff_iff_le, sdiff_eq_empty_iff_subset.2 h]
   apply empty_to_colex_le
 #align colex.colex_le_of_subset Colex.colex_le_of_subset
--/
 
-#print Colex.toColexRelHom /-
+/- warning: colex.to_colex_rel_hom -> Colex.toColexRelHom is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], RelHom.{u1, u1} (Finset.{u1} α) (Finset.Colex.{u1} α) (HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.hasSubset.{u1} α)) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toHasLt.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))))
+but is expected to have type
+  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α], RelHom.{u1, u1} (Finset.{u1} α) (Finset.Colex.{u1} α) (fun (x._@.Mathlib.Combinatorics.Colex._hyg.3796 : Finset.{u1} α) (x._@.Mathlib.Combinatorics.Colex._hyg.3798 : Finset.{u1} α) => HasSubset.Subset.{u1} (Finset.{u1} α) (Finset.instHasSubsetFinset.{u1} α) x._@.Mathlib.Combinatorics.Colex._hyg.3796 x._@.Mathlib.Combinatorics.Colex._hyg.3798) (fun (x._@.Mathlib.Combinatorics.Colex._hyg.3820 : Finset.Colex.{u1} α) (x._@.Mathlib.Combinatorics.Colex._hyg.3822 : Finset.Colex.{u1} α) => LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) x._@.Mathlib.Combinatorics.Colex._hyg.3820 x._@.Mathlib.Combinatorics.Colex._hyg.3822)
+Case conversion may be inaccurate. Consider using '#align colex.to_colex_rel_hom Colex.toColexRelHomₓ'. -/
 /-- The function from finsets to finsets with the colex order is a relation homomorphism. -/
 @[simps]
 def toColexRelHom [LinearOrder α] :
@@ -438,7 +503,6 @@ def toColexRelHom [LinearOrder α] :
   toFun := Finset.toColex
   map_rel' A B := colex_le_of_subset
 #align colex.to_colex_rel_hom Colex.toColexRelHom
--/
 
 instance [LinearOrder α] : OrderBot (Finset.Colex α)
     where
Diff
@@ -267,17 +267,13 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
 example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
-/- warning: colex.hom_le_iff -> Colex.hom_le_iff is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (Finset.Colex.hasLe.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_2)))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => Eq.decidable.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : LinearOrder.{u2} β] {f : α -> β}, (StrictMono.{u1, u2} α β (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))) f) -> (forall (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u2} (Finset.Colex.{u2} β) (instLEColex.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (DistribLattice.toLattice.{u2} β (instDistribLattice.{u2} β _inst_2))))))) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f A)) (Finset.toColex.{u2} β (Finset.image.{u1, u2} α β (fun (a : β) (b : β) => instDecidableEq.{u2} β _inst_2 a b) f B))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B)))
-Case conversion may be inaccurate. Consider using '#align colex.hom_le_iff Colex.hom_le_iffₓ'. -/
+#print Colex.hom_le_iff /-
 /-- Strictly monotone functions preserve the colex ordering. -/
 theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
+-/
 
 /- warning: colex.hom_fin_le_iff -> Colex.hom_fin_le_iff is a dubious translation:
 lean 3 declaration is
@@ -382,18 +378,14 @@ theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
 #align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
 -/
 
-/- warning: colex.sdiff_le_sdiff_iff_le -> Colex.sdiff_le_sdiff_iff_le is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.hasSdiff.{u1} α (fun (a : α) (b : α) => Eq.decidable.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (Finset.Colex.hasLe.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] (A : Finset.{u1} α) (B : Finset.{u1} α), Iff (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) A B)) (Finset.toColex.{u1} α (SDiff.sdiff.{u1} (Finset.{u1} α) (Finset.instSDiffFinset.{u1} α (fun (a : α) (b : α) => instDecidableEq.{u1} α _inst_1 a b)) B A))) (LE.le.{u1} (Finset.Colex.{u1} α) (instLEColex.{u1} α (Preorder.toLT.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (Finset.toColex.{u1} α A) (Finset.toColex.{u1} α B))
-Case conversion may be inaccurate. Consider using '#align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_leₓ'. -/
+#print Colex.sdiff_le_sdiff_iff_le /-
 /-- Colex doesn't care if you remove the other set -/
 @[simp]
 theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
     (A \ B).toColex ≤ (B \ A).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
 #align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
+-/
 
 #print Colex.empty_toColex_lt /-
 theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :

Changes in mathlib4

mathlib3
mathlib4
chore: prepare Lean version bump with explicit simp (#10999)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -107,8 +107,8 @@ private lemma trans_aux (hst : toColex s ≤ toColex t) (htu : toColex t ≤ toC
     (has : a ∈ s) (hat : a ∉ t) : ∃ b, b ∈ u ∧ b ∉ s ∧ a ≤ b := by
   classical
   let s' : Finset α := s.filter fun b ↦ b ∉ t ∧ a ≤ b
-  have ⟨b, hb, hbmax⟩ := exists_maximal s' ⟨a, by simp [has, hat]⟩
-  simp only [mem_filter, and_imp] at hb hbmax
+  have ⟨b, hb, hbmax⟩ := exists_maximal s' ⟨a, by simp [s', has, hat]⟩
+  simp only [s', mem_filter, and_imp] at hb hbmax
   have ⟨c, hct, hcs, hbc⟩ := hst hb.1 hb.2.1
   by_cases hcu : c ∈ u
   · exact ⟨c, hcu, hcs, hb.2.2.trans hbc⟩
chore: scope symmDiff notations (#9844)

Those notations are not scoped whereas the file is very low in the import hierarchy.

Diff
@@ -266,6 +266,8 @@ instance instLinearOrder : LinearOrder (Colex α) where
   decidableLE := instDecidableLE
   decidableLT := instDecidableLT
 
+open scoped symmDiff
+
 private lemma max_mem_aux {s t : Colex α} (hst : s ≠ t) : (ofColex s ∆ ofColex t).Nonempty := by
   simpa
 
chore(*): replace $ with <| (#9319)

See Zulip thread for the discussion.

Diff
@@ -315,7 +315,7 @@ lemma toColex_image_lt_toColex_image (hf : StrictMono f) :
   lt_iff_lt_of_le_iff_le <| toColex_image_le_toColex_image hf
 
 lemma toColex_image_ofColex_strictMono (hf : StrictMono f) :
-    StrictMono fun s ↦ toColex $ image f $ ofColex s :=
+    StrictMono fun s ↦ toColex <| image f <| ofColex s :=
   fun _s _t ↦ (toColex_image_lt_toColex_image hf).2
 
 /-! ### Initial segments -/
@@ -402,7 +402,7 @@ lemma geomSum_ofColex_strictMono (hn : 2 ≤ n) : StrictMono fun s ↦ ∑ k in
   rw [toColex_lt_toColex_iff_exists_forall_lt] at hst
   obtain ⟨a, hat, has, ha⟩ := hst
   rw [← sum_sdiff_lt_sum_sdiff]
-  exact (Nat.geomSum_lt hn $ by simpa).trans_le <| single_le_sum (fun _ _ ↦ by positivity) <|
+  exact (Nat.geomSum_lt hn <| by simpa).trans_le <| single_le_sum (fun _ _ ↦ by positivity) <|
     mem_sdiff.2 ⟨hat, has⟩
 
 /-- For finsets of naturals of naturals, the colexicographic order is equivalent to the order
chore: rename by_contra' to by_contra! (#8797)

To fit with the "please try harder" convention of ! tactics.

Co-authored-by: Scott Morrison <scott.morrison@gmail.com>

Diff
@@ -119,7 +119,7 @@ private lemma trans_aux (hst : toColex s ≤ toColex t) (htu : toColex t ≤ toC
 
 private lemma antisymm_aux (hst : toColex s ≤ toColex t) (hts : toColex t ≤ toColex s) : s ⊆ t := by
   intro a has
-  by_contra' hat
+  by_contra! hat
   have ⟨_b, hb₁, hb₂, _⟩ := trans_aux hst hts has hat
   exact hb₂ hb₁
 
@@ -334,7 +334,7 @@ def IsInitSeg (𝒜 : Finset (Finset α)) (r : ℕ) : Prop :=
 lemma IsInitSeg.total (h₁ : IsInitSeg 𝒜₁ r) (h₂ : IsInitSeg 𝒜₂ r) : 𝒜₁ ⊆ 𝒜₂ ∨ 𝒜₂ ⊆ 𝒜₁ := by
   classical
   simp_rw [← sdiff_eq_empty_iff_subset, ← not_nonempty_iff_eq_empty]
-  by_contra' h
+  by_contra! h
   have ⟨⟨s, hs⟩, t, ht⟩ := h
   rw [mem_sdiff] at hs ht
   obtain hst | hst | hts := trichotomous_of (α := Colex α) (· < ·) (toColex s) (toColex t)
chore: space after (#8178)

Co-authored-by: Moritz Firsching <firsching@google.com>

Diff
@@ -232,8 +232,8 @@ lemma le_iff_sdiff_subset_lowerClosure {s t : Colex α} :
 /-- The colexigraphic order is insensitive to removing the same elements from both sets. -/
 lemma toColex_sdiff_le_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
     toColex (s \ u) ≤ toColex (t \ u) ↔ toColex s ≤ toColex t := by
-  simp_rw [toColex_le_toColex, ←and_imp, ←and_assoc, ←mem_sdiff, sdiff_sdiff_sdiff_cancel_right hus,
-    sdiff_sdiff_sdiff_cancel_right hut]
+  simp_rw [toColex_le_toColex, ← and_imp, ← and_assoc, ← mem_sdiff,
+    sdiff_sdiff_sdiff_cancel_right hus, sdiff_sdiff_sdiff_cancel_right hut]
 
 /-- The colexigraphic order is insensitive to removing the same elements from both sets. -/
 lemma toColex_sdiff_lt_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
@@ -271,7 +271,7 @@ private lemma max_mem_aux {s t : Colex α} (hst : s ≠ t) : (ofColex s ∆ ofCo
 
 lemma toColex_lt_toColex_iff_exists_forall_lt :
     toColex s < toColex t ↔ ∃ a ∈ t, a ∉ s ∧ ∀ b ∈ s, b ∉ t → b < a := by
-  rw [←not_le, toColex_le_toColex, not_forall]
+  rw [← not_le, toColex_le_toColex, not_forall]
   simp only [not_forall, not_exists, not_and, not_le, exists_prop, exists_and_left]
 
 lemma lt_iff_exists_forall_lt {s t : Colex α} :
@@ -333,7 +333,7 @@ def IsInitSeg (𝒜 : Finset (Finset α)) (r : ℕ) : Prop :=
 -/
 lemma IsInitSeg.total (h₁ : IsInitSeg 𝒜₁ r) (h₂ : IsInitSeg 𝒜₂ r) : 𝒜₁ ⊆ 𝒜₂ ∨ 𝒜₂ ⊆ 𝒜₁ := by
   classical
-  simp_rw [←sdiff_eq_empty_iff_subset, ←not_nonempty_iff_eq_empty]
+  simp_rw [← sdiff_eq_empty_iff_subset, ← not_nonempty_iff_eq_empty]
   by_contra' h
   have ⟨⟨s, hs⟩, t, ht⟩ := h
   rw [mem_sdiff] at hs ht
@@ -401,7 +401,7 @@ lemma geomSum_ofColex_strictMono (hn : 2 ≤ n) : StrictMono fun s ↦ ∑ k in
   rintro ⟨s⟩ ⟨t⟩ hst
   rw [toColex_lt_toColex_iff_exists_forall_lt] at hst
   obtain ⟨a, hat, has, ha⟩ := hst
-  rw [←sum_sdiff_lt_sum_sdiff]
+  rw [← sum_sdiff_lt_sum_sdiff]
   exact (Nat.geomSum_lt hn $ by simpa).trans_le <| single_le_sum (fun _ _ ↦ by positivity) <|
     mem_sdiff.2 ⟨hat, has⟩
 
refactor: New Colex API (#7715)

This fully rewrites Combinatorics.Colex to use a type synonym approach instead of abusing defeq.

We also provide some API about initial segments of colex.

Co-authored-by: Mario Carneiro <di.gama@gmail.com>

Diff
@@ -1,423 +1,423 @@
 /-
 Copyright (c) 2020 Bhavik Mehta. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
-Authors: Bhavik Mehta, Alena Gusakov
+Authors: Bhavik Mehta, Alena Gusakov, Yaël Dillies
 -/
-import Mathlib.Data.Fintype.Basic
 import Mathlib.Algebra.GeomSum
+import Mathlib.Data.Finset.Slice
+import Mathlib.Order.SupClosed
 
 #align_import combinatorics.colex from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
 
 /-!
-# Colex
+# Colexigraphic order
 
-We define the colex ordering for finite sets, and give a couple of important
-lemmas and properties relating to it.
+We define the colex order for finite sets, and give a couple of important lemmas and properties
+relating to it.
 
-The colex ordering likes to avoid large values - it can be thought of on
-`Finset ℕ` as the "binary" ordering. That is, order A based on
-`∑_{i ∈ A} 2^i`.
-It's defined here in a slightly more general way, requiring only `LT α` in
-the definition of colex on `Finset α`. In the context of the Kruskal-Katona
-theorem, we are interested in particular on how colex behaves for sets of a
-fixed size. If the size is 3, colex on ℕ starts
-123, 124, 134, 234, 125, 135, 235, 145, 245, 345, ...
+The colex ordering likes to avoid large values: If the biggest element of `t` is bigger than all
+elements of `s`, then `s < t`.
+
+In the special case of `ℕ`, it can be thought of as the "binary" ordering. That is, order `s` based
+on $∑_{i ∈ s} 2^i$. It's defined here on `Finset α` for any linear order `α`.
+
+In the context of the Kruskal-Katona theorem, we are interested in how colex behaves for sets of a
+fixed size. For example, for size 3, the colex order on ℕ starts
+`012, 013, 023, 123, 014, 024, 124, 034, 134, 234, ...`
 
 ## Main statements
-* `Colex.hom_lt_iff`: strictly monotone functions preserve colex
+
 * Colex order properties - linearity, decidability and so on.
-* `forall_lt_of_colex_lt_of_forall_lt`: if A < B in colex, and everything
-  in B is < t, then everything in A is < t. This confirms the idea that
-  an enumeration under colex will exhaust all sets using elements < t before
-  allowing t to be included.
-* `sum_two_pow_le_iff_lt`: colex for α = ℕ is the same as binary
-  (this also proves binary expansions are unique)
+* `Finset.Colex.forall_lt_mono`: if `s < t` in colex, and everything in `t` is `< a`, then
+  everything in `s` is `< a`. This confirms the idea that an enumeration under colex will exhaust
+  all sets using elements `< a` before allowing `a` to be included.
+* `Finset.toColex_image_le_toColex_image`: Strictly monotone functions preserve colex.
+* `Finset.geomSum_le_geomSum_iff_toColex_le_toColex`: Colex for α = ℕ is the same as binary.
+  This also proves binary expansions are unique.
 
 ## See also
 
 Related files are:
 * `Data.List.Lex`: Lexicographic order on lists.
-* `Data.Pi.Lex`: Lexicographic order on `(i : α) → α i`.
+* `Data.Pi.Lex`: Lexicographic order on `Πₗ i, α i`.
 * `Data.PSigma.Order`: Lexicographic order on `Σ' i, α i`.
 * `Data.Sigma.Order`: Lexicographic order on `Σ i, α i`.
 * `Data.Prod.Lex`: Lexicographic order on `α × β`.
 
-## Tags
-colex, colexicographic, binary
+## TODO
+
+* Generalise `Colex.initSeg` so that it applies to `ℕ`.
 
 ## References
+
 * https://github.com/b-mehta/maths-notes/blob/master/iii/mich/combinatorics.pdf
 
+## Tags
+
+colex, colexicographic, binary
 -/
 
+open Finset Function
+open scoped BigOperators
 
-variable {α : Type*}
+#align nat.sum_two_pow_lt Nat.geomSum_lt
 
-open Finset
-open BigOperators
+variable {α β : Type*}
 
-/-- We define this type synonym to refer to the colexicographic ordering on finsets
-rather than the natural subset ordering.
--/
-def Finset.Colex (α) :=
-  Finset α
--- Porting note: `deriving Inhabited` doesn't work
-#align finset.colex Finset.Colex
+namespace Finset
 
-instance : Inhabited (Finset.Colex α) := inferInstanceAs (Inhabited (Finset α))
+/-- Type synonym of `Finset α` equipped with the colexicographic order rather than the inclusion
+order. -/
+@[ext]
+structure Colex (α) :=
+  /-- `toColex` is the "identity" function between `Finset α` and `Finset.Colex α`. -/
+  toColex ::
+  /-- `ofColex` is the "identity" function between `Finset.Colex α` and `Finset α`. -/
+  (ofColex : Finset α)
 
-/-- A convenience constructor to turn a `Finset α` into a `Finset.Colex α`, useful in order to
-use the colex ordering rather than the subset ordering.
--/
-def Finset.toColex {α} (s : Finset α) : Finset.Colex α :=
-  s
-#align finset.to_colex Finset.toColex
+-- TODO: Why can't we export?
+--export Colex (toColex)
 
-@[simp]
-theorem Colex.eq_iff (A B : Finset α) : A.toColex = B.toColex ↔ A = B :=
-  Iff.rfl
-#align colex.eq_iff Colex.eq_iff
+open Colex
 
-/-- `A` is less than `B` in the colex ordering if the largest thing that's not in both sets is in B.
-In other words, `max (A ∆ B) ∈ B` (if the maximum exists).
--/
-instance Colex.instLT [LT α] : LT (Finset.Colex α) :=
-  ⟨fun A B : Finset α => ∃ k : α, (∀ {x}, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A ∧ k ∈ B⟩
+instance : Inhabited (Colex α) := ⟨⟨∅⟩⟩
 
-/-- We can define (≤) in the obvious way. -/
-instance Colex.instLE [LT α] : LE (Finset.Colex α) :=
-  ⟨fun A B => A < B ∨ A = B⟩
+@[simp] lemma toColex_ofColex (s : Colex α) : toColex (ofColex s) = s := rfl
+lemma ofColex_toColex (s : Finset α) : ofColex (toColex s) = s := rfl
+lemma toColex_inj {s t : Finset α} : toColex s = toColex t ↔ s = t := by simp
+@[simp]
+lemma ofColex_inj {s t : Colex α} : ofColex s = ofColex t ↔ s = t := by cases s; cases t; simp
+lemma toColex_ne_toColex {s t : Finset α} : toColex s ≠ toColex t ↔ s ≠ t := by simp
+lemma ofColex_ne_ofColex {s t : Colex α} : ofColex s ≠ ofColex t ↔ s ≠ t := by simp
 
-theorem Colex.lt_def [LT α] (A B : Finset α) :
-    A.toColex < B.toColex ↔ ∃ k, (∀ {x}, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A ∧ k ∈ B :=
-  Iff.rfl
-#align colex.lt_def Colex.lt_def
+lemma toColex_injective : Injective (toColex : Finset α → Colex α) := fun _ _ ↦ toColex_inj.1
+lemma ofColex_injective : Injective (ofColex : Colex α → Finset α) := fun _ _ ↦ ofColex_inj.1
 
-theorem Colex.le_def [LT α] (A B : Finset α) :
-    A.toColex ≤ B.toColex ↔ A.toColex < B.toColex ∨ A = B :=
+namespace Colex
+section PartialOrder
+variable [PartialOrder α] [PartialOrder β] {f : α → β} {𝒜 𝒜₁ 𝒜₂ : Finset (Finset α)}
+  {s t u : Finset α} {a b : α}
+
+instance instLE : LE (Colex α) where
+  le s t := ∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b
+
+-- TODO: This lemma is weirdly useful given how strange its statement is.
+-- Is there a nicer statement? Should this lemma be made public?
+private lemma trans_aux (hst : toColex s ≤ toColex t) (htu : toColex t ≤ toColex u)
+    (has : a ∈ s) (hat : a ∉ t) : ∃ b, b ∈ u ∧ b ∉ s ∧ a ≤ b := by
+  classical
+  let s' : Finset α := s.filter fun b ↦ b ∉ t ∧ a ≤ b
+  have ⟨b, hb, hbmax⟩ := exists_maximal s' ⟨a, by simp [has, hat]⟩
+  simp only [mem_filter, and_imp] at hb hbmax
+  have ⟨c, hct, hcs, hbc⟩ := hst hb.1 hb.2.1
+  by_cases hcu : c ∈ u
+  · exact ⟨c, hcu, hcs, hb.2.2.trans hbc⟩
+  have ⟨d, hdu, hdt, hcd⟩ := htu hct hcu
+  have had : a ≤ d := hb.2.2.trans <| hbc.trans hcd
+  refine ⟨d, hdu, fun hds ↦ ?_, had⟩
+  exact hbmax d hds hdt had <| hbc.trans_lt <| hcd.lt_of_ne <| ne_of_mem_of_not_mem hct hdt
+
+private lemma antisymm_aux (hst : toColex s ≤ toColex t) (hts : toColex t ≤ toColex s) : s ⊆ t := by
+  intro a has
+  by_contra' hat
+  have ⟨_b, hb₁, hb₂, _⟩ := trans_aux hst hts has hat
+  exact hb₂ hb₁
+
+instance instPartialOrder : PartialOrder (Colex α) where
+  le_refl s a ha ha' := (ha' ha).elim
+  le_antisymm s t hst hts := Colex.ext _ _ <| (antisymm_aux hst hts).antisymm (antisymm_aux hts hst)
+  le_trans s t u hst htu a has hau := by
+    by_cases hat : a ∈ ofColex t
+    · have ⟨b, hbu, hbt, hab⟩ := htu hat hau
+      by_cases hbs : b ∈ ofColex s
+      · have ⟨c, hcu, hcs, hbc⟩ := trans_aux hst htu hbs hbt
+        exact ⟨c, hcu, hcs, hab.trans hbc⟩
+      · exact ⟨b, hbu, hbs, hab⟩
+    · exact trans_aux hst htu has hat
+
+lemma le_def {s t : Colex α} :
+    s ≤ t ↔ ∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b :=
   Iff.rfl
-#align colex.le_def Colex.le_def
-
-/-- If everything in `A` is less than `k`, we can bound the sum of powers. -/
-theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A → x < k) :
-    A.sum (Nat.pow 2) < 2 ^ k := by
-  apply lt_of_le_of_lt (sum_le_sum_of_subset fun t => mem_range.2 ∘ h₁)
-  have z := geom_sum_mul_add 1 k
-  rw [mul_one, one_add_one_eq_two] at z
-  rw [← z]
-  apply Nat.lt_succ_self
-#align nat.sum_two_pow_lt Nat.sum_two_pow_lt
 
-namespace Colex
+lemma toColex_le_toColex :
+    toColex s ≤ toColex t ↔ ∀ ⦃a⦄, a ∈ s → a ∉ t → ∃ b, b ∈ t ∧ b ∉ s ∧ a ≤ b := Iff.rfl
+
+lemma toColex_lt_toColex :
+    toColex s < toColex t ↔ s ≠ t ∧ ∀ ⦃a⦄, a ∈ s → a ∉ t → ∃ b, b ∈ t ∧ b ∉ s ∧ a ≤ b := by
+  simp [lt_iff_le_and_ne, toColex_le_toColex, and_comm]
+
+/-- If `s ⊆ t`, then `s ≤ t` in the colex order. Note the converse does not hold, as inclusion does
+not form a linear order. -/
+lemma toColex_mono : Monotone (toColex : Finset α → Colex α) :=
+  fun _s _t hst _a has hat ↦ (hat <| hst has).elim
+
+/-- If `s ⊂ t`, then `s < t` in the colex order. Note the converse does not hold, as inclusion does
+not form a linear order. -/
+lemma toColex_strictMono : StrictMono (toColex : Finset α → Colex α) :=
+  toColex_mono.strictMono_of_injective toColex_injective
+
+/-- If `s ⊆ t`, then `s ≤ t` in the colex order. Note the converse does not hold, as inclusion does
+not form a linear order. -/
+lemma toColex_le_toColex_of_subset (h : s ⊆ t) : toColex s ≤ toColex t := toColex_mono h
+
+/-- If `s ⊂ t`, then `s < t` in the colex order. Note the converse does not hold, as inclusion does
+not form a linear order. -/
+lemma toColex_lt_toColex_of_ssubset (h : s ⊂ t) : toColex s < toColex t := toColex_strictMono h
+
+instance instOrderBot : OrderBot (Colex α) where
+  bot := toColex ∅
+  bot_le s a ha := by cases ha
+
+@[simp] lemma toColex_empty : toColex (∅ : Finset α) = ⊥ := rfl
+@[simp] lemma ofColex_bot : ofColex (⊥ : Colex α) = ∅ := rfl
+
+/-- If `s ≤ t` in colex, and all elements in `t` are small, then all elements in `s` are small. -/
+lemma forall_le_mono (hst : toColex s ≤ toColex t) (ht : ∀ b ∈ t, b ≤ a) : ∀ b ∈ s, b ≤ a := by
+  rintro b hb
+  by_cases b ∈ t
+  · exact ht _ ‹_›
+  · obtain ⟨c, hct, -, hbc⟩ := hst hb ‹_›
+    exact hbc.trans <| ht _ hct
+
+/-- If `s ≤ t` in colex, and all elements in `t` are small, then all elements in `s` are small. -/
+lemma forall_lt_mono (hst : toColex s ≤ toColex t) (ht : ∀ b ∈ t, b < a) : ∀ b ∈ s, b < a := by
+  rintro b hb
+  by_cases b ∈ t
+  · exact ht _ ‹_›
+  · obtain ⟨c, hct, -, hbc⟩ := hst hb ‹_›
+    exact hbc.trans_lt <| ht _ hct
+
+/-- `s ≤ {a}` in colex iff all elements of `s` are strictly less than `a`, except possibly `a` in
+which case `s = {a}`. -/
+lemma toColex_le_singleton : toColex s ≤ toColex {a} ↔ ∀ b ∈ s, b ≤ a ∧ (a ∈ s → b = a) := by
+  simp only [toColex_le_toColex, mem_singleton, and_assoc, exists_eq_left]
+  refine forall₂_congr fun b _ ↦ ?_; obtain rfl | hba := eq_or_ne b a <;> aesop
+
+/-- `s < {a}` in colex iff all elements of `s` are strictly less than `a`. -/
+lemma toColex_lt_singleton : toColex s < toColex {a} ↔ ∀ b ∈ s, b < a := by
+  rw [lt_iff_le_and_ne, toColex_le_singleton, toColex_ne_toColex]
+  refine ⟨fun h b hb ↦ (h.1 _ hb).1.lt_of_ne ?_,
+    fun h ↦ ⟨fun b hb ↦ ⟨(h _ hb).le, fun ha ↦ (lt_irrefl _ <| h _ ha).elim⟩, ?_⟩⟩ <;> rintro rfl
+  · refine h.2 <| eq_singleton_iff_unique_mem.2 ⟨hb, fun c hc ↦ (h.1 _ hc).2 hb⟩
+  · simp at h
+
+/-- `{a} ≤ s` in colex iff `s` contains an element greated than or equal to `a`. -/
+lemma singleton_le_toColex : (toColex {a} : Colex α) ≤ toColex s ↔ ∃ x ∈ s, a ≤ x := by
+  simp [toColex_le_toColex]; by_cases a ∈ s <;> aesop
+
+/-- Colex is an extension of the base order. -/
+lemma singleton_le_singleton : (toColex {a} : Colex α) ≤ toColex {b} ↔ a ≤ b := by
+  simp [toColex_le_singleton, eq_comm]
+
+/-- Colex is an extension of the base order. -/
+lemma singleton_lt_singleton : (toColex {a} : Colex α) < toColex {b} ↔ a < b := by
+  simp [toColex_lt_singleton]
+
+variable [DecidableEq α]
+
+instance instDecidableEq : DecidableEq (Colex α) := fun s t ↦
+  decidable_of_iff' (s.ofColex = t.ofColex) <| Colex.ext_iff _ _
+
+instance instDecidableLE [@DecidableRel α (· ≤ ·)] : @DecidableRel (Colex α) (· ≤ ·) := fun s t ↦
+  decidable_of_iff'
+    (∀ ⦃a⦄, a ∈ ofColex s → a ∉ ofColex t → ∃ b, b ∈ ofColex t ∧ b ∉ ofColex s ∧ a ≤ b) Iff.rfl
+
+instance instDecidableLT [@DecidableRel α (· ≤ ·)] : @DecidableRel (Colex α) (· < ·) :=
+  decidableLTOfDecidableLE
+
+lemma le_iff_sdiff_subset_lowerClosure {s t : Colex α} :
+    s ≤ t ↔ (ofColex s : Set α) \ ofColex t ⊆ lowerClosure (ofColex t \ ofColex s : Set α) := by
+  simp [le_def, Set.subset_def, and_assoc]
+
+/-- The colexigraphic order is insensitive to removing the same elements from both sets. -/
+lemma toColex_sdiff_le_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
+    toColex (s \ u) ≤ toColex (t \ u) ↔ toColex s ≤ toColex t := by
+  simp_rw [toColex_le_toColex, ←and_imp, ←and_assoc, ←mem_sdiff, sdiff_sdiff_sdiff_cancel_right hus,
+    sdiff_sdiff_sdiff_cancel_right hut]
+
+/-- The colexigraphic order is insensitive to removing the same elements from both sets. -/
+lemma toColex_sdiff_lt_toColex_sdiff (hus : u ⊆ s) (hut : u ⊆ t) :
+    toColex (s \ u) < toColex (t \ u) ↔ toColex s < toColex t :=
+  lt_iff_lt_of_le_iff_le' (toColex_sdiff_le_toColex_sdiff hut hus) <|
+    toColex_sdiff_le_toColex_sdiff hus hut
+
+@[simp] lemma toColex_sdiff_le_toColex_sdiff' :
+    toColex (s \ t) ≤ toColex (t \ s) ↔ toColex s ≤ toColex t := by
+  simpa using toColex_sdiff_le_toColex_sdiff (inter_subset_left s t) (inter_subset_right s t)
+
+@[simp] lemma toColex_sdiff_lt_toColex_sdiff' :
+ toColex (s \ t) < toColex (t \ s) ↔ toColex s < toColex t := by
+  simpa using toColex_sdiff_lt_toColex_sdiff (inter_subset_left s t) (inter_subset_right s t)
+
+end PartialOrder
+
+variable [LinearOrder α] [LinearOrder β] {f : α → β} {𝒜 𝒜₁ 𝒜₂ : Finset (Finset α)}
+  {s t u : Finset α} {a b : α} {r : ℕ}
+
+instance instLinearOrder : LinearOrder (Colex α) where
+  le_total s t := by
+    classical
+    obtain rfl | hts := eq_or_ne t s
+    · simp
+    have ⟨a, ha, hamax⟩ := exists_max_image _ id (symmDiff_nonempty.2 <| ofColex_ne_ofColex.2 hts)
+    simp_rw [mem_symmDiff] at ha hamax
+    exact ha.imp (fun ha b hbs hbt ↦ ⟨a, ha.1, ha.2, hamax _ <| Or.inr ⟨hbs, hbt⟩⟩)
+      (fun ha b hbt hbs ↦ ⟨a, ha.1, ha.2, hamax _ <| Or.inl ⟨hbt, hbs⟩⟩)
+  decidableLE := instDecidableLE
+  decidableLT := instDecidableLT
+
+private lemma max_mem_aux {s t : Colex α} (hst : s ≠ t) : (ofColex s ∆ ofColex t).Nonempty := by
+  simpa
+
+lemma toColex_lt_toColex_iff_exists_forall_lt :
+    toColex s < toColex t ↔ ∃ a ∈ t, a ∉ s ∧ ∀ b ∈ s, b ∉ t → b < a := by
+  rw [←not_le, toColex_le_toColex, not_forall]
+  simp only [not_forall, not_exists, not_and, not_le, exists_prop, exists_and_left]
+
+lemma lt_iff_exists_forall_lt {s t : Colex α} :
+    s < t ↔ ∃ a ∈ ofColex t, a ∉ ofColex s ∧ ∀ b ∈ ofColex s, b ∉ ofColex t → b < a :=
+  toColex_lt_toColex_iff_exists_forall_lt
+
+lemma toColex_le_toColex_iff_max'_mem :
+    toColex s ≤ toColex t ↔ ∀ hst : s ≠ t, (s ∆ t).max' (symmDiff_nonempty.2 hst) ∈ t := by
+  refine ⟨fun h hst ↦ ?_, fun h a has hat ↦ ?_⟩
+  · set m := (s ∆ t).max' (symmDiff_nonempty.2 hst)
+    by_contra hmt
+    have hms : m ∈ s := by simpa [mem_symmDiff, hmt] using max'_mem _ <| symmDiff_nonempty.2 hst
+    have ⟨b, hbt, hbs, hmb⟩ := h hms hmt
+    exact lt_irrefl _ <| (max'_lt_iff _ _).1 (hmb.lt_of_ne <| ne_of_mem_of_not_mem hms hbs) _ <|
+      mem_symmDiff.2 <| Or.inr ⟨hbt, hbs⟩
+  · have hst : s ≠ t := ne_of_mem_of_not_mem' has hat
+    refine ⟨_, h hst, ?_, le_max' _ _ <| mem_symmDiff.2 <| Or.inl ⟨has, hat⟩⟩
+    simpa [mem_symmDiff, h hst] using max'_mem _ <| symmDiff_nonempty.2 hst
+
+lemma le_iff_max'_mem {s t : Colex α} :
+    s ≤ t ↔ ∀ h : s ≠ t, (ofColex s ∆ ofColex t).max' (max_mem_aux h) ∈ ofColex t :=
+  toColex_le_toColex_iff_max'_mem.trans
+    ⟨fun h hst ↦ h <| ofColex_ne_ofColex.2 hst, fun h hst ↦ h <| ofColex_ne_ofColex.1 hst⟩
+
+lemma toColex_lt_toColex_iff_max'_mem :
+    toColex s < toColex t ↔ ∃ hst : s ≠ t, (s ∆ t).max' (symmDiff_nonempty.2 hst) ∈ t := by
+  rw [lt_iff_le_and_ne, toColex_le_toColex_iff_max'_mem]; aesop
+
+lemma lt_iff_max'_mem {s t : Colex α} :
+    s < t ↔ ∃ h : s ≠ t, (ofColex s ∆ ofColex t).max' (max_mem_aux h) ∈ ofColex t := by
+  rw [lt_iff_le_and_ne, le_iff_max'_mem]; aesop
 
 /-- Strictly monotone functions preserve the colex ordering. -/
-theorem hom_lt_iff {β : Type*} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
-    (h₁ : StrictMono f) (A B : Finset α) :
-    (A.image f).toColex < (B.image f).toColex ↔ A.toColex < B.toColex := by
-  simp only [Colex.lt_def, not_exists, mem_image, exists_prop, not_and]
-  constructor
-  · rintro ⟨k, z, q, k', _, rfl⟩
-    exact
-      ⟨k', @fun x hx => by
-        simpa [h₁.injective.eq_iff] using z (h₁ hx), fun t => q _ t rfl, ‹k' ∈ B›⟩
-  rintro ⟨k, z, ka, _⟩
-  refine' ⟨f k, @fun x hx => _, _, k, ‹k ∈ B›, rfl⟩
-  · constructor
-    any_goals
-      rintro ⟨x', hx', rfl⟩
-      refine' ⟨x', _, rfl⟩
-      first |rwa [← z _]|rwa [z _]
-      rwa [StrictMono.lt_iff_lt h₁] at hx
-  · simp only [h₁.injective, Function.Injective.eq_iff]
-    exact fun x hx => ne_of_mem_of_not_mem hx ka
-#align colex.hom_lt_iff Colex.hom_lt_iff
-
-/-- A special case of `Colex.hom_lt_iff` which is sometimes useful. -/
-@[simp]
-theorem hom_fin_lt_iff {n : ℕ} (A B : Finset (Fin n)) :
-    (A.image fun i : Fin n => (i : ℕ)).toColex < (B.image fun i : Fin n => (i : ℕ)).toColex ↔
-      A.toColex < B.toColex := by
-  refine' Colex.hom_lt_iff _ _ _
-  exact (fun x y k => k)
-#align colex.hom_fin_lt_iff Colex.hom_fin_lt_iff
-
-instance [LT α] : IsIrrefl (Finset.Colex α) (· < ·) :=
-  ⟨fun _ h => Exists.elim h fun _ ⟨_, a, b⟩ => a b⟩
-
-@[trans]
-theorem lt_trans [LinearOrder α] {a b c : Finset.Colex α} : a < b → b < c → a < c := by
-  rintro ⟨k₁, k₁z, notinA, inB⟩ ⟨k₂, k₂z, notinB, inC⟩
-  cases' lt_or_gt_of_ne (ne_of_mem_of_not_mem inB notinB) with h h
-  · refine' ⟨k₂, @fun x hx => _, _, inC⟩
-    rw [← k₂z hx]
-    apply k₁z (Trans.trans h hx)
-    rwa [k₁z h]
-  · refine' ⟨k₁, @fun x hx => _, notinA, by rwa [← k₂z h]⟩
-    rw [k₁z hx]
-    apply k₂z (Trans.trans h hx)
-#align colex.lt_trans Colex.lt_trans
-
-@[trans]
-theorem le_trans [LinearOrder α] (a b c : Finset.Colex α) : a ≤ b → b ≤ c → a ≤ c := fun AB BC =>
-  AB.elim (fun k => BC.elim (fun t => Or.inl (lt_trans k t)) fun t => t ▸ AB) fun k => k.symm ▸ BC
-#align colex.le_trans Colex.le_trans
-
-instance [LinearOrder α] : IsTrans (Finset.Colex α) (· < ·) :=
-  ⟨fun _ _ _ => Colex.lt_trans⟩
-
-theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B ∨ B < A := by
-  by_cases h₁ : A = B
-  · tauto
-  have h : Finset.Nonempty (A \ B ∪ B \ A) := by
-    rw [nonempty_iff_ne_empty]
-    intro a
-    simp only [union_eq_empty, sdiff_eq_empty_iff_subset] at a
-    apply h₁ (Subset.antisymm a.1 a.2)
-  rcases exists_max_image (A \ B ∪ B \ A) id h with ⟨k, ⟨hk, z⟩⟩
-  · simp only [mem_union, mem_sdiff] at hk
-    cases' hk with hk hk
-    · right
-      right
-      refine' ⟨k, @fun t th => _, hk.2, hk.1⟩
-      specialize z t
-      by_contra h₂
-      simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, not_not, and_comm] at h₂
-      apply not_le_of_lt th (z h₂)
-    · left
-      refine' ⟨k, @fun t th => _, hk.2, hk.1⟩
-      specialize z t
-      by_contra h₃
-      simp only [mem_union, mem_sdiff, id.def] at z
-      rw [not_iff, iff_iff_and_or_not_and_not, not_not, and_comm, or_comm] at h₃
-      apply not_le_of_lt th (z h₃)
-#align colex.lt_trichotomy Colex.lt_trichotomy
-
-instance [LinearOrder α] : IsTrichotomous (Finset.Colex α) (· < ·) :=
-  ⟨lt_trichotomy⟩
-
-instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (A < B) :=
-  show ∀ {A B : Finset α}, Decidable (A.toColex < B.toColex) from @fun A B =>
-    decidable_of_iff' (∃ k ∈ B, (∀ x ∈ A ∪ B, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A)
-      (by
-        rw [Colex.lt_def]
-        apply exists_congr
-        simp only [mem_union, exists_prop, or_imp, and_comm (a := _ ∈ B), and_assoc]
-        intro k
-        refine' and_congr_left' (forall_congr' _)
-        tauto)
-#align colex.decidable_lt Colex.decidableLt
-
-instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
-  { instLT,
-    instLE with
-    le_refl := fun A => Or.inr rfl
-    le_trans := le_trans
-    le_antisymm := fun A B AB BA =>
-      AB.elim (fun k => BA.elim (fun t => (asymm k t).elim) fun t => t.symm) id
-    le_total := fun A B =>
-      (lt_trichotomy A B).elim3 (Or.inl ∘ Or.inl) (Or.inl ∘ Or.inr) (Or.inr ∘ Or.inl)
-    -- Porting note: we must give some hints for instances
-    decidableLE := by
-      letI : DecidableEq (Finset.Colex α) := inferInstanceAs (DecidableEq (Finset α))
-      exact fun A B => inferInstanceAs (Decidable (A < B ∨ A = B))
-    decidableLT := inferInstance
-    decidableEq := inferInstanceAs (DecidableEq (Finset α))
-    lt_iff_le_not_le := fun A B => by
-      constructor
-      · intro t
-        refine' ⟨Or.inl t, _⟩
-        rintro (i | rfl)
-        · apply asymm_of _ t i
-        · apply irrefl _ t
-      rintro ⟨h₁ | rfl, h₂⟩
-      · apply h₁
-      apply h₂.elim (Or.inr rfl) }
-
-/-- The instances set up let us infer that `(· < ·)` is a strict total order. -/
-example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
-  inferInstance
+lemma toColex_image_le_toColex_image (hf : StrictMono f) :
+    toColex (s.image f) ≤ toColex (t.image f) ↔ toColex s ≤ toColex t := by
+  simp [toColex_le_toColex, hf.le_iff_le, hf.injective.eq_iff]
 
 /-- Strictly monotone functions preserve the colex ordering. -/
-theorem hom_le_iff {β : Type*} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
-    (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
-  rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
-#align colex.hom_le_iff Colex.hom_le_iff
+lemma toColex_image_lt_toColex_image (hf : StrictMono f) :
+    toColex (s.image f) < toColex (t.image f) ↔ toColex s < toColex t :=
+  lt_iff_lt_of_le_iff_le <| toColex_image_le_toColex_image hf
 
--- Porting note: fixed the doc
-/-- A special case of `hom_le_iff` which is sometimes useful. -/
-@[simp]
-theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
-    (A.image fun i : Fin n => (i : ℕ)).toColex ≤ (B.image fun i : Fin n => (i : ℕ)).toColex ↔
-      A.toColex ≤ B.toColex :=
-  Colex.hom_le_iff Fin.val_strictMono _ _
-#align colex.hom_fin_le_iff Colex.hom_fin_le_iff
+lemma toColex_image_ofColex_strictMono (hf : StrictMono f) :
+    StrictMono fun s ↦ toColex $ image f $ ofColex s :=
+  fun _s _t ↦ (toColex_image_lt_toColex_image hf).2
+
+/-! ### Initial segments -/
+
+/-- `𝒜` is an initial segment of the colexigraphic order on sets of `r`, and that if `t` is below
+`s` in colex where `t` has size `r` and `s` is in `𝒜`, then `t` is also in `𝒜`. In effect, `𝒜` is
+downwards closed with respect to colex among sets of size `r`. -/
+def IsInitSeg (𝒜 : Finset (Finset α)) (r : ℕ) : Prop :=
+  (𝒜 : Set (Finset α)).Sized r ∧
+    ∀ ⦃s t : Finset α⦄, s ∈ 𝒜 → toColex t < toColex s ∧ t.card = r → t ∈ 𝒜
+
+@[simp] lemma isInitSeg_empty : IsInitSeg (∅ : Finset (Finset α)) r := by simp [IsInitSeg]
 
-/-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
+/-- Initial segments are nested in some way. In particular, if they're the same size they're equal.
 -/
-theorem forall_lt_of_colex_lt_of_forall_lt [LinearOrder α] {A B : Finset α} (t : α)
-    (h₁ : A.toColex < B.toColex) (h₂ : ∀ x ∈ B, x < t) : ∀ x ∈ A, x < t := by
-  rw [Colex.lt_def] at h₁
-  rcases h₁ with ⟨k, z, _, _⟩
-  intro x hx
-  apply lt_of_not_ge
-  intro a
-  refine' not_lt_of_ge a (h₂ x _)
-  rwa [← z]
-  apply lt_of_lt_of_le (h₂ k ‹_›) a
-#align colex.forall_lt_of_colex_lt_of_forall_lt Colex.forall_lt_of_colex_lt_of_forall_lt
-
-/-- `s.toColex < {r}.toColex` iff all elements of `s` are less than `r`. -/
-theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
-    s.toColex < ({r} : Finset α).toColex ↔ ∀ x ∈ s, x < r := by
-  simp only [lt_def, mem_singleton, ← and_assoc, exists_eq_right]
-  constructor
-  · intro t x hx
-    rw [← not_le]
-    intro h
-    rcases lt_or_eq_of_le h with (h₁ | rfl)
-    · exact ne_of_irrefl h₁ ((t.1 h₁).1 hx).symm
-    · exact t.2 hx
-  · exact fun h =>
-      ⟨fun {z} hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩,
-          by simpa using h r⟩
-#align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
-
--- Porting note: fixed the doc
-/-- If `{r}` is less than or equal to s in the colexicographical sense,
-  then s contains an element greater than or equal to r. -/
-theorem mem_le_of_singleton_le [LinearOrder α] {r : α} {s : Finset α} :
-    ({r} : Finset α).toColex ≤ s.toColex ↔ ∃ x ∈ s, r ≤ x := by
-  simp only [← not_lt]
-  simp [lt_singleton_iff_mem_lt]
-#align colex.mem_le_of_singleton_le Colex.mem_le_of_singleton_le
-
-/-- Colex is an extension of the base ordering on α. -/
-theorem singleton_lt_iff_lt [LinearOrder α] {r s : α} :
-    ({r} : Finset α).toColex < ({s} : Finset α).toColex ↔ r < s := by simp [lt_singleton_iff_mem_lt]
-#align colex.singleton_lt_iff_lt Colex.singleton_lt_iff_lt
-
-/-- Colex is an extension of the base ordering on α. -/
-theorem singleton_le_iff_le [LinearOrder α] {r s : α} :
-    ({r} : Finset α).toColex ≤ ({s} : Finset α).toColex ↔ r ≤ s := by
-  rw [le_iff_le_iff_lt_iff_lt, singleton_lt_iff_lt]
-#align colex.singleton_le_iff_le Colex.singleton_le_iff_le
-
-/-- Colex doesn't care if you remove the other set -/
-@[simp]
-theorem sdiff_lt_sdiff_iff_lt [LT α] [DecidableEq α] (A B : Finset α) :
-    (A \ B).toColex < (B \ A).toColex ↔ A.toColex < B.toColex := by
-  rw [Colex.lt_def, Colex.lt_def]
-  apply exists_congr
-  intro k
-  simp only [mem_sdiff, not_and, not_not]
-  constructor
-  · rintro ⟨z, kAB, kB, kA⟩
-    refine' ⟨_, kA, kB⟩
-    · intro x hx
-      specialize z hx
-      tauto
-  · rintro ⟨z, kA, kB⟩
-    refine' ⟨_, fun _ => kB, kB, kA⟩
-    intro x hx
-    rw [z hx]
-#align colex.sdiff_lt_sdiff_iff_lt Colex.sdiff_lt_sdiff_iff_lt
-
-/-- Colex doesn't care if you remove the other set -/
-@[simp]
-theorem sdiff_le_sdiff_iff_le [LinearOrder α] (A B : Finset α) :
-    (A \ B).toColex ≤ (B \ A).toColex ↔ A.toColex ≤ B.toColex := by
-  rw [le_iff_le_iff_lt_iff_lt, sdiff_lt_sdiff_iff_lt]
-#align colex.sdiff_le_sdiff_iff_le Colex.sdiff_le_sdiff_iff_le
-
-theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
-    (∅ : Finset α).toColex < A.toColex := by
-  rw [Colex.lt_def]
-  refine' ⟨max' _ hA, _, by simp, max'_mem _ _⟩
-  simp only [false_iff_iff, not_mem_empty]
-  intro x hx t
-  apply not_le_of_lt hx (le_max' _ _ t)
-#align colex.empty_to_colex_lt Colex.empty_toColex_lt
-
-/-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
-`⊆` is not a linear order. -/
-theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) :
-    A.toColex < B.toColex := by
-  rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
-  exact empty_toColex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
-#align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
+lemma IsInitSeg.total (h₁ : IsInitSeg 𝒜₁ r) (h₂ : IsInitSeg 𝒜₂ r) : 𝒜₁ ⊆ 𝒜₂ ∨ 𝒜₂ ⊆ 𝒜₁ := by
+  classical
+  simp_rw [←sdiff_eq_empty_iff_subset, ←not_nonempty_iff_eq_empty]
+  by_contra' h
+  have ⟨⟨s, hs⟩, t, ht⟩ := h
+  rw [mem_sdiff] at hs ht
+  obtain hst | hst | hts := trichotomous_of (α := Colex α) (· < ·) (toColex s) (toColex t)
+  · exact hs.2 <| h₂.2 ht.1 ⟨hst, h₁.1 hs.1⟩
+  · simp only [toColex.injEq] at hst
+    exact ht.2 <| hst ▸ hs.1
+  · exact ht.2 <| h₁.2 hs.1 ⟨hts, h₂.1 ht.1⟩
+
+variable [Fintype α]
+
+/-- The initial segment of the colexicographic order on sets with `s.card` elements and ending at
+`s`. -/
+def initSeg (s : Finset α) : Finset (Finset α) :=
+  univ.filter fun t ↦ s.card = t.card ∧ toColex t ≤ toColex s
 
 @[simp]
-theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex := by
-  rcases A.eq_empty_or_nonempty with (rfl | hA)
-  · simp
-  · apply (empty_toColex_lt hA).le
-#align colex.empty_to_colex_le Colex.empty_toColex_le
-
-/-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
-linear order. -/
-theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) :
-    A.toColex ≤ B.toColex := by
-  rw [← sdiff_le_sdiff_iff_le, sdiff_eq_empty_iff_subset.2 h]
-  apply empty_toColex_le
-#align colex.colex_le_of_subset Colex.colex_le_of_subset
-
-/-- The function from finsets to finsets with the colex order is a relation homomorphism. -/
-@[simps]
-def toColexRelHom [LinearOrder α] :
-    ((· ⊆ ·) : Finset α → Finset α → Prop) →r ((· ≤ ·) : Finset.Colex α → Finset.Colex α → Prop)
-    where
-  toFun := Finset.toColex
-  map_rel' {_ _} := colex_le_of_subset
-#align colex.to_colex_rel_hom Colex.toColexRelHom
-
-instance [LinearOrder α] : OrderBot (Finset.Colex α) where
-  bot := (∅ : Finset α).toColex
-  bot_le _ := empty_toColex_le
-
-instance [LinearOrder α] [Fintype α] : OrderTop (Finset.Colex α) where
-  top := Finset.univ.toColex
-  le_top _ := colex_le_of_subset (subset_univ _)
-
-instance [LinearOrder α] : Lattice (Finset.Colex α) :=
-  { inferInstanceAs (SemilatticeSup (Finset.Colex α)),
-    inferInstanceAs (SemilatticeInf (Finset.Colex α)) with }
-
-instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
-  { inferInstanceAs (OrderTop (Finset.Colex α)),
-    inferInstanceAs (OrderBot (Finset.Colex α)) with }
-
-/-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
-theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
-    ((∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i) ↔ A.toColex < B.toColex := by
-  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i := by
-    intro A B
-    rw [← sdiff_lt_sdiff_iff_lt, Colex.lt_def]
-    rintro ⟨k, z, kA, kB⟩
-    rw [← sdiff_union_inter A B]
-    conv_rhs => rw [← sdiff_union_inter B A]
-    rw [sum_union (disjoint_sdiff_inter _ _), sum_union (disjoint_sdiff_inter _ _), inter_comm,
-      add_lt_add_iff_right]
-    apply lt_of_lt_of_le (@Nat.sum_two_pow_lt k (A \ B) _)
-    · apply single_le_sum (fun _ _ => Nat.zero_le _) kB
-    intro x hx
-    apply lt_of_le_of_ne (le_of_not_lt _)
-    · apply ne_of_mem_of_not_mem hx kA
-    -- Porting note: `intro` required because `apply` behaves differently
-    intro kx
-    have := (z kx).1 hx
-    rw [mem_sdiff] at this hx
-    exact hx.2 this.1
-  refine'
-    ⟨fun h => (lt_trichotomy A B).resolve_right fun h₁ => h₁.elim _ (not_lt_of_gt h ∘ z _ _), z A B⟩
-  rintro rfl
-  apply irrefl _ h
-#align colex.sum_two_pow_lt_iff_lt Colex.sum_two_pow_lt_iff_lt
-
-/-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
-theorem sum_two_pow_le_iff_lt (A B : Finset ℕ) :
-    ((∑ i in A, 2 ^ i) ≤ ∑ i in B, 2 ^ i) ↔ A.toColex ≤ B.toColex := by
-  rw [le_iff_le_iff_lt_iff_lt, sum_two_pow_lt_iff_lt]
-#align colex.sum_two_pow_le_iff_lt Colex.sum_two_pow_le_iff_lt
+lemma mem_initSeg : t ∈ initSeg s ↔ s.card = t.card ∧ toColex t ≤ toColex s := by simp [initSeg]
+
+lemma mem_initSeg_self : s ∈ initSeg s := by simp
+@[simp] lemma initSeg_nonempty : (initSeg s).Nonempty := ⟨s, mem_initSeg_self⟩
+
+lemma isInitSeg_initSeg : IsInitSeg (initSeg s) s.card := by
+  refine ⟨fun t ht => (mem_initSeg.1 ht).1.symm, fun t₁ t₂ ht₁ ht₂ ↦ mem_initSeg.2 ⟨ht₂.2.symm, ?_⟩⟩
+  rw [mem_initSeg] at ht₁
+  exact ht₂.1.le.trans ht₁.2
+
+lemma IsInitSeg.exists_initSeg (h𝒜 : IsInitSeg 𝒜 r) (h𝒜₀ : 𝒜.Nonempty) :
+    ∃ s : Finset α, s.card = r ∧ 𝒜 = initSeg s := by
+  have hs := sup'_mem (ofColex ⁻¹' 𝒜) (LinearOrder.supClosed _) 𝒜 h𝒜₀ toColex
+    (fun a ha ↦ by simpa using ha)
+  refine' ⟨_, h𝒜.1 hs, _⟩
+  ext t
+  rw [mem_initSeg]
+  refine' ⟨fun p ↦ _, _⟩
+  · rw [h𝒜.1 p, h𝒜.1 hs]
+    exact ⟨rfl, le_sup' _ p⟩
+  rintro ⟨cards, le⟩
+  obtain p | p := le.eq_or_lt
+  · rwa [toColex_inj.1 p]
+  · exact h𝒜.2 hs ⟨p, cards ▸ h𝒜.1 hs⟩
+
+/-- Being a nonempty initial segment of colex is equivalent to being an `initSeg`. -/
+lemma isInitSeg_iff_exists_initSeg :
+    IsInitSeg 𝒜 r ∧ 𝒜.Nonempty ↔ ∃ s : Finset α, s.card = r ∧ 𝒜 = initSeg s := by
+  refine ⟨fun h𝒜 ↦ h𝒜.1.exists_initSeg h𝒜.2, ?_⟩
+  rintro ⟨s, rfl, rfl⟩
+  exact ⟨isInitSeg_initSeg, initSeg_nonempty⟩
 
 end Colex
+
+open Colex
+
+/-!
+### Colex on `ℕ`
+
+The colexicographic order agrees with the order induced by interpreting a set of naturals as a
+`n`-ary expansion.
+-/
+
+section Nat
+variable {s t : Finset ℕ} {n : ℕ}
+
+lemma geomSum_ofColex_strictMono (hn : 2 ≤ n) : StrictMono fun s ↦ ∑ k in ofColex s, n ^ k := by
+  rintro ⟨s⟩ ⟨t⟩ hst
+  rw [toColex_lt_toColex_iff_exists_forall_lt] at hst
+  obtain ⟨a, hat, has, ha⟩ := hst
+  rw [←sum_sdiff_lt_sum_sdiff]
+  exact (Nat.geomSum_lt hn $ by simpa).trans_le <| single_le_sum (fun _ _ ↦ by positivity) <|
+    mem_sdiff.2 ⟨hat, has⟩
+
+/-- For finsets of naturals of naturals, the colexicographic order is equivalent to the order
+induced by the `n`-ary expansion. -/
+lemma geomSum_le_geomSum_iff_toColex_le_toColex (hn : 2 ≤ n) :
+    ∑ k in s, n ^ k ≤ ∑ k in t, n ^ k ↔ toColex s ≤ toColex t :=
+  (geomSum_ofColex_strictMono hn).le_iff_le
+
+/-- For finsets of naturals of naturals, the colexicographic order is equivalent to the order
+induced by the `n`-ary expansion. -/
+lemma geomSum_lt_geomSum_iff_toColex_lt_toColex (hn : 2 ≤ n) :
+    ∑ i in s, n ^ i < ∑ i in t, n ^ i ↔ toColex s < toColex t :=
+  (geomSum_ofColex_strictMono hn).lt_iff_lt
+
+-- TODO: Package the above in the `n = 2` case as an order isomorphism `Colex ℕ ≃o ℕ`
+
+end Nat
+end Finset
chore: Make Set/Finset lemmas match lattice lemma names (#7378)

Rename union_eq_left_iff_subset to union_eq_left to match sup_eq_left. Similarly for the right and inter versions.

Diff
@@ -171,7 +171,7 @@ theorem lt_trichotomy [LinearOrder α] (A B : Finset.Colex α) : A < B ∨ A = B
   have h : Finset.Nonempty (A \ B ∪ B \ A) := by
     rw [nonempty_iff_ne_empty]
     intro a
-    simp only [union_eq_empty_iff, sdiff_eq_empty_iff_subset] at a
+    simp only [union_eq_empty, sdiff_eq_empty_iff_subset] at a
     apply h₁ (Subset.antisymm a.1 a.2)
   rcases exists_max_image (A \ B ∪ B \ A) id h with ⟨k, ⟨hk, z⟩⟩
   · simp only [mem_union, mem_sdiff] at hk
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
@@ -51,7 +51,7 @@ colex, colexicographic, binary
 -/
 
 
-variable {α : Type _}
+variable {α : Type*}
 
 open Finset
 open BigOperators
@@ -111,7 +111,7 @@ theorem Nat.sum_two_pow_lt {k : ℕ} {A : Finset ℕ} (h₁ : ∀ {x}, x ∈ A 
 namespace Colex
 
 /-- Strictly monotone functions preserve the colex ordering. -/
-theorem hom_lt_iff {β : Type _} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
+theorem hom_lt_iff {β : Type*} [LinearOrder α] [DecidableEq β] [Preorder β] {f : α → β}
     (h₁ : StrictMono f) (A B : Finset α) :
     (A.image f).toColex < (B.image f).toColex ↔ A.toColex < B.toColex := by
   simp only [Colex.lt_def, not_exists, mem_image, exists_prop, not_and]
@@ -239,7 +239,7 @@ example [LinearOrder α] : IsStrictTotalOrder (Finset.Colex α) (· < ·) :=
   inferInstance
 
 /-- Strictly monotone functions preserve the colex ordering. -/
-theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
+theorem hom_le_iff {β : Type*} [LinearOrder α] [LinearOrder β] {f : α → β} (h₁ : StrictMono f)
     (A B : Finset α) : (A.image f).toColex ≤ (B.image f).toColex ↔ A.toColex ≤ B.toColex := by
   rw [le_iff_le_iff_lt_iff_lt, hom_lt_iff h₁]
 #align colex.hom_le_iff Colex.hom_le_iff
chore: tidy various files (#6274)
Diff
@@ -81,11 +81,11 @@ theorem Colex.eq_iff (A B : Finset α) : A.toColex = B.toColex ↔ A = B :=
 /-- `A` is less than `B` in the colex ordering if the largest thing that's not in both sets is in B.
 In other words, `max (A ∆ B) ∈ B` (if the maximum exists).
 -/
-instance [LT α] : LT (Finset.Colex α) :=
+instance Colex.instLT [LT α] : LT (Finset.Colex α) :=
   ⟨fun A B : Finset α => ∃ k : α, (∀ {x}, k < x → (x ∈ A ↔ x ∈ B)) ∧ k ∉ A ∧ k ∈ B⟩
 
 /-- We can define (≤) in the obvious way. -/
-instance [LT α] : LE (Finset.Colex α) :=
+instance Colex.instLE [LT α] : LE (Finset.Colex α) :=
   ⟨fun A B => A < B ∨ A = B⟩
 
 theorem Colex.lt_def [LT α] (A B : Finset α) :
@@ -209,8 +209,8 @@ instance decidableLt [LinearOrder α] : ∀ {A B : Finset.Colex α}, Decidable (
 #align colex.decidable_lt Colex.decidableLt
 
 instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
-  { instLTColex,
-    instLEColex with
+  { instLT,
+    instLE with
     le_refl := fun A => Or.inr rfl
     le_trans := le_trans
     le_antisymm := fun A B AB BA =>
@@ -249,9 +249,8 @@ theorem hom_le_iff {β : Type _} [LinearOrder α] [LinearOrder β] {f : α → 
 @[simp]
 theorem hom_fin_le_iff {n : ℕ} (A B : Finset (Fin n)) :
     (A.image fun i : Fin n => (i : ℕ)).toColex ≤ (B.image fun i : Fin n => (i : ℕ)).toColex ↔
-      A.toColex ≤ B.toColex := by
-  refine' Colex.hom_le_iff _ _ _
-  exact (fun x y k => k)
+      A.toColex ≤ B.toColex :=
+  Colex.hom_le_iff Fin.val_strictMono _ _
 #align colex.hom_fin_le_iff Colex.hom_fin_le_iff
 
 /-- If `A` is before `B` in colex, and everything in `B` is small, then everything in `A` is small.
@@ -280,7 +279,7 @@ theorem lt_singleton_iff_mem_lt [LinearOrder α] {r : α} {s : Finset α} :
     · exact ne_of_irrefl h₁ ((t.1 h₁).1 hx).symm
     · exact t.2 hx
   · exact fun h =>
-      ⟨@fun z hz => ⟨@fun i => (asymm hz (h _ i)).elim, @fun i => (hz.ne' i).elim⟩,
+      ⟨fun {z} hz => ⟨fun i => (asymm hz (h _ i)).elim, fun i => (hz.ne' i).elim⟩,
           by simpa using h r⟩
 #align colex.lt_singleton_iff_mem_lt Colex.lt_singleton_iff_mem_lt
 
@@ -372,13 +371,11 @@ def toColexRelHom [LinearOrder α] :
   map_rel' {_ _} := colex_le_of_subset
 #align colex.to_colex_rel_hom Colex.toColexRelHom
 
-instance [LinearOrder α] : OrderBot (Finset.Colex α)
-    where
+instance [LinearOrder α] : OrderBot (Finset.Colex α) where
   bot := (∅ : Finset α).toColex
   bot_le _ := empty_toColex_le
 
-instance [LinearOrder α] [Fintype α] : OrderTop (Finset.Colex α)
-    where
+instance [LinearOrder α] [Fintype α] : OrderTop (Finset.Colex α) where
   top := Finset.univ.toColex
   le_top _ := colex_le_of_subset (subset_univ _)
 
@@ -387,8 +384,8 @@ instance [LinearOrder α] : Lattice (Finset.Colex α) :=
     inferInstanceAs (SemilatticeInf (Finset.Colex α)) with }
 
 instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
-  { (by infer_instance : OrderTop (Finset.Colex α)),
-    (by infer_instance : OrderBot (Finset.Colex α)) with }
+  { inferInstanceAs (OrderTop (Finset.Colex α)),
+    inferInstanceAs (OrderBot (Finset.Colex α)) with }
 
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
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,15 +2,12 @@
 Copyright (c) 2020 Bhavik Mehta. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Bhavik Mehta, Alena Gusakov
-
-! This file was ported from Lean 3 source module combinatorics.colex
-! leanprover-community/mathlib commit f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Fintype.Basic
 import Mathlib.Algebra.GeomSum
 
+#align_import combinatorics.colex from "leanprover-community/mathlib"@"f7fc89d5d5ff1db2d1242c7bb0e9062ce47ef47c"
+
 /-!
 # Colex
 
fix: ∑' precedence (#5615)
  • Also remove most superfluous parentheses around big operators (, and variants).
  • roughly the used regex: ([^a-zA-Zα-ωΑ-Ω'𝓝ℳ₀𝕂ₛ)]) \(([∑∏][^()∑∏]*,[^()∑∏:]*)\) ([⊂⊆=<≤]) replaced by $1 $2 $3
Diff
@@ -396,7 +396,7 @@ instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     ((∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i) ↔ A.toColex < B.toColex := by
-  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → (∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i := by
+  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → ∑ i in A, 2 ^ i < ∑ i in B, 2 ^ i := by
     intro A B
     rw [← sdiff_lt_sdiff_iff_lt, Colex.lt_def]
     rintro ⟨k, z, kA, kB⟩
fix: correct names of LinearOrder decidable fields (#4006)

This renames

  • decidable_eq to decidableEq
  • decidable_lt to decidableLT
  • decidable_le to decidableLE
  • decidableLT_of_decidableLE to decidableLTOfDecidableLE
  • decidableEq_of_decidableLE to decidableEqOfDecidableLE

These fields are data not proofs, so they should be lowerCamelCased.

Diff
@@ -221,11 +221,11 @@ instance [LinearOrder α] : LinearOrder (Finset.Colex α) :=
     le_total := fun A B =>
       (lt_trichotomy A B).elim3 (Or.inl ∘ Or.inl) (Or.inl ∘ Or.inr) (Or.inr ∘ Or.inl)
     -- Porting note: we must give some hints for instances
-    decidable_le := by
+    decidableLE := by
       letI : DecidableEq (Finset.Colex α) := inferInstanceAs (DecidableEq (Finset α))
       exact fun A B => inferInstanceAs (Decidable (A < B ∨ A = B))
-    decidable_lt := inferInstance
-    decidable_eq := inferInstanceAs (DecidableEq (Finset α))
+    decidableLT := inferInstance
+    decidableEq := inferInstanceAs (DecidableEq (Finset α))
     lt_iff_le_not_le := fun A B => by
       constructor
       · intro t
chore: bye-bye, solo bys! (#3825)

This PR puts, with one exception, every single remaining by that lies all by itself on its own line to the previous line, thus matching the current behaviour of start-port.sh. The exception is when the by begins the second or later argument to a tuple or anonymous constructor; see https://github.com/leanprover-community/mathlib4/pull/3825#discussion_r1186702599.

Essentially this is s/\n *by$/ by/g, but with manual editing to satisfy the linter's max-100-char-line requirement. The Python style linter is also modified to catch these "isolated bys".

Diff
@@ -345,8 +345,8 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
 
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
-theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
-  by
+theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) :
+    A.toColex < B.toColex := by
   rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
   exact empty_toColex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
 #align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
@@ -360,8 +360,8 @@ theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).to
 
 /-- If `A ⊆ B`, then `A ≤ B` in the colex order. Note the converse does not hold, as `⊆` is not a
 linear order. -/
-theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) : A.toColex ≤ B.toColex :=
-  by
+theorem colex_le_of_subset [LinearOrder α] {A B : Finset α} (h : A ⊆ B) :
+    A.toColex ≤ B.toColex := by
   rw [← sdiff_le_sdiff_iff_le, sdiff_eq_empty_iff_subset.2 h]
   apply empty_toColex_le
 #align colex.colex_le_of_subset Colex.colex_le_of_subset
@@ -396,8 +396,7 @@ instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
 /-- For subsets of ℕ, we can show that colex is equivalent to binary. -/
 theorem sum_two_pow_lt_iff_lt (A B : Finset ℕ) :
     ((∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i) ↔ A.toColex < B.toColex := by
-  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → (∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i :=
-    by
+  have z : ∀ A B : Finset ℕ, A.toColex < B.toColex → (∑ i in A, 2 ^ i) < ∑ i in B, 2 ^ i := by
     intro A B
     rw [← sdiff_lt_sdiff_iff_lt, Colex.lt_def]
     rintro ⟨k, z, kA, kB⟩
chore: tidy various files (#2251)
Diff
@@ -345,11 +345,11 @@ theorem empty_toColex_lt [LinearOrder α] {A : Finset α} (hA : A.Nonempty) :
 
 /-- If `A ⊂ B`, then `A` is less than `B` in the colex order. Note the converse does not hold, as
 `⊆` is not a linear order. -/
-theorem colex_lt_of_sSubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
+theorem colex_lt_of_ssubset [LinearOrder α] {A B : Finset α} (h : A ⊂ B) : A.toColex < B.toColex :=
   by
   rw [← sdiff_lt_sdiff_iff_lt, sdiff_eq_empty_iff_subset.2 h.1]
   exact empty_toColex_lt (by simpa [Finset.Nonempty] using exists_of_ssubset h)
-#align colex.colex_lt_of_ssubset Colex.colex_lt_of_sSubset
+#align colex.colex_lt_of_ssubset Colex.colex_lt_of_ssubset
 
 @[simp]
 theorem empty_toColex_le [LinearOrder α] {A : Finset α} : (∅ : Finset α).toColex ≤ A.toColex := by
chore: bump to leanprover/lean4:nightly-2023-02-10 (#2188)
Diff
@@ -386,8 +386,8 @@ instance [LinearOrder α] [Fintype α] : OrderTop (Finset.Colex α)
   le_top _ := colex_le_of_subset (subset_univ _)
 
 instance [LinearOrder α] : Lattice (Finset.Colex α) :=
-  { (by infer_instance : SemilatticeSup (Finset.Colex α)),
-    (by infer_instance : SemilatticeInf (Finset.Colex α)) with }
+  { inferInstanceAs (SemilatticeSup (Finset.Colex α)),
+    inferInstanceAs (SemilatticeInf (Finset.Colex α)) with }
 
 instance [LinearOrder α] [Fintype α] : BoundedOrder (Finset.Colex α) :=
   { (by infer_instance : OrderTop (Finset.Colex α)),
feat: port Combinatorics.Colex (#1926)

Co-authored-by: Moritz Firsching <firsching@google.com> Co-authored-by: Komyyy <pol_tta@outlook.jp>

Dependencies 7 + 254

255 files ported (97.3%)
109240 lines ported (97.3%)
Show graph

The unported dependencies are