logic.equiv.listMathlib.Logic.Equiv.List

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)

(last sync)

fix(*): missing universe polymorphism (#18644)

These are all just typo fixes, no proof adaptations.

This deliberately leaves alone things related to category theory and algebraic geometry, as there the lack of polymorphism is likely deliberate.

Diff
@@ -347,7 +347,7 @@ def list_unit_equiv : list unit ≃ ℕ :=
 def list_nat_equiv_nat : list ℕ ≃ ℕ := denumerable.eqv _
 
 /-- If `α` is equivalent to `ℕ`, then `list α` is equivalent to `α`. -/
-def list_equiv_self_of_equiv_nat {α : Type} (e : α ≃ ℕ) : list α ≃ α :=
+def list_equiv_self_of_equiv_nat {α : Type*} (e : α ≃ ℕ) : list α ≃ α :=
 calc list α ≃ list ℕ : list_equiv_of_equiv e
         ... ≃ ℕ      : list_nat_equiv_nat
         ... ≃ α      : e.symm

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(first ported)

Changes in mathlib3port

mathlib3
mathlib3port
Diff
@@ -313,11 +313,11 @@ theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encode
   | succ v => by
     cases' e : unpair v with v₁ v₂
     have h := unpair_right_le v
-    rw [e] at h 
+    rw [e] at h
     rcases have : v₂ < succ v := lt_succ_of_le h
       denumerable_list_aux v₂ with
       ⟨a, h₁, h₂⟩
-    rw [Option.mem_def] at h₁ 
+    rw [Option.mem_def] at h₁
     use of_nat α v₁ :: a
     simp [decode_list, e, h₂, h₁, encode_list, mkpair_unpair' e]
 #align denumerable.denumerable_list_aux Denumerable.denumerable_list_aux
@@ -411,9 +411,9 @@ instance multiset : Denumerable (Multiset α) :=
       Multiset.map (ofNat α) (raise (ofNat (List ℕ) n) 0), fun s => by
       have :=
           raise_lower (List.sorted_cons.2 ⟨fun n _ => zero_le n, (s.map encode).sort_sorted _⟩) <;>
-        simp [-Multiset.coe_map, this],
+        simp [-Multiset.map_coe, this],
       fun n => by
-      simp [-Multiset.coe_map, List.mergeSort_eq_self _ (raise_sorted _ _), lower_raise]⟩
+      simp [-Multiset.map_coe, List.mergeSort_eq_self _ (raise_sorted _ _), lower_raise]⟩
 #align denumerable.multiset Denumerable.multiset
 -/
 
@@ -488,10 +488,10 @@ instance finset : Denumerable (Finset α) :=
     ⟨fun s : Finset α => encode <| lower' ((s.map (eqv α).toEmbedding).sort (· ≤ ·)) 0, fun n =>
       Finset.map (eqv α).symm.toEmbedding (raise'Finset (ofNat (List ℕ) n) 0), fun s =>
       Finset.eq_of_veq <| by
-        simp [-Multiset.coe_map, raise'_finset,
+        simp [-Multiset.map_coe, raise'_finset,
           raise_lower' (fun n _ => zero_le n) (Finset.sort_sorted_lt _)],
       fun n => by
-      simp [-Multiset.coe_map, Finset.map, raise'_finset, Finset.sort,
+      simp [-Multiset.map_coe, Finset.map, raise'_finset, Finset.sort,
         List.mergeSort_eq_self (· ≤ ·) ((raise'_sorted _ _).imp (@le_of_lt _ _)), lower_raise']⟩
 #align denumerable.finset Denumerable.finset
 -/
Diff
@@ -171,7 +171,8 @@ def Fintype.truncEncodable (α : Type _) [DecidableEq α] [Fintype α] : Trunc (
 /-- A noncomputable way to arbitrarily choose an ordering on a finite type.
 It is not made into a global instance, since it involves an arbitrary choice.
 This can be locally made into an instance with `local attribute [instance] fintype.to_encodable`. -/
-noncomputable def Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α := by classical
+noncomputable def Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α := by
+  classical exact (Fintype.truncEncodable α).out
 #align fintype.to_encodable Fintype.toEncodable
 -/
 
Diff
@@ -171,8 +171,7 @@ def Fintype.truncEncodable (α : Type _) [DecidableEq α] [Fintype α] : Trunc (
 /-- A noncomputable way to arbitrarily choose an ordering on a finite type.
 It is not made into a global instance, since it involves an arbitrary choice.
 This can be locally made into an instance with `local attribute [instance] fintype.to_encodable`. -/
-noncomputable def Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α := by
-  classical exact (Fintype.truncEncodable α).out
+noncomputable def Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α := by classical
 #align fintype.to_encodable Fintype.toEncodable
 -/
 
Diff
@@ -3,9 +3,9 @@ Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 -/
-import Mathbin.Data.Finset.Sort
-import Mathbin.Data.Vector.Basic
-import Mathbin.Logic.Denumerable
+import Data.Finset.Sort
+import Data.Vector.Basic
+import Logic.Denumerable
 
 #align_import logic.equiv.list from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
 
Diff
@@ -2,16 +2,13 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module logic.equiv.list
-! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Data.Finset.Sort
 import Mathbin.Data.Vector.Basic
 import Mathbin.Logic.Denumerable
 
+#align_import logic.equiv.list from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
+
 /-!
 # Equivalences involving `list`-like types
 
Diff
@@ -90,6 +90,7 @@ theorem decode_list_zero : decode (List α) 0 = some [] :=
 #align encodable.decode_list_zero Encodable.decode_list_zero
 -/
 
+#print Encodable.decode_list_succ /-
 @[simp]
 theorem decode_list_succ (v : ℕ) :
     decode (List α) (succ v) = (· :: ·) <$> decode α v.unpair.1 <*> decode (List α) v.unpair.2 :=
@@ -97,6 +98,7 @@ theorem decode_list_succ (v : ℕ) :
     cases' e : unpair v with v₁ v₂
     simp [decode_list, e]; rfl
 #align encodable.decode_list_succ Encodable.decode_list_succ
+-/
 
 #print Encodable.length_le_encode /-
 theorem length_le_encode : ∀ l : List α, length l ≤ encode l
@@ -308,6 +310,7 @@ open Encodable
 
 section List
 
+#print Denumerable.denumerable_list_aux /-
 theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encodeList a = n
   | 0 => by rw [decode_list] <;> exact ⟨_, rfl, rfl⟩
   | succ v => by
@@ -321,6 +324,7 @@ theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encode
     use of_nat α v₁ :: a
     simp [decode_list, e, h₂, h₁, encode_list, mkpair_unpair' e]
 #align denumerable.denumerable_list_aux Denumerable.denumerable_list_aux
+-/
 
 #print Denumerable.denumerableList /-
 /-- If `α` is denumerable, then so is `list α`. -/
Diff
@@ -525,7 +525,6 @@ def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
     List α ≃ List ℕ := listEquivOfEquiv e
     _ ≃ ℕ := listNatEquivNat
     _ ≃ α := e.symm
-    
 #align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNat
 -/
 
Diff
@@ -237,7 +237,7 @@ encoding is not unique, we wrap it in `trunc` to preserve computability. -/
 def fintypePi (α : Type _) (π : α → Type _) [DecidableEq α] [Fintype α] [∀ a, Encodable (π a)] :
     Trunc (Encodable (∀ a, π a)) :=
   (Fintype.truncEncodable α).bind fun a =>
-    (@fintypeArrow α (Σa, π a) _ _ (@Sigma.encodable _ _ a _)).bind fun f =>
+    (@fintypeArrow α (Σ a, π a) _ _ (@Sigma.encodable _ _ a _)).bind fun f =>
       Trunc.mk <|
         @Encodable.ofEquiv _ _ (@Subtype.encodable _ _ f _) (Equiv.piEquivSubtypeSigma α π)
 #align encodable.fintype_pi Encodable.fintypePi
@@ -313,11 +313,11 @@ theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encode
   | succ v => by
     cases' e : unpair v with v₁ v₂
     have h := unpair_right_le v
-    rw [e] at h
+    rw [e] at h 
     rcases have : v₂ < succ v := lt_succ_of_le h
       denumerable_list_aux v₂ with
       ⟨a, h₁, h₂⟩
-    rw [Option.mem_def] at h₁
+    rw [Option.mem_def] at h₁ 
     use of_nat α v₁ :: a
     simp [decode_list, e, h₂, h₁, encode_list, mkpair_unpair' e]
 #align denumerable.denumerable_list_aux Denumerable.denumerable_list_aux
Diff
@@ -90,12 +90,6 @@ theorem decode_list_zero : decode (List α) 0 = some [] :=
 #align encodable.decode_list_zero Encodable.decode_list_zero
 -/
 
-/- warning: encodable.decode_list_succ -> Encodable.decode_list_succ is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Encodable.{u1} α] (v : Nat), Eq.{succ u1} (Option.{u1} (List.{u1} α)) (Encodable.decode.{u1} (List.{u1} α) (List.encodable.{u1} α _inst_1) (Nat.succ v)) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toHasSeq.{u1, u1} Option.{u1} (Monad.toApplicative.{u1, u1} Option.{u1} Option.monad.{u1})) (List.{u1} α) (List.{u1} α) (Functor.map.{u1, u1} Option.{u1} (Traversable.toFunctor.{u1} Option.{u1} Option.traversable.{u1}) α ((List.{u1} α) -> (List.{u1} α)) (fun (_x : α) (_y : List.{u1} α) => List.cons.{u1} α _x _y) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair v)))) (Encodable.decode.{u1} (List.{u1} α) (List.encodable.{u1} α _inst_1) (Prod.snd.{0, 0} Nat Nat (Nat.unpair v))))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Encodable.{u1} α] (v : Nat), Eq.{succ u1} (Option.{u1} (List.{u1} α)) (Encodable.decode.{u1} (List.{u1} α) (List.encodable.{u1} α _inst_1) (Nat.succ v)) (Seq.seq.{u1, u1} Option.{u1} (Applicative.toSeq.{u1, u1} Option.{u1} (Alternative.toApplicative.{u1, u1} Option.{u1} instAlternativeOption.{u1})) (List.{u1} α) (List.{u1} α) (Functor.map.{u1, u1} Option.{u1} instFunctorOption.{u1} α ((List.{u1} α) -> (List.{u1} α)) (fun (_x : α) (_y : List.{u1} α) => List.cons.{u1} α _x _y) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair v)))) (fun (x._@.Mathlib.Logic.Equiv.List._hyg.562 : Unit) => Encodable.decode.{u1} (List.{u1} α) (List.encodable.{u1} α _inst_1) (Prod.snd.{0, 0} Nat Nat (Nat.unpair v))))
-Case conversion may be inaccurate. Consider using '#align encodable.decode_list_succ Encodable.decode_list_succₓ'. -/
 @[simp]
 theorem decode_list_succ (v : ℕ) :
     decode (List α) (succ v) = (· :: ·) <$> decode α v.unpair.1 <*> decode (List α) v.unpair.2 :=
@@ -314,12 +308,6 @@ open Encodable
 
 section List
 
-/- warning: denumerable.denumerable_list_aux -> Denumerable.denumerable_list_aux is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} [_inst_1 : Denumerable.{u1} α] (n : Nat), Exists.{succ u1} (List.{u1} α) (fun (a : List.{u1} α) => Exists.{0} (Membership.Mem.{u1, u1} (List.{u1} α) (Option.{u1} (List.{u1} α)) (Option.hasMem.{u1} (List.{u1} α)) a (Encodable.decodeList.{u1} α (Denumerable.toEncodable.{u1} α _inst_1) n)) (fun (H : Membership.Mem.{u1, u1} (List.{u1} α) (Option.{u1} (List.{u1} α)) (Option.hasMem.{u1} (List.{u1} α)) a (Encodable.decodeList.{u1} α (Denumerable.toEncodable.{u1} α _inst_1) n)) => Eq.{1} Nat (Encodable.encodeList.{u1} α (Denumerable.toEncodable.{u1} α _inst_1) a) n))
-but is expected to have type
-  forall {α : Type.{u1}} [_inst_1 : Denumerable.{u1} α] (n : Nat), Exists.{succ u1} (List.{u1} α) (fun (a : List.{u1} α) => And (Membership.mem.{u1, u1} (List.{u1} α) (Option.{u1} (List.{u1} α)) (Option.instMembershipOption.{u1} (List.{u1} α)) a (Encodable.decodeList.{u1} α (Denumerable.toEncodable.{u1} α _inst_1) n)) (Eq.{1} Nat (Encodable.encodeList.{u1} α (Denumerable.toEncodable.{u1} α _inst_1) a) n))
-Case conversion may be inaccurate. Consider using '#align denumerable.denumerable_list_aux Denumerable.denumerable_list_auxₓ'. -/
 theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encodeList a = n
   | 0 => by rw [decode_list] <;> exact ⟨_, rfl, rfl⟩
   | succ v => by
Diff
@@ -63,10 +63,8 @@ instance List.encodable : Encodable (List α) :=
 -/
 
 #print List.countable /-
-instance List.countable {α : Type _} [Countable α] : Countable (List α) :=
-  by
-  haveI := Encodable.ofCountable α
-  infer_instance
+instance List.countable {α : Type _} [Countable α] : Countable (List α) := by
+  haveI := Encodable.ofCountable α; infer_instance
 #align list.countable List.countable
 -/
 
Diff
@@ -121,15 +121,12 @@ variable [Encodable α]
 
 private def enle : α → α → Prop :=
   encode ⁻¹'o (· ≤ ·)
-#align encodable.enle encodable.enle
 
 private theorem enle.is_linear_order : IsLinearOrder α Enle :=
   (RelEmbedding.preimage ⟨encode, encode_injective⟩ (· ≤ ·)).IsLinearOrder
-#align encodable.enle.is_linear_order encodable.enle.is_linear_order
 
 private def decidable_enle (a b : α) : Decidable (Enle a b) := by
   unfold enle Order.Preimage <;> infer_instance
-#align encodable.decidable_enle encodable.decidable_enle
 
 attribute [local instance] enle.is_linear_order decidable_enle
 
Diff
@@ -191,7 +191,7 @@ noncomputable def Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α
 #print Vector.encodable /-
 /-- If `α` is encodable, then so is `vector α n`. -/
 instance Vector.encodable [Encodable α] {n} : Encodable (Vector α n) :=
-  Encodable.Subtype.encodable
+  Subtype.encodable
 #align vector.encodable Vector.encodable
 -/
 
@@ -248,10 +248,9 @@ encoding is not unique, we wrap it in `trunc` to preserve computability. -/
 def fintypePi (α : Type _) (π : α → Type _) [DecidableEq α] [Fintype α] [∀ a, Encodable (π a)] :
     Trunc (Encodable (∀ a, π a)) :=
   (Fintype.truncEncodable α).bind fun a =>
-    (@fintypeArrow α (Σa, π a) _ _ (@Encodable.Sigma.encodable _ _ a _)).bind fun f =>
+    (@fintypeArrow α (Σa, π a) _ _ (@Sigma.encodable _ _ a _)).bind fun f =>
       Trunc.mk <|
-        @Encodable.ofEquiv _ _ (@Encodable.Subtype.encodable _ _ f _)
-          (Equiv.piEquivSubtypeSigma α π)
+        @Encodable.ofEquiv _ _ (@Subtype.encodable _ _ f _) (Equiv.piEquivSubtypeSigma α π)
 #align encodable.fintype_pi Encodable.fintypePi
 -/
 
Diff
@@ -37,7 +37,7 @@ variable [Encodable α]
 /-- Explicit encoding function for `list α` -/
 def encodeList : List α → ℕ
   | [] => 0
-  | a :: l => succ (mkpair (encode a) (encode_list l))
+  | a :: l => succ (pair (encode a) (encode_list l))
 #align encodable.encode_list Encodable.encodeList
 -/
 
@@ -80,7 +80,7 @@ theorem encode_list_nil : encode (@nil α) = 0 :=
 #print Encodable.encode_list_cons /-
 @[simp]
 theorem encode_list_cons (a : α) (l : List α) :
-    encode (a :: l) = succ (mkpair (encode a) (encode l)) :=
+    encode (a :: l) = succ (pair (encode a) (encode l)) :=
   rfl
 #align encodable.encode_list_cons Encodable.encode_list_cons
 -/
@@ -109,7 +109,7 @@ theorem decode_list_succ (v : ℕ) :
 #print Encodable.length_le_encode /-
 theorem length_le_encode : ∀ l : List α, length l ≤ encode l
   | [] => zero_le _
-  | a :: l => succ_le_succ <| (length_le_encode l).trans (right_le_mkpair _ _)
+  | a :: l => succ_le_succ <| (length_le_encode l).trans (right_le_pair _ _)
 #align encodable.length_le_encode Encodable.length_le_encode
 -/
 
Diff
@@ -536,12 +536,7 @@ def listNatEquivNat : List ℕ ≃ ℕ :=
 #align equiv.list_nat_equiv_nat Equiv.listNatEquivNat
 -/
 
-/- warning: equiv.list_equiv_self_of_equiv_nat -> Equiv.listEquivSelfOfEquivNat is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u_1}}, (Equiv.{succ u_1, 1} α Nat) -> (Equiv.{succ u_1, succ u_1} (List.{u_1} α) α)
-but is expected to have type
-  forall {α : Type}, (Equiv.{1, 1} α Nat) -> (Equiv.{1, 1} (List.{0} α) α)
-Case conversion may be inaccurate. Consider using '#align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNatₓ'. -/
+#print Equiv.listEquivSelfOfEquivNat /-
 /-- If `α` is equivalent to `ℕ`, then `list α` is equivalent to `α`. -/
 def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
   calc
@@ -550,6 +545,7 @@ def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
     _ ≃ α := e.symm
     
 #align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNat
+-/
 
 end Equiv
 
Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module logic.equiv.list
-! leanprover-community/mathlib commit 327c3c0d9232d80e250dc8f65e7835b82b266ea5
+! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
@@ -536,16 +536,20 @@ def listNatEquivNat : List ℕ ≃ ℕ :=
 #align equiv.list_nat_equiv_nat Equiv.listNatEquivNat
 -/
 
-#print Equiv.listEquivSelfOfEquivNat /-
+/- warning: equiv.list_equiv_self_of_equiv_nat -> Equiv.listEquivSelfOfEquivNat is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u_1}}, (Equiv.{succ u_1, 1} α Nat) -> (Equiv.{succ u_1, succ u_1} (List.{u_1} α) α)
+but is expected to have type
+  forall {α : Type}, (Equiv.{1, 1} α Nat) -> (Equiv.{1, 1} (List.{0} α) α)
+Case conversion may be inaccurate. Consider using '#align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNatₓ'. -/
 /-- If `α` is equivalent to `ℕ`, then `list α` is equivalent to `α`. -/
-def listEquivSelfOfEquivNat {α : Type} (e : α ≃ ℕ) : List α ≃ α :=
+def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
   calc
     List α ≃ List ℕ := listEquivOfEquiv e
     _ ≃ ℕ := listNatEquivNat
     _ ≃ α := e.symm
     
 #align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNat
--/
 
 end Equiv
 

Changes in mathlib4

mathlib3
mathlib4
chore: Rename lemmas about the coercion List → Multiset (#11099)

These did not respect the naming convention by having the coe as a prefix instead of a suffix, or vice-versa. Also add a bunch of norm_cast

Diff
@@ -330,9 +330,9 @@ instance multiset : Denumerable (Multiset α) :=
      fun s => by
       have :=
         raise_lower (List.sorted_cons.2 ⟨fun n _ => Nat.zero_le n, (s.map encode).sort_sorted _⟩)
-      simp [-Multiset.coe_map, this],
+      simp [-Multiset.map_coe, this],
      fun n => by
-      simp [-Multiset.coe_map, List.mergeSort_eq_self _ (raise_sorted _ _), lower_raise]⟩
+      simp [-Multiset.map_coe, List.mergeSort_eq_self _ (raise_sorted _ _), lower_raise]⟩
 #align denumerable.multiset Denumerable.multiset
 
 end Multiset
@@ -391,10 +391,10 @@ instance finset : Denumerable (Finset α) :=
     ⟨fun s : Finset α => encode <| lower' ((s.map (eqv α).toEmbedding).sort (· ≤ ·)) 0, fun n =>
       Finset.map (eqv α).symm.toEmbedding (raise'Finset (ofNat (List ℕ) n) 0), fun s =>
       Finset.eq_of_veq <| by
-        simp [-Multiset.coe_map, raise'Finset,
+        simp [-Multiset.map_coe, raise'Finset,
           raise_lower' (fun n _ => Nat.zero_le n) (Finset.sort_sorted_lt _)],
       fun n => by
-      simp [-Multiset.coe_map, Finset.map, raise'Finset, Finset.sort,
+      simp [-Multiset.map_coe, Finset.map, raise'Finset, Finset.sort,
         List.mergeSort_eq_self (· ≤ ·) ((raise'_sorted _ _).imp (@le_of_lt _ _)), lower_raise']⟩
 #align denumerable.finset Denumerable.finset
 
chore: Remove unnecessary "rw"s (#10704)

Remove unnecessary "rw"s.

Diff
@@ -276,8 +276,7 @@ theorem list_ofNat_succ (v : ℕ) :
     show decodeList (succ v) = _ by
       cases' e : unpair v with v₁ v₂
       simp [decodeList, e]
-      rw [show decodeList v₂ = decode (α := List α) v₂ from rfl, decode_eq_ofNat, Option.seq_some,
-        Option.some.injEq]
+      rw [show decodeList v₂ = decode (α := List α) v₂ from rfl, decode_eq_ofNat, Option.seq_some]
 #align denumerable.list_of_nat_succ Denumerable.list_ofNat_succ
 
 end List
chore: fix some Lean-3-isms in comments (#10240)
Diff
@@ -139,7 +139,7 @@ def _root_.Fintype.truncEncodable (α : Type*) [DecidableEq α] [Fintype α] : T
 
 /-- A noncomputable way to arbitrarily choose an ordering on a finite type.
 It is not made into a global instance, since it involves an arbitrary choice.
-This can be locally made into an instance with `local attribute [instance] Fintype.toEncodable`. -/
+This can be locally made into an instance with `attribute [local instance] Fintype.toEncodable`. -/
 noncomputable def _root_.Fintype.toEncodable (α : Type*) [Fintype α] : Encodable α := by
   classical exact (Fintype.truncEncodable α).out
 #align fintype.to_encodable Fintype.toEncodable
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
@@ -21,7 +21,7 @@ open Nat List
 
 namespace Encodable
 
-variable {α : Type _}
+variable {α : Type*}
 
 section List
 
@@ -50,7 +50,7 @@ instance _root_.List.encodable : Encodable (List α) :=
     induction' l with a l IH <;> simp [encodeList, decodeList, unpair_pair, encodek, *]⟩
 #align list.encodable List.encodable
 
-instance _root_.List.countable {α : Type _} [Countable α] : Countable (List α) := by
+instance _root_.List.countable {α : Type*} [Countable α] : Countable (List α) := by
   haveI := Encodable.ofCountable α
   infer_instance
 #align list.countable List.countable
@@ -119,7 +119,7 @@ instance _root_.Multiset.encodable : Encodable (Multiset α) :=
 #align multiset.encodable Multiset.encodable
 
 /-- If `α` is countable, then so is `Multiset α`. -/
-instance _root_.Multiset.countable {α : Type _} [Countable α] : Countable (Multiset α) :=
+instance _root_.Multiset.countable {α : Type*} [Countable α] : Countable (Multiset α) :=
   Quotient.countable
 #align multiset.countable Multiset.countable
 
@@ -132,7 +132,7 @@ def encodableOfList [DecidableEq α] (l : List α) (H : ∀ x, x ∈ l) : Encoda
 
 /-- A finite type is encodable. Because the encoding is not unique, we wrap it in `Trunc` to
 preserve computability. -/
-def _root_.Fintype.truncEncodable (α : Type _) [DecidableEq α] [Fintype α] : Trunc (Encodable α) :=
+def _root_.Fintype.truncEncodable (α : Type*) [DecidableEq α] [Fintype α] : Trunc (Encodable α) :=
   @Quot.recOnSubsingleton' _ _ (fun s : Multiset α => (∀ x : α, x ∈ s) → Trunc (Encodable α)) _
     Finset.univ.1 (fun l H => Trunc.mk <| encodableOfList l H) Finset.mem_univ
 #align fintype.trunc_encodable Fintype.truncEncodable
@@ -140,7 +140,7 @@ def _root_.Fintype.truncEncodable (α : Type _) [DecidableEq α] [Fintype α] :
 /-- A noncomputable way to arbitrarily choose an ordering on a finite type.
 It is not made into a global instance, since it involves an arbitrary choice.
 This can be locally made into an instance with `local attribute [instance] Fintype.toEncodable`. -/
-noncomputable def _root_.Fintype.toEncodable (α : Type _) [Fintype α] : Encodable α := by
+noncomputable def _root_.Fintype.toEncodable (α : Type*) [Fintype α] : Encodable α := by
   classical exact (Fintype.truncEncodable α).out
 #align fintype.to_encodable Fintype.toEncodable
 
@@ -159,7 +159,7 @@ instance finArrow [Encodable α] {n} : Encodable (Fin n → α) :=
   ofEquiv _ (Equiv.vectorEquivFin _ _).symm
 #align encodable.fin_arrow Encodable.finArrow
 
-instance finPi (n) (π : Fin n → Type _) [∀ i, Encodable (π i)] : Encodable (∀ i, π i) :=
+instance finPi (n) (π : Fin n → Type*) [∀ i, Encodable (π i)] : Encodable (∀ i, π i) :=
   ofEquiv _ (Equiv.piEquivSubtypeSigma (Fin n) π)
 #align encodable.fin_pi Encodable.finPi
 
@@ -178,7 +178,7 @@ instance _root_.Finset.countable [Countable α] : Countable (Finset α) :=
 -- TODO: Unify with `fintypePi` and find a better name
 /-- When `α` is finite and `β` is encodable, `α → β` is encodable too. Because the encoding is not
 unique, we wrap it in `Trunc` to preserve computability. -/
-def fintypeArrow (α : Type _) (β : Type _) [DecidableEq α] [Fintype α] [Encodable β] :
+def fintypeArrow (α : Type*) (β : Type*) [DecidableEq α] [Fintype α] [Encodable β] :
     Trunc (Encodable (α → β)) :=
   (Fintype.truncEquivFin α).map fun f =>
     Encodable.ofEquiv (Fin (Fintype.card α) → β) <| Equiv.arrowCongr f (Equiv.refl _)
@@ -186,7 +186,7 @@ def fintypeArrow (α : Type _) (β : Type _) [DecidableEq α] [Fintype α] [Enco
 
 /-- When `α` is finite and all `π a` are encodable, `Π a, π a` is encodable too. Because the
 encoding is not unique, we wrap it in `Trunc` to preserve computability. -/
-def fintypePi (α : Type _) (π : α → Type _) [DecidableEq α] [Fintype α] [∀ a, Encodable (π a)] :
+def fintypePi (α : Type*) (π : α → Type*) [DecidableEq α] [Fintype α] [∀ a, Encodable (π a)] :
     Trunc (Encodable (∀ a, π a)) :=
   (Fintype.truncEncodable α).bind fun a =>
     (@fintypeArrow α (Σa, π a) _ _ (@Sigma.encodable _ _ a _)).bind fun f =>
@@ -230,7 +230,7 @@ def fintypeEquivFin {α} [Fintype α] [Encodable α] : α ≃ Fin (Fintype.card
 #align encodable.fintype_equiv_fin Encodable.fintypeEquivFin
 
 /-- If `α` and `β` are encodable and `α` is a fintype, then `α → β` is encodable as well. -/
-instance fintypeArrowOfEncodable {α β : Type _} [Encodable α] [Fintype α] [Encodable β] :
+instance fintypeArrowOfEncodable {α β : Type*} [Encodable α] [Fintype α] [Encodable β] :
     Encodable (α → β) :=
   ofEquiv (Fin (Fintype.card α) → β) <| Equiv.arrowCongr fintypeEquivFin (Equiv.refl _)
 #align encodable.fintype_arrow_of_encodable Encodable.fintypeArrowOfEncodable
@@ -239,7 +239,7 @@ end Encodable
 
 namespace Denumerable
 
-variable {α : Type _} {β : Type _} [Denumerable α] [Denumerable β]
+variable {α : Type*} {β : Type*} [Denumerable α] [Denumerable β]
 
 open Encodable
 
@@ -419,7 +419,7 @@ def listNatEquivNat : List ℕ ≃ ℕ :=
 #align equiv.list_nat_equiv_nat Equiv.listNatEquivNat
 
 /-- If `α` is equivalent to `ℕ`, then `List α` is equivalent to `α`. -/
-def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
+def listEquivSelfOfEquivNat {α : Type*} (e : α ≃ ℕ) : List α ≃ α :=
   calc
     List α ≃ List ℕ := listEquivOfEquiv e
     _ ≃ ℕ := listNatEquivNat
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,16 +2,13 @@
 Copyright (c) 2018 Mario Carneiro. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
-
-! This file was ported from Lean 3 source module logic.equiv.list
-! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Data.Finset.Sort
 import Mathlib.Data.Vector.Basic
 import Mathlib.Logic.Denumerable
 
+#align_import logic.equiv.list from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
+
 /-!
 # Equivalences involving `List`-like types
 
chore: cleanup whitespace (#5988)

Grepping for [^ .:{-] [^ :] and reviewing the results. Once I started I couldn't stop. :-)

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

Diff
@@ -113,7 +113,7 @@ def encodeMultiset (s : Multiset α) : ℕ :=
 
 /-- Explicit decoding function for `Multiset α` -/
 def decodeMultiset (n : ℕ) : Option (Multiset α) :=
-  ((↑) : List α →  Multiset α) <$> decode (α := List α) n
+  ((↑) : List α → Multiset α) <$> decode (α := List α) n
 #align encodable.decode_multiset Encodable.decodeMultiset
 
 /-- If `α` is encodable, then so is `Multiset α`. -/
chore: bump to nightly-2023-05-31 (#4530)

Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Floris van Doorn <fpvdoorn@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Alex J Best <alex.j.best@gmail.com>

Diff
@@ -318,7 +318,7 @@ theorem raise_chain : ∀ l n, List.Chain (· ≤ ·) n (raise l n)
   | _ :: _, _ => List.Chain.cons (Nat.le_add_left _ _) (raise_chain _ _)
 #align denumerable.raise_chain Denumerable.raise_chain
 
-/-- `raise l n` is an non-decreasing sequence. -/
+/-- `raise l n` is a non-decreasing sequence. -/
 theorem raise_sorted : ∀ l n, List.Sorted (· ≤ ·) (raise l n)
   | [], _ => List.sorted_nil
   | _ :: _, _ => List.chain_iff_pairwise.1 (raise_chain _ _)
chore: fix upper/lowercase in comments (#4360)
  • Run a non-interactive version of fix-comments.py on all files.
  • Go through the diff and manually add/discard/edit chunks.
Diff
@@ -224,7 +224,7 @@ theorem sortedUniv_toFinset (α) [Fintype α] [Encodable α] [DecidableEq α] :
   Finset.sort_toFinset _ _
 #align encodable.sorted_univ_to_finset Encodable.sortedUniv_toFinset
 
-/-- An encodable `Fintype` is equivalent to the same size `fin`. -/
+/-- An encodable `Fintype` is equivalent to the same size `Fin`. -/
 def fintypeEquivFin {α} [Fintype α] [Encodable α] : α ≃ Fin (Fintype.card α) :=
   haveI : DecidableEq α := Encodable.decidableEqOfEncodable _
   -- Porting note: used the `trans` tactic
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
@@ -308,8 +308,7 @@ theorem lower_raise : ∀ l n, lower (raise l n) n = l
 
 theorem raise_lower : ∀ {l n}, List.Sorted (· ≤ ·) (n :: l) → raise (lower l n) n = l
   | [], n, _ => rfl
-  | m :: l, n, h =>
-    by
+  | m :: l, n, h => by
     have : n ≤ m := List.rel_of_sorted_cons h _ (l.mem_cons_self _)
     simp [raise, lower, tsub_add_cancel_of_le this, raise_lower h.of_cons]
 #align denumerable.raise_lower Denumerable.raise_lower
fix: add missing _root_ (#3630)

Mathport doesn't understand this, and apparently nor do many of the humans fixing the errors it creates.

If your #align statement complains the def doesn't exist, don't change the #align; work out why it doesn't exist instead.

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

Diff
@@ -149,7 +149,7 @@ noncomputable def _root_.Fintype.toEncodable (α : Type _) [Fintype α] : Encoda
 
 /-- If `α` is encodable, then so is `Vector α n`. -/
 instance _root_.Vector.encodable [Encodable α] {n} : Encodable (Vector α n) :=
-  Encodable.Subtype.encodable
+  Subtype.encodable
 #align vector.encodable Vector.encodable
 
 /-- If `α` is countable, then so is `Vector α n`. -/
@@ -192,9 +192,9 @@ encoding is not unique, we wrap it in `Trunc` to preserve computability. -/
 def fintypePi (α : Type _) (π : α → Type _) [DecidableEq α] [Fintype α] [∀ a, Encodable (π a)] :
     Trunc (Encodable (∀ a, π a)) :=
   (Fintype.truncEncodable α).bind fun a =>
-    (@fintypeArrow α (Σa, π a) _ _ (@Encodable.Sigma.encodable _ _ a _)).bind fun f =>
+    (@fintypeArrow α (Σa, π a) _ _ (@Sigma.encodable _ _ a _)).bind fun f =>
       Trunc.mk <|
-        @Encodable.ofEquiv _ _ (@Encodable.Subtype.encodable _ _ f _)
+        @Encodable.ofEquiv _ _ (@Subtype.encodable _ _ f _)
           (Equiv.piEquivSubtypeSigma α π)
 #align encodable.fintype_pi Encodable.fintypePi
 
chore: fix #align lines (#3640)

This PR fixes two things:

  • Most align statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align). This is often seen in the mathport output after ending calc blocks.
  • All remaining more-than-one-line #align statements. (This was needed for a script I wrote for #3630.)
Diff
@@ -428,7 +428,6 @@ def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
     List α ≃ List ℕ := listEquivOfEquiv e
     _ ≃ ℕ := listNatEquivNat
     _ ≃ α := e.symm
-
 #align equiv.list_equiv_self_of_equiv_nat Equiv.listEquivSelfOfEquivNat
 
 end Equiv
chore: fix some names in comments (#3276)

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

Diff
@@ -389,8 +389,8 @@ def raise'Finset (l : List ℕ) (n : ℕ) : Finset ℕ :=
   ⟨raise' l n, (raise'_sorted _ _).imp (@ne_of_lt _ _)⟩
 #align denumerable.raise'_finset Denumerable.raise'Finset
 
-/-- If `α` is denumerable, then so is `finset α`. Warning: this is *not* the same encoding as used
-in `finset.encodable`. -/
+/-- If `α` is denumerable, then so is `Finset α`. Warning: this is *not* the same encoding as used
+in `Finset.encodable`. -/
 instance finset : Denumerable (Finset α) :=
   mk'
     ⟨fun s : Finset α => encode <| lower' ((s.map (eqv α).toEmbedding).sort (· ≤ ·)) 0, fun n =>
chore: rename mkpairpair (#2324)

We rename the ported mkpair to pair, as mkpair didn't follow the naming convention and pair pairs well with unpair. A poll for this decision was held on zulip.

Diff
@@ -33,7 +33,7 @@ variable [Encodable α]
 /-- Explicit encoding function for `List α` -/
 def encodeList : List α → ℕ
   | [] => 0
-  | a :: l => succ (mkpair (encode a) (encodeList l))
+  | a :: l => succ (pair (encode a) (encodeList l))
 #align encodable.encode_list Encodable.encodeList
 
 /-- Explicit decoding function for `List α` -/
@@ -46,11 +46,11 @@ def decodeList : ℕ → Option (List α)
       (· :: ·) <$> decode (α := α) v₁ <*> decodeList v₂
 #align encodable.decode_list Encodable.decodeList
 
-/-- If `α` is encodable, then so is `List α`. This uses the `mkpair` and `unpair` functions from
+/-- If `α` is encodable, then so is `List α`. This uses the `pair` and `unpair` functions from
 `Data.Nat.Pairing`. -/
 instance _root_.List.encodable : Encodable (List α) :=
   ⟨encodeList, decodeList, fun l => by
-    induction' l with a l IH <;> simp [encodeList, decodeList, unpair_mkpair, encodek, *]⟩
+    induction' l with a l IH <;> simp [encodeList, decodeList, unpair_pair, encodek, *]⟩
 #align list.encodable List.encodable
 
 instance _root_.List.countable {α : Type _} [Countable α] : Countable (List α) := by
@@ -65,7 +65,7 @@ theorem encode_list_nil : encode (@nil α) = 0 :=
 
 @[simp]
 theorem encode_list_cons (a : α) (l : List α) :
-    encode (a :: l) = succ (mkpair (encode a) (encode l)) :=
+    encode (a :: l) = succ (pair (encode a) (encode l)) :=
   rfl
 #align encodable.encode_list_cons Encodable.encode_list_cons
 
@@ -85,7 +85,7 @@ theorem decode_list_succ (v : ℕ) :
 
 theorem length_le_encode : ∀ l : List α, length l ≤ encode l
   | [] => Nat.zero_le _
-  | _ :: l => succ_le_succ <| (length_le_encode l).trans (right_le_mkpair _ _)
+  | _ :: l => succ_le_succ <| (length_le_encode l).trans (right_le_pair _ _)
 #align encodable.length_le_encode Encodable.length_le_encode
 
 end List
@@ -260,7 +260,7 @@ theorem denumerable_list_aux : ∀ n : ℕ, ∃ a ∈ @decodeList α _ n, encode
       ⟨a, h₁, h₂⟩
     rw [Option.mem_def] at h₁
     use ofNat α v₁ :: a
-    simp [decodeList, e, h₂, h₁, encodeList, mkpair_unpair' e]
+    simp [decodeList, e, h₂, h₁, encodeList, pair_unpair' e]
 #align denumerable.denumerable_list_aux Denumerable.denumerable_list_aux
 
 /-- If `α` is denumerable, then so is `List α`. -/
chore: update SHAs (#3128)

I forgot to add the SHAs in #3121 when forward-porting leanprover-community/mathlib#18644

Diff
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Mario Carneiro
 
 ! This file was ported from Lean 3 source module logic.equiv.list
-! leanprover-community/mathlib commit 1126441d6bccf98c81214a0780c73d499f6721fe
+! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
 ! Please do not edit these lines, except to modify the commit id
 ! if you have ported upstream changes.
 -/
Diff
@@ -423,7 +423,7 @@ def listNatEquivNat : List ℕ ≃ ℕ :=
 #align equiv.list_nat_equiv_nat Equiv.listNatEquivNat
 
 /-- If `α` is equivalent to `ℕ`, then `List α` is equivalent to `α`. -/
-def listEquivSelfOfEquivNat {α : Type} (e : α ≃ ℕ) : List α ≃ α :=
+def listEquivSelfOfEquivNat {α : Type _} (e : α ≃ ℕ) : List α ≃ α :=
   calc
     List α ≃ List ℕ := listEquivOfEquiv e
     _ ≃ ℕ := listNatEquivNat
feat: port Logic.Equiv.List (#1709)

Dependencies 6 + 209

210 files ported (97.2%)
93275 lines ported (97.7%)
Show graph

The unported dependencies are