logic.encodable.basicMathlib.Logic.Encodable.Basic

This file has been ported!

Changes since the initial port

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

Changes in mathlib3

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(no changes)

(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
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Mario Carneiro
 -/
 import Logic.Equiv.Nat
-import Data.Pnat.Basic
+import Data.PNat.Basic
 import Order.Directed
 import Data.Countable.Defs
 import Order.RelIso.Basic
Diff
@@ -43,7 +43,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:400:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
Diff
@@ -43,7 +43,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
Diff
@@ -264,7 +264,7 @@ theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = som
 theorem decode₂_ne_none_iff [Encodable α] {n : ℕ} :
     decode₂ α n ≠ none ↔ n ∈ Set.range (encode : α → ℕ) := by
   simp_rw [Set.range, Set.mem_setOf_eq, Ne.def, Option.eq_none_iff_forall_not_mem,
-    Encodable.mem_decode₂, not_forall, Classical.not_not]
+    Encodable.mem_decode₂, Classical.not_forall, Classical.not_not]
 #align encodable.decode₂_ne_none_iff Encodable.decode₂_ne_none_iff
 -/
 
Diff
@@ -3,12 +3,12 @@ Copyright (c) 2015 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Mario Carneiro
 -/
-import Mathbin.Logic.Equiv.Nat
-import Mathbin.Data.Pnat.Basic
-import Mathbin.Order.Directed
-import Mathbin.Data.Countable.Defs
-import Mathbin.Order.RelIso.Basic
-import Mathbin.Data.Fin.Basic
+import Logic.Equiv.Nat
+import Data.Pnat.Basic
+import Order.Directed
+import Data.Countable.Defs
+import Order.RelIso.Basic
+import Data.Fin.Basic
 
 #align_import logic.encodable.basic from "leanprover-community/mathlib"@"f2f413b9d4be3a02840d0663dace76e8fe3da053"
 
@@ -43,7 +43,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
Diff
@@ -2,11 +2,6 @@
 Copyright (c) 2015 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module logic.encodable.basic
-! leanprover-community/mathlib commit f2f413b9d4be3a02840d0663dace76e8fe3da053
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathbin.Logic.Equiv.Nat
 import Mathbin.Data.Pnat.Basic
@@ -15,6 +10,8 @@ import Mathbin.Data.Countable.Defs
 import Mathbin.Order.RelIso.Basic
 import Mathbin.Data.Fin.Basic
 
+#align_import logic.encodable.basic from "leanprover-community/mathlib"@"f2f413b9d4be3a02840d0663dace76e8fe3da053"
+
 /-!
 # Encodable types
 
Diff
@@ -46,7 +46,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
@@ -122,17 +122,21 @@ def ofEquiv (α) [Encodable α] (e : β ≃ α) : Encodable β :=
 #align encodable.of_equiv Encodable.ofEquiv
 -/
 
+#print Encodable.encode_ofEquiv /-
 @[simp]
 theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
     @encode _ (ofEquiv _ e) b = encode (e b) :=
   rfl
 #align encodable.encode_of_equiv Encodable.encode_ofEquiv
+-/
 
+#print Encodable.decode_ofEquiv /-
 @[simp]
 theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :
     @decode _ (ofEquiv _ e) n = (decode α n).map e.symm :=
   rfl
 #align encodable.decode_of_equiv Encodable.decode_ofEquiv
+-/
 
 #print Nat.encodable /-
 instance Nat.encodable : Encodable ℕ :=
@@ -360,10 +364,12 @@ theorem encode_inr (b : β) : @encode (Sum α β) _ (Sum.inr b) = bit1 (encode b
   rfl
 #align encodable.encode_inr Encodable.encode_inrₓ
 
+#print Encodable.decode_sum_val /-
 @[simp]
 theorem decode_sum_val (n : ℕ) : decode (Sum α β) n = decodeSum n :=
   rfl
 #align encodable.decode_sum_val Encodable.decode_sum_val
+-/
 
 end Sum
 
@@ -445,12 +451,14 @@ instance Sigma.encodable : Encodable (Sigma γ) :=
 #align sigma.encodable Sigma.encodable
 -/
 
+#print Encodable.decode_sigma_val /-
 @[simp]
 theorem decode_sigma_val (n : ℕ) :
     decode (Sigma γ) n =
       (decode α n.unpair.1).bind fun a => (decode (γ a) n.unpair.2).map <| Sigma.mk a :=
   show decodeSigma._match1 _ = _ by cases n.unpair <;> rfl
 #align encodable.decode_sigma_val Encodable.decode_sigma_val
+-/
 
 #print Encodable.encode_sigma_val /-
 @[simp]
@@ -470,12 +478,14 @@ instance Prod.encodable : Encodable (α × β) :=
   ofEquiv _ (Equiv.sigmaEquivProd α β).symm
 #align prod.encodable Prod.encodable
 
+#print Encodable.decode_prod_val /-
 @[simp]
 theorem decode_prod_val (n : ℕ) :
     decode (α × β) n = (decode α n.unpair.1).bind fun a => (decode β n.unpair.2).map <| Prod.mk a :=
   show (decode (Sigma fun _ => β) n).map (Equiv.sigmaEquivProd α β) = _ by
     simp <;> cases decode α n.unpair.1 <;> simp <;> cases decode β n.unpair.2 <;> rfl
 #align encodable.decode_prod_val Encodable.decode_prod_val
+-/
 
 #print Encodable.encode_prod_val /-
 @[simp]
@@ -492,8 +502,6 @@ open Subtype Decidable
 
 variable {P : α → Prop} [encA : Encodable α] [decP : DecidablePred P]
 
-include encA
-
 #print Encodable.encodeSubtype /-
 /-- Explicit encoding function for a decidable subtype of an encodable type -/
 def encodeSubtype : { a : α // P a } → ℕ
@@ -501,8 +509,6 @@ def encodeSubtype : { a : α // P a } → ℕ
 #align encodable.encode_subtype Encodable.encodeSubtype
 -/
 
-include decP
-
 #print Encodable.decodeSubtype /-
 /-- Explicit decoding function for a decidable subtype of an encodable type -/
 def decodeSubtype (v : ℕ) : Option { a : α // P a } :=
@@ -726,17 +732,21 @@ theorem choose_spec (h : ∃ x, p x) : p (choose h) :=
 
 end FindA
 
+#print Encodable.axiom_of_choice /-
 /-- A constructive version of `classical.axiom_of_choice` for `encodable` types. -/
 theorem axiom_of_choice {α : Type _} {β : α → Type _} {R : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
     [∀ x y, Decidable (R x y)] (H : ∀ x, ∃ y, R x y) : ∃ f : ∀ a, β a, ∀ x, R x (f x) :=
   ⟨fun x => choose (H x), fun x => choose_spec (H x)⟩
 #align encodable.axiom_of_choice Encodable.axiom_of_choice
+-/
 
+#print Encodable.skolem /-
 /-- A constructive version of `classical.skolem` for `encodable` types. -/
 theorem skolem {α : Type _} {β : α → Type _} {P : ∀ x, β x → Prop} [c : ∀ a, Encodable (β a)]
     [d : ∀ x y, Decidable (P x y)] : (∀ x, ∃ y, P x y) ↔ ∃ f : ∀ a, β a, ∀ x, P x (f x) :=
   ⟨axiom_of_choice, fun ⟨f, H⟩ x => ⟨_, H x⟩⟩
 #align encodable.skolem Encodable.skolem
+-/
 
 #print Encodable.encode' /-
 /-
Diff
@@ -46,7 +46,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
Diff
@@ -407,7 +407,7 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : decode Bool n = none :=
   suffices decode_sum n = none by change (decode_sum n).map _ = none; rw [this]; rfl
   have : 1 ≤ div2 n := by
     rw [div2_val, Nat.le_div_iff_mul_le]
-    exacts[h, by decide]
+    exacts [h, by decide]
   cases' exists_eq_succ_of_ne_zero (ne_of_gt this) with m e
   simp [decode_sum] <;> cases bodd n <;> simp [decode_sum] <;> rw [e] <;> rfl
 #align encodable.decode_ge_two Encodable.decode_ge_two
@@ -599,7 +599,8 @@ attribute [local instance 100] Encodable.decidableRangeEncode
 #print ULower /-
 /-- `ulower α : Type` is an equivalent type in the lowest universe, given `encodable α`. -/
 def ULower (α : Type _) [Encodable α] : Type :=
-  Set.range (Encodable.encode : α → ℕ)deriving DecidableEq, Encodable
+  Set.range (Encodable.encode : α → ℕ)
+deriving DecidableEq, Encodable
 #align ulower ULower
 -/
 
Diff
@@ -801,13 +801,17 @@ theorem rel_sequence {r : β → β → Prop} {f : α → β} (hf : Directed r f
 
 variable [Preorder β] {f : α → β} (hf : Directed (· ≤ ·) f)
 
+#print Directed.sequence_mono /-
 theorem sequence_mono : Monotone (f ∘ hf.sequence f) :=
   monotone_nat_of_le_succ <| hf.sequence_mono_nat
 #align directed.sequence_mono Directed.sequence_mono
+-/
 
+#print Directed.le_sequence /-
 theorem le_sequence (a : α) : f a ≤ f (hf.sequence f (encode a + 1)) :=
   hf.rel_sequence a
 #align directed.le_sequence Directed.le_sequence
+-/
 
 end Directed
 
Diff
@@ -592,85 +592,85 @@ instance : Countable ℕ+ :=
   Subtype.countable
 
 -- short-circuit instance search
-section Ulower
+section ULower
 
 attribute [local instance 100] Encodable.decidableRangeEncode
 
-#print Ulower /-
+#print ULower /-
 /-- `ulower α : Type` is an equivalent type in the lowest universe, given `encodable α`. -/
-def Ulower (α : Type _) [Encodable α] : Type :=
+def ULower (α : Type _) [Encodable α] : Type :=
   Set.range (Encodable.encode : α → ℕ)deriving DecidableEq, Encodable
-#align ulower Ulower
+#align ulower ULower
 -/
 
-end Ulower
+end ULower
 
-namespace Ulower
+namespace ULower
 
 variable (α : Type _) [Encodable α]
 
-#print Ulower.equiv /-
+#print ULower.equiv /-
 /-- The equivalence between the encodable type `α` and `ulower α : Type`. -/
-def equiv : α ≃ Ulower α :=
+def equiv : α ≃ ULower α :=
   Encodable.equivRangeEncode α
-#align ulower.equiv Ulower.equiv
+#align ulower.equiv ULower.equiv
 -/
 
 variable {α}
 
-#print Ulower.down /-
+#print ULower.down /-
 /-- Lowers an `a : α` into `ulower α`. -/
-def down (a : α) : Ulower α :=
+def down (a : α) : ULower α :=
   equiv α a
-#align ulower.down Ulower.down
+#align ulower.down ULower.down
 -/
 
-instance [Inhabited α] : Inhabited (Ulower α) :=
+instance [Inhabited α] : Inhabited (ULower α) :=
   ⟨down default⟩
 
-#print Ulower.up /-
+#print ULower.up /-
 /-- Lifts an `a : ulower α` into `α`. -/
-def up (a : Ulower α) : α :=
+def up (a : ULower α) : α :=
   (equiv α).symm a
-#align ulower.up Ulower.up
+#align ulower.up ULower.up
 -/
 
-#print Ulower.down_up /-
+#print ULower.down_up /-
 @[simp]
-theorem down_up {a : Ulower α} : down a.up = a :=
+theorem down_up {a : ULower α} : down a.up = a :=
   Equiv.right_inv _ _
-#align ulower.down_up Ulower.down_up
+#align ulower.down_up ULower.down_up
 -/
 
-#print Ulower.up_down /-
+#print ULower.up_down /-
 @[simp]
 theorem up_down {a : α} : (down a).up = a :=
   Equiv.left_inv _ _
-#align ulower.up_down Ulower.up_down
+#align ulower.up_down ULower.up_down
 -/
 
-#print Ulower.up_eq_up /-
+#print ULower.up_eq_up /-
 @[simp]
-theorem up_eq_up {a b : Ulower α} : a.up = b.up ↔ a = b :=
+theorem up_eq_up {a b : ULower α} : a.up = b.up ↔ a = b :=
   Equiv.apply_eq_iff_eq _
-#align ulower.up_eq_up Ulower.up_eq_up
+#align ulower.up_eq_up ULower.up_eq_up
 -/
 
-#print Ulower.down_eq_down /-
+#print ULower.down_eq_down /-
 @[simp]
 theorem down_eq_down {a b : α} : down a = down b ↔ a = b :=
   Equiv.apply_eq_iff_eq _
-#align ulower.down_eq_down Ulower.down_eq_down
+#align ulower.down_eq_down ULower.down_eq_down
 -/
 
-#print Ulower.ext /-
+#print ULower.ext /-
 @[ext]
-protected theorem ext {a b : Ulower α} : a.up = b.up → a = b :=
+protected theorem ext {a b : ULower α} : a.up = b.up → a = b :=
   up_eq_up.1
-#align ulower.ext Ulower.ext
+#align ulower.ext ULower.ext
 -/
 
-end Ulower
+end ULower
 
 /-
 Choice function for encodable types and decidable predicates.
Diff
@@ -122,24 +122,12 @@ def ofEquiv (α) [Encodable α] (e : β ≃ α) : Encodable β :=
 #align encodable.of_equiv Encodable.ofEquiv
 -/
 
-/- warning: encodable.encode_of_equiv -> Encodable.encode_ofEquiv is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) b) (Encodable.encode.{u1} α _inst_1 (coeFn.{max 1 (max (succ u2) (succ u1)) (succ u1) (succ u2), max (succ u2) (succ u1)} (Equiv.{succ u2, succ u1} β α) (fun (_x : Equiv.{succ u2, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u2, succ u1} β α) e b))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) b) (Encodable.encode.{u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) b) _inst_1 (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (Equiv.{succ u1, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u1, succ u2} β α) e b))
-Case conversion may be inaccurate. Consider using '#align encodable.encode_of_equiv Encodable.encode_ofEquivₓ'. -/
 @[simp]
 theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
     @encode _ (ofEquiv _ e) b = encode (e b) :=
   rfl
 #align encodable.encode_of_equiv Encodable.encode_ofEquiv
 
-/- warning: encodable.decode_of_equiv -> Encodable.decode_ofEquiv is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (n : Nat), Eq.{succ u2} (Option.{u2} β) (Encodable.decode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) n) (Option.map.{u1, u2} α β (coeFn.{max 1 (max (succ u1) (succ u2)) (succ u2) (succ u1), max (succ u1) (succ u2)} (Equiv.{succ u1, succ u2} α β) (fun (_x : Equiv.{succ u1, succ u2} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u2} α β) (Equiv.symm.{succ u2, succ u1} β α e)) (Encodable.decode.{u1} α _inst_1 n))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (n : Nat), Eq.{succ u1} (Option.{u1} β) (Encodable.decode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) n) (Option.map.{u2, u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Equiv.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u1} α β) (Equiv.symm.{succ u1, succ u2} β α e)) (Encodable.decode.{u2} α _inst_1 n))
-Case conversion may be inaccurate. Consider using '#align encodable.decode_of_equiv Encodable.decode_ofEquivₓ'. -/
 @[simp]
 theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :
     @decode _ (ofEquiv _ e) n = (decode α n).map e.symm :=
@@ -372,12 +360,6 @@ theorem encode_inr (b : β) : @encode (Sum α β) _ (Sum.inr b) = bit1 (encode b
   rfl
 #align encodable.encode_inr Encodable.encode_inrₓ
 
-/- warning: encodable.decode_sum_val -> Encodable.decode_sum_val is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Encodable.{u2} β] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sum.{u1, u2} α β)) (Encodable.decode.{max u1 u2} (Sum.{u1, u2} α β) (Sum.encodable.{u1, u2} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u1, u2} α β _inst_1 _inst_2 n)
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : Encodable.{u1} β] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sum.{u2, u1} α β)) (Encodable.decode.{max u2 u1} (Sum.{u2, u1} α β) (Sum.encodable.{u2, u1} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u2, u1} α β _inst_1 _inst_2 n)
-Case conversion may be inaccurate. Consider using '#align encodable.decode_sum_val Encodable.decode_sum_valₓ'. -/
 @[simp]
 theorem decode_sum_val (n : ℕ) : decode (Sum α β) n = decodeSum n :=
   rfl
@@ -463,12 +445,6 @@ instance Sigma.encodable : Encodable (Sigma γ) :=
 #align sigma.encodable Sigma.encodable
 -/
 
-/- warning: encodable.decode_sigma_val -> Encodable.decode_sigma_val is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {γ : α -> Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : forall (a : α), Encodable.{u2} (γ a)] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sigma.{u1, u2} α γ)) (Encodable.decode.{max u1 u2} (Sigma.{u1, u2} α γ) (Sigma.encodable.{u1, u2} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u1, max u1 u2} α (Sigma.{u1, u2} α γ) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u2, max u1 u2} (γ a) (Sigma.{u1, u2} α γ) (Sigma.mk.{u1, u2} α γ a) (Encodable.decode.{u2} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
-but is expected to have type
-  forall {α : Type.{u2}} {γ : α -> Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : forall (a : α), Encodable.{u1} (γ a)] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sigma.{u2, u1} α γ)) (Encodable.decode.{max u2 u1} (Sigma.{u2, u1} α γ) (Sigma.encodable.{u2, u1} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u2, max u2 u1} α (Sigma.{u2, u1} α γ) (Encodable.decode.{u2} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u1, max u2 u1} (γ a) (Sigma.{u2, u1} α γ) (Sigma.mk.{u2, u1} α γ a) (Encodable.decode.{u1} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
-Case conversion may be inaccurate. Consider using '#align encodable.decode_sigma_val Encodable.decode_sigma_valₓ'. -/
 @[simp]
 theorem decode_sigma_val (n : ℕ) :
     decode (Sigma γ) n =
@@ -494,12 +470,6 @@ instance Prod.encodable : Encodable (α × β) :=
   ofEquiv _ (Equiv.sigmaEquivProd α β).symm
 #align prod.encodable Prod.encodable
 
-/- warning: encodable.decode_prod_val -> Encodable.decode_prod_val is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Encodable.{u2} β] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Prod.{u1, u2} α β)) (Encodable.decode.{max u1 u2} (Prod.{u1, u2} α β) (Prod.encodable.{u1, u2} α β _inst_1 _inst_2) n) (Option.bind.{u1, max u1 u2} α (Prod.{u1, u2} α β) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u2, max u1 u2} β (Prod.{u1, u2} α β) (Prod.mk.{u1, u2} α β a) (Encodable.decode.{u2} β _inst_2 (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
-but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u1} β] [_inst_2 : Encodable.{u2} α] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u1 u2} (Prod.{u2, u1} α β)) (Encodable.decode.{max u1 u2} (Prod.{u2, u1} α β) (Encodable.Prod.encodable.{u2, u1} α β _inst_2 _inst_1) n) (Option.bind.{u2, max u1 u2} α (Prod.{u2, u1} α β) (Encodable.decode.{u2} α _inst_2 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u1, max u1 u2} β (Prod.{u2, u1} α β) (Prod.mk.{u2, u1} α β a) (Encodable.decode.{u1} β _inst_1 (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
-Case conversion may be inaccurate. Consider using '#align encodable.decode_prod_val Encodable.decode_prod_valₓ'. -/
 @[simp]
 theorem decode_prod_val (n : ℕ) :
     decode (α × β) n = (decode α n.unpair.1).bind fun a => (decode β n.unpair.2).map <| Prod.mk a :=
@@ -755,24 +725,12 @@ theorem choose_spec (h : ∃ x, p x) : p (choose h) :=
 
 end FindA
 
-/- warning: encodable.axiom_of_choice -> Encodable.axiom_of_choice is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : α -> Type.{u2}} {R : forall (x : α), (β x) -> Prop} [_inst_1 : forall (a : α), Encodable.{u2} (β a)] [_inst_2 : forall (x : α) (y : β x), Decidable (R x y)], (forall (x : α), Exists.{succ u2} (β x) (fun (y : β x) => R x y)) -> (Exists.{max (succ u1) (succ u2)} (forall (a : α), β a) (fun (f : forall (a : α), β a) => forall (x : α), R x (f x)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : α -> Type.{u1}} {R : forall (x : α), (β x) -> Prop} [_inst_1 : forall (a : α), Encodable.{u1} (β a)] [_inst_2 : forall (x : α) (y : β x), Decidable (R x y)], (forall (x : α), Exists.{succ u1} (β x) (fun (y : β x) => R x y)) -> (Exists.{max (succ u2) (succ u1)} (forall (a : α), β a) (fun (f : forall (a : α), β a) => forall (x : α), R x (f x)))
-Case conversion may be inaccurate. Consider using '#align encodable.axiom_of_choice Encodable.axiom_of_choiceₓ'. -/
 /-- A constructive version of `classical.axiom_of_choice` for `encodable` types. -/
 theorem axiom_of_choice {α : Type _} {β : α → Type _} {R : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
     [∀ x y, Decidable (R x y)] (H : ∀ x, ∃ y, R x y) : ∃ f : ∀ a, β a, ∀ x, R x (f x) :=
   ⟨fun x => choose (H x), fun x => choose_spec (H x)⟩
 #align encodable.axiom_of_choice Encodable.axiom_of_choice
 
-/- warning: encodable.skolem -> Encodable.skolem is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : α -> Type.{u2}} {P : forall (x : α), (β x) -> Prop} [c : forall (a : α), Encodable.{u2} (β a)] [d : forall (x : α) (y : β x), Decidable (P x y)], Iff (forall (x : α), Exists.{succ u2} (β x) (fun (y : β x) => P x y)) (Exists.{max (succ u1) (succ u2)} (forall (a : α), β a) (fun (f : forall (a : α), β a) => forall (x : α), P x (f x)))
-but is expected to have type
-  forall {α : Type.{u2}} {β : α -> Type.{u1}} {P : forall (x : α), (β x) -> Prop} [c : forall (a : α), Encodable.{u1} (β a)] [d : forall (x : α) (y : β x), Decidable (P x y)], Iff (forall (x : α), Exists.{succ u1} (β x) (fun (y : β x) => P x y)) (Exists.{max (succ u2) (succ u1)} (forall (a : α), β a) (fun (f : forall (a : α), β a) => forall (x : α), P x (f x)))
-Case conversion may be inaccurate. Consider using '#align encodable.skolem Encodable.skolemₓ'. -/
 /-- A constructive version of `classical.skolem` for `encodable` types. -/
 theorem skolem {α : Type _} {β : α → Type _} {P : ∀ x, β x → Prop} [c : ∀ a, Encodable (β a)]
     [d : ∀ x y, Decidable (P x y)] : (∀ x, ∃ y, P x y) ↔ ∃ f : ∀ a, β a, ∀ x, P x (f x) :=
@@ -843,22 +801,10 @@ theorem rel_sequence {r : β → β → Prop} {f : α → β} (hf : Directed r f
 
 variable [Preorder β] {f : α → β} (hf : Directed (· ≤ ·) f)
 
-/- warning: directed.sequence_mono -> Directed.sequence_mono is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f), Monotone.{0, u2} Nat β (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) _inst_3 (Function.comp.{1, succ u1, succ u2} Nat α β f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f hf))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4337 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 x._@.Mathlib.Logic.Encodable.Basic._hyg.4337) f), Monotone.{0, u2} Nat β (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) _inst_3 (Function.comp.{1, succ u1, succ u2} Nat α β f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4337 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 x._@.Mathlib.Logic.Encodable.Basic._hyg.4337) f hf))
-Case conversion may be inaccurate. Consider using '#align directed.sequence_mono Directed.sequence_monoₓ'. -/
 theorem sequence_mono : Monotone (f ∘ hf.sequence f) :=
   monotone_nat_of_le_succ <| hf.sequence_mono_nat
 #align directed.sequence_mono Directed.sequence_mono
 
-/- warning: directed.le_sequence -> Directed.le_sequence is a dubious translation:
-lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f) (a : α), LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3) (f a) (f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f hf (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Encodable.encode.{u1} α _inst_1 a) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))))
-but is expected to have type
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4383 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 x._@.Mathlib.Logic.Encodable.Basic._hyg.4383) f) (a : α), LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) (f a) (f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4383 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 x._@.Mathlib.Logic.Encodable.Basic._hyg.4383) f hf (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Encodable.encode.{u1} α _inst_1 a) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))
-Case conversion may be inaccurate. Consider using '#align directed.le_sequence Directed.le_sequenceₓ'. -/
 theorem le_sequence (a : α) : f a ≤ f (hf.sequence f (encode a + 1)) :=
   hf.rel_sequence a
 #align directed.le_sequence Directed.le_sequence
Diff
@@ -266,9 +266,7 @@ theorem decode₂_eq_some [Encodable α] {n : ℕ} {a : α} : decode₂ α n = s
 
 #print Encodable.decode₂_encode /-
 @[simp]
-theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = some a :=
-  by
-  ext
+theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = some a := by ext;
   simp [mem_decode₂, eq_comm]
 #align encodable.decode₂_encode Encodable.decode₂_encode
 -/
@@ -424,10 +422,7 @@ theorem decode_one : decode Bool 1 = some true :=
 #print Encodable.decode_ge_two /-
 theorem decode_ge_two (n) (h : 2 ≤ n) : decode Bool n = none :=
   by
-  suffices decode_sum n = none by
-    change (decode_sum n).map _ = none
-    rw [this]
-    rfl
+  suffices decode_sum n = none by change (decode_sum n).map _ = none; rw [this]; rfl
   have : 1 ≤ div2 n := by
     rw [div2_val, Nat.le_div_iff_mul_le]
     exacts[h, by decide]
Diff
@@ -724,11 +724,9 @@ variable {α : Type _} (p : α → Prop) [Encodable α] [DecidablePred p]
 private def good : Option α → Prop
   | some a => p a
   | none => False
-#align encodable.good encodable.good
 
 private def decidable_good : DecidablePred (Good p)
   | n => by cases n <;> unfold good <;> infer_instance
-#align encodable.decidable_good encodable.decidable_good
 
 attribute [local instance] decidable_good
 
Diff
@@ -126,7 +126,7 @@ def ofEquiv (α) [Encodable α] (e : β ≃ α) : Encodable β :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) b) (Encodable.encode.{u1} α _inst_1 (coeFn.{max 1 (max (succ u2) (succ u1)) (succ u1) (succ u2), max (succ u2) (succ u1)} (Equiv.{succ u2, succ u1} β α) (fun (_x : Equiv.{succ u2, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u2, succ u1} β α) e b))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) b) (Encodable.encode.{u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) b) _inst_1 (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (Equiv.{succ u1, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u1, succ u2} β α) e b))
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) b) (Encodable.encode.{u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) b) _inst_1 (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (Equiv.{succ u1, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u1, succ u2} β α) e b))
 Case conversion may be inaccurate. Consider using '#align encodable.encode_of_equiv Encodable.encode_ofEquivₓ'. -/
 @[simp]
 theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
@@ -138,7 +138,7 @@ theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (n : Nat), Eq.{succ u2} (Option.{u2} β) (Encodable.decode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) n) (Option.map.{u1, u2} α β (coeFn.{max 1 (max (succ u1) (succ u2)) (succ u2) (succ u1), max (succ u1) (succ u2)} (Equiv.{succ u1, succ u2} α β) (fun (_x : Equiv.{succ u1, succ u2} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u2} α β) (Equiv.symm.{succ u2, succ u1} β α e)) (Encodable.decode.{u1} α _inst_1 n))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (n : Nat), Eq.{succ u1} (Option.{u1} β) (Encodable.decode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) n) (Option.map.{u2, u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Equiv.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u1} α β) (Equiv.symm.{succ u1, succ u2} β α e)) (Encodable.decode.{u2} α _inst_1 n))
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (n : Nat), Eq.{succ u1} (Option.{u1} β) (Encodable.decode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) n) (Option.map.{u2, u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Equiv.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.812 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u1} α β) (Equiv.symm.{succ u1, succ u2} β α e)) (Encodable.decode.{u2} α _inst_1 n))
 Case conversion may be inaccurate. Consider using '#align encodable.decode_of_equiv Encodable.decode_ofEquivₓ'. -/
 @[simp]
 theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :
Diff
@@ -850,17 +850,25 @@ theorem rel_sequence {r : β → β → Prop} {f : α → β} (hf : Directed r f
 
 variable [Preorder β] {f : α → β} (hf : Directed (· ≤ ·) f)
 
-#print Directed.sequence_mono /-
+/- warning: directed.sequence_mono -> Directed.sequence_mono is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f), Monotone.{0, u2} Nat β (PartialOrder.toPreorder.{0} Nat (OrderedCancelAddCommMonoid.toPartialOrder.{0} Nat (StrictOrderedSemiring.toOrderedCancelAddCommMonoid.{0} Nat Nat.strictOrderedSemiring))) _inst_3 (Function.comp.{1, succ u1, succ u2} Nat α β f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f hf))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4337 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 x._@.Mathlib.Logic.Encodable.Basic._hyg.4337) f), Monotone.{0, u2} Nat β (PartialOrder.toPreorder.{0} Nat (StrictOrderedSemiring.toPartialOrder.{0} Nat Nat.strictOrderedSemiring)) _inst_3 (Function.comp.{1, succ u1, succ u2} Nat α β f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4337 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4335 x._@.Mathlib.Logic.Encodable.Basic._hyg.4337) f hf))
+Case conversion may be inaccurate. Consider using '#align directed.sequence_mono Directed.sequence_monoₓ'. -/
 theorem sequence_mono : Monotone (f ∘ hf.sequence f) :=
   monotone_nat_of_le_succ <| hf.sequence_mono_nat
 #align directed.sequence_mono Directed.sequence_mono
--/
 
-#print Directed.le_sequence /-
+/- warning: directed.le_sequence -> Directed.le_sequence is a dubious translation:
+lean 3 declaration is
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f) (a : α), LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3) (f a) (f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (LE.le.{u2} β (Preorder.toHasLe.{u2} β _inst_3)) f hf (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) (Encodable.encode.{u1} α _inst_1 a) (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne))))))
+but is expected to have type
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Inhabited.{succ u1} α] [_inst_3 : Preorder.{u2} β] {f : α -> β} (hf : Directed.{u2, succ u1} β α (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4383 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 x._@.Mathlib.Logic.Encodable.Basic._hyg.4383) f) (a : α), LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) (f a) (f (Directed.sequence.{u1, u2} α β _inst_1 _inst_2 (fun (x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 : β) (x._@.Mathlib.Logic.Encodable.Basic._hyg.4383 : β) => LE.le.{u2} β (Preorder.toLE.{u2} β _inst_3) x._@.Mathlib.Logic.Encodable.Basic._hyg.4381 x._@.Mathlib.Logic.Encodable.Basic._hyg.4383) f hf (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) (Encodable.encode.{u1} α _inst_1 a) (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1)))))
+Case conversion may be inaccurate. Consider using '#align directed.le_sequence Directed.le_sequenceₓ'. -/
 theorem le_sequence (a : α) : f a ≤ f (hf.sequence f (encode a + 1)) :=
   hf.rel_sequence a
 #align directed.le_sequence Directed.le_sequence
--/
 
 end Directed
 
Diff
@@ -146,10 +146,10 @@ theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :
   rfl
 #align encodable.decode_of_equiv Encodable.decode_ofEquiv
 
-#print Encodable.Nat.encodable /-
-instance Encodable.Nat.encodable : Encodable ℕ :=
+#print Nat.encodable /-
+instance Nat.encodable : Encodable ℕ :=
   ⟨id, some, fun a => rfl⟩
-#align nat.encodable Encodable.Nat.encodable
+#align nat.encodable Nat.encodable
 -/
 
 #print Encodable.encode_nat /-
@@ -166,16 +166,16 @@ theorem decode_nat (n : ℕ) : decode ℕ n = some n :=
 #align encodable.decode_nat Encodable.decode_nat
 -/
 
-#print Encodable.IsEmpty.toEncodable /-
-instance (priority := 100) Encodable.IsEmpty.toEncodable [IsEmpty α] : Encodable α :=
+#print IsEmpty.toEncodable /-
+instance (priority := 100) IsEmpty.toEncodable [IsEmpty α] : Encodable α :=
   ⟨isEmptyElim, fun n => none, isEmptyElim⟩
-#align is_empty.to_encodable Encodable.IsEmpty.toEncodable
+#align is_empty.to_encodable IsEmpty.toEncodable
 -/
 
-#print Encodable.PUnit.encodable /-
-instance Encodable.PUnit.encodable : Encodable PUnit :=
+#print PUnit.encodable /-
+instance PUnit.encodable : Encodable PUnit :=
   ⟨fun _ => 0, fun n => Nat.casesOn n (some PUnit.unit) fun _ => none, fun _ => by simp⟩
-#align punit.encodable Encodable.PUnit.encodable
+#align punit.encodable PUnit.encodable
 -/
 
 #print Encodable.encode_star /-
@@ -329,11 +329,11 @@ def equivRangeEncode (α : Type _) [Encodable α] : α ≃ Set.range (@encode α
 #align encodable.equiv_range_encode Encodable.equivRangeEncode
 -/
 
-#print Encodable.Unique.encodable /-
+#print Unique.encodable /-
 /-- A type with unique element is encodable. This is not an instance to avoid diamonds. -/
-def Encodable.Unique.encodable [Unique α] : Encodable α :=
+def Unique.encodable [Unique α] : Encodable α :=
   ⟨fun _ => 0, fun _ => some default, Unique.forall_iff.2 rfl⟩
-#align unique.encodable Encodable.Unique.encodable
+#align unique.encodable Unique.encodable
 -/
 
 section Sum
@@ -357,11 +357,11 @@ def decodeSum (n : ℕ) : Option (Sum α β) :=
 #align encodable.decode_sum Encodable.decodeSum
 -/
 
-#print Encodable.Sum.encodable /-
+#print Sum.encodable /-
 /-- If `α` and `β` are encodable, then so is their sum. -/
-instance Encodable.Sum.encodable : Encodable (Sum α β) :=
+instance Sum.encodable : Encodable (Sum α β) :=
   ⟨encodeSum, decodeSum, fun s => by cases s <;> simp [encode_sum, decode_sum, encodek] <;> rfl⟩
-#align sum.encodable Encodable.Sum.encodable
+#align sum.encodable Sum.encodable
 -/
 
 @[simp]
@@ -376,9 +376,9 @@ theorem encode_inr (b : β) : @encode (Sum α β) _ (Sum.inr b) = bit1 (encode b
 
 /- warning: encodable.decode_sum_val -> Encodable.decode_sum_val is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Encodable.{u2} β] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sum.{u1, u2} α β)) (Encodable.decode.{max u1 u2} (Sum.{u1, u2} α β) (Encodable.Sum.encodable.{u1, u2} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u1, u2} α β _inst_1 _inst_2 n)
+  forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : Encodable.{u2} β] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sum.{u1, u2} α β)) (Encodable.decode.{max u1 u2} (Sum.{u1, u2} α β) (Sum.encodable.{u1, u2} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u1, u2} α β _inst_1 _inst_2 n)
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : Encodable.{u1} β] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sum.{u2, u1} α β)) (Encodable.decode.{max u2 u1} (Sum.{u2, u1} α β) (Encodable.Sum.encodable.{u2, u1} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u2, u1} α β _inst_1 _inst_2 n)
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : Encodable.{u1} β] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sum.{u2, u1} α β)) (Encodable.decode.{max u2 u1} (Sum.{u2, u1} α β) (Sum.encodable.{u2, u1} α β _inst_1 _inst_2) n) (Encodable.decodeSum.{u2, u1} α β _inst_1 _inst_2 n)
 Case conversion may be inaccurate. Consider using '#align encodable.decode_sum_val Encodable.decode_sum_valₓ'. -/
 @[simp]
 theorem decode_sum_val (n : ℕ) : decode (Sum α β) n = decodeSum n :=
@@ -387,10 +387,10 @@ theorem decode_sum_val (n : ℕ) : decode (Sum α β) n = decodeSum n :=
 
 end Sum
 
-#print Encodable.Bool.encodable /-
-instance Encodable.Bool.encodable : Encodable Bool :=
+#print Bool.encodable /-
+instance Bool.encodable : Encodable Bool :=
   ofEquiv (Sum Unit Unit) Equiv.boolEquivPUnitSumPUnit
-#align bool.encodable Encodable.Bool.encodable
+#align bool.encodable Bool.encodable
 -/
 
 #print Encodable.encode_true /-
@@ -436,10 +436,10 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : decode Bool n = none :=
 #align encodable.decode_ge_two Encodable.decode_ge_two
 -/
 
-#print Encodable.Prop.encodable /-
-noncomputable instance Encodable.Prop.encodable : Encodable Prop :=
+#print Prop.encodable /-
+noncomputable instance Prop.encodable : Encodable Prop :=
   ofEquiv Bool Equiv.propEquivBool
-#align Prop.encodable Encodable.Prop.encodable
+#align Prop.encodable Prop.encodable
 -/
 
 section Sigma
@@ -461,18 +461,18 @@ def decodeSigma (n : ℕ) : Option (Sigma γ) :=
 #align encodable.decode_sigma Encodable.decodeSigma
 -/
 
-#print Encodable.Sigma.encodable /-
-instance Encodable.Sigma.encodable : Encodable (Sigma γ) :=
+#print Sigma.encodable /-
+instance Sigma.encodable : Encodable (Sigma γ) :=
   ⟨encodeSigma, decodeSigma, fun ⟨a, b⟩ => by
     simp [encode_sigma, decode_sigma, unpair_mkpair, encodek]⟩
-#align sigma.encodable Encodable.Sigma.encodable
+#align sigma.encodable Sigma.encodable
 -/
 
 /- warning: encodable.decode_sigma_val -> Encodable.decode_sigma_val is a dubious translation:
 lean 3 declaration is
-  forall {α : Type.{u1}} {γ : α -> Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : forall (a : α), Encodable.{u2} (γ a)] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sigma.{u1, u2} α γ)) (Encodable.decode.{max u1 u2} (Sigma.{u1, u2} α γ) (Encodable.Sigma.encodable.{u1, u2} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u1, max u1 u2} α (Sigma.{u1, u2} α γ) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u2, max u1 u2} (γ a) (Sigma.{u1, u2} α γ) (Sigma.mk.{u1, u2} α γ a) (Encodable.decode.{u2} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
+  forall {α : Type.{u1}} {γ : α -> Type.{u2}} [_inst_1 : Encodable.{u1} α] [_inst_2 : forall (a : α), Encodable.{u2} (γ a)] (n : Nat), Eq.{succ (max u1 u2)} (Option.{max u1 u2} (Sigma.{u1, u2} α γ)) (Encodable.decode.{max u1 u2} (Sigma.{u1, u2} α γ) (Sigma.encodable.{u1, u2} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u1, max u1 u2} α (Sigma.{u1, u2} α γ) (Encodable.decode.{u1} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u2, max u1 u2} (γ a) (Sigma.{u1, u2} α γ) (Sigma.mk.{u1, u2} α γ a) (Encodable.decode.{u2} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
 but is expected to have type
-  forall {α : Type.{u2}} {γ : α -> Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : forall (a : α), Encodable.{u1} (γ a)] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sigma.{u2, u1} α γ)) (Encodable.decode.{max u2 u1} (Sigma.{u2, u1} α γ) (Encodable.Sigma.encodable.{u2, u1} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u2, max u2 u1} α (Sigma.{u2, u1} α γ) (Encodable.decode.{u2} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u1, max u2 u1} (γ a) (Sigma.{u2, u1} α γ) (Sigma.mk.{u2, u1} α γ a) (Encodable.decode.{u1} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
+  forall {α : Type.{u2}} {γ : α -> Type.{u1}} [_inst_1 : Encodable.{u2} α] [_inst_2 : forall (a : α), Encodable.{u1} (γ a)] (n : Nat), Eq.{max (succ u2) (succ u1)} (Option.{max u2 u1} (Sigma.{u2, u1} α γ)) (Encodable.decode.{max u2 u1} (Sigma.{u2, u1} α γ) (Sigma.encodable.{u2, u1} α γ _inst_1 (fun (a : α) => _inst_2 a)) n) (Option.bind.{u2, max u2 u1} α (Sigma.{u2, u1} α γ) (Encodable.decode.{u2} α _inst_1 (Prod.fst.{0, 0} Nat Nat (Nat.unpair n))) (fun (a : α) => Option.map.{u1, max u2 u1} (γ a) (Sigma.{u2, u1} α γ) (Sigma.mk.{u2, u1} α γ a) (Encodable.decode.{u1} (γ a) (_inst_2 a) (Prod.snd.{0, 0} Nat Nat (Nat.unpair n)))))
 Case conversion may be inaccurate. Consider using '#align encodable.decode_sigma_val Encodable.decode_sigma_valₓ'. -/
 @[simp]
 theorem decode_sigma_val (n : ℕ) :
@@ -545,11 +545,11 @@ def decodeSubtype (v : ℕ) : Option { a : α // P a } :=
 #align encodable.decode_subtype Encodable.decodeSubtype
 -/
 
-#print Encodable.Subtype.encodable /-
+#print Subtype.encodable /-
 /-- A decidable subtype of an encodable type is encodable. -/
-instance Encodable.Subtype.encodable : Encodable { a : α // P a } :=
+instance Subtype.encodable : Encodable { a : α // P a } :=
   ⟨encodeSubtype, decodeSubtype, fun ⟨v, h⟩ => by simp [encode_subtype, decode_subtype, encodek, h]⟩
-#align subtype.encodable Encodable.Subtype.encodable
+#align subtype.encodable Subtype.encodable
 -/
 
 #print Encodable.Subtype.encode_eq /-
@@ -559,36 +559,36 @@ theorem Subtype.encode_eq (a : Subtype P) : encode a = encode a.val := by cases
 
 end Subtype
 
-#print Encodable.Fin.encodable /-
-instance Encodable.Fin.encodable (n) : Encodable (Fin n) :=
+#print Fin.encodable /-
+instance Fin.encodable (n) : Encodable (Fin n) :=
   ofEquiv _ Fin.equivSubtype
-#align fin.encodable Encodable.Fin.encodable
+#align fin.encodable Fin.encodable
 -/
 
-#print Encodable.Int.encodable /-
-instance Encodable.Int.encodable : Encodable ℤ :=
+#print Int.encodable /-
+instance Int.encodable : Encodable ℤ :=
   ofEquiv _ Equiv.intEquivNat
-#align int.encodable Encodable.Int.encodable
+#align int.encodable Int.encodable
 -/
 
-#print Encodable.PNat.encodable /-
-instance Encodable.PNat.encodable : Encodable ℕ+ :=
+#print PNat.encodable /-
+instance PNat.encodable : Encodable ℕ+ :=
   ofEquiv _ Equiv.pnatEquivNat
-#align pnat.encodable Encodable.PNat.encodable
+#align pnat.encodable PNat.encodable
 -/
 
-#print Encodable.ULift.encodable /-
+#print ULift.encodable /-
 /-- The lift of an encodable type is encodable. -/
-instance Encodable.ULift.encodable [Encodable α] : Encodable (ULift α) :=
+instance ULift.encodable [Encodable α] : Encodable (ULift α) :=
   ofEquiv _ Equiv.ulift
-#align ulift.encodable Encodable.ULift.encodable
+#align ulift.encodable ULift.encodable
 -/
 
-#print Encodable.PLift.encodable /-
+#print PLift.encodable /-
 /-- The lift of an encodable type is encodable. -/
-instance Encodable.PLift.encodable [Encodable α] : Encodable (PLift α) :=
+instance PLift.encodable [Encodable α] : Encodable (PLift α) :=
   ofEquiv _ Equiv.plift
-#align plift.encodable Encodable.PLift.encodable
+#align plift.encodable PLift.encodable
 -/
 
 #print Encodable.ofInj /-
Diff
@@ -46,7 +46,7 @@ to make the range of `encode` decidable even when the finiteness of `α` is not.
 open Option List Nat Function
 
 #print Encodable /-
-/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`decode] [] -/
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → option α`. Note that finite types *are* countable. See `denumerable` if you
 wish to enforce infiniteness. -/
@@ -629,7 +629,7 @@ instance : Countable ℕ+ :=
 -- short-circuit instance search
 section Ulower
 
-attribute [local instance] Encodable.decidableRangeEncode
+attribute [local instance 100] Encodable.decidableRangeEncode
 
 #print Ulower /-
 /-- `ulower α : Type` is an equivalent type in the lowest universe, given `encodable α`. -/
Diff
@@ -449,7 +449,7 @@ variable {γ : α → Type _} [Encodable α] [∀ a, Encodable (γ a)]
 #print Encodable.encodeSigma /-
 /-- Explicit encoding function for `sigma γ` -/
 def encodeSigma : Sigma γ → ℕ
-  | ⟨a, b⟩ => mkpair (encode a) (encode b)
+  | ⟨a, b⟩ => pair (encode a) (encode b)
 #align encodable.encode_sigma Encodable.encodeSigma
 -/
 
@@ -483,7 +483,7 @@ theorem decode_sigma_val (n : ℕ) :
 
 #print Encodable.encode_sigma_val /-
 @[simp]
-theorem encode_sigma_val (a b) : @encode (Sigma γ) _ ⟨a, b⟩ = mkpair (encode a) (encode b) :=
+theorem encode_sigma_val (a b) : @encode (Sigma γ) _ ⟨a, b⟩ = pair (encode a) (encode b) :=
   rfl
 #align encodable.encode_sigma_val Encodable.encode_sigma_val
 -/
@@ -514,7 +514,7 @@ theorem decode_prod_val (n : ℕ) :
 
 #print Encodable.encode_prod_val /-
 @[simp]
-theorem encode_prod_val (a b) : @encode (α × β) _ (a, b) = mkpair (encode a) (encode b) :=
+theorem encode_prod_val (a b) : @encode (α × β) _ (a, b) = pair (encode a) (encode b) :=
   rfl
 #align encodable.encode_prod_val Encodable.encode_prod_val
 -/
Diff
@@ -126,7 +126,7 @@ def ofEquiv (α) [Encodable α] (e : β ≃ α) : Encodable β :=
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) b) (Encodable.encode.{u1} α _inst_1 (coeFn.{max 1 (max (succ u2) (succ u1)) (succ u1) (succ u2), max (succ u2) (succ u1)} (Equiv.{succ u2, succ u1} β α) (fun (_x : Equiv.{succ u2, succ u1} β α) => β -> α) (Equiv.hasCoeToFun.{succ u2, succ u1} β α) e b))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) b) (Encodable.encode.{u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.805 : β) => α) b) _inst_1 (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (Equiv.{succ u1, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.805 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u1, succ u2} β α) e b))
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (b : β), Eq.{1} Nat (Encodable.encode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) b) (Encodable.encode.{u2} ((fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) b) _inst_1 (FunLike.coe.{max (succ u2) (succ u1), succ u1, succ u2} (Equiv.{succ u1, succ u2} β α) β (fun (_x : β) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : β) => α) _x) (Equiv.instFunLikeEquiv.{succ u1, succ u2} β α) e b))
 Case conversion may be inaccurate. Consider using '#align encodable.encode_of_equiv Encodable.encode_ofEquivₓ'. -/
 @[simp]
 theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
@@ -138,7 +138,7 @@ theorem encode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (b : β) :
 lean 3 declaration is
   forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Encodable.{u1} α] (e : Equiv.{succ u2, succ u1} β α) (n : Nat), Eq.{succ u2} (Option.{u2} β) (Encodable.decode.{u2} β (Encodable.ofEquiv.{u2, u1} β α _inst_1 e) n) (Option.map.{u1, u2} α β (coeFn.{max 1 (max (succ u1) (succ u2)) (succ u2) (succ u1), max (succ u1) (succ u2)} (Equiv.{succ u1, succ u2} α β) (fun (_x : Equiv.{succ u1, succ u2} α β) => α -> β) (Equiv.hasCoeToFun.{succ u1, succ u2} α β) (Equiv.symm.{succ u2, succ u1} β α e)) (Encodable.decode.{u1} α _inst_1 n))
 but is expected to have type
-  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (n : Nat), Eq.{succ u1} (Option.{u1} β) (Encodable.decode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) n) (Option.map.{u2, u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Equiv.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.805 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u1} α β) (Equiv.symm.{succ u1, succ u2} β α e)) (Encodable.decode.{u2} α _inst_1 n))
+  forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Encodable.{u2} α] (e : Equiv.{succ u1, succ u2} β α) (n : Nat), Eq.{succ u1} (Option.{u1} β) (Encodable.decode.{u1} β (Encodable.ofEquiv.{u1, u2} β α _inst_1 e) n) (Option.map.{u2, u1} α β (FunLike.coe.{max (succ u2) (succ u1), succ u2, succ u1} (Equiv.{succ u2, succ u1} α β) α (fun (_x : α) => (fun (x._@.Mathlib.Logic.Equiv.Defs._hyg.808 : α) => β) _x) (Equiv.instFunLikeEquiv.{succ u2, succ u1} α β) (Equiv.symm.{succ u1, succ u2} β α e)) (Encodable.decode.{u2} α _inst_1 n))
 Case conversion may be inaccurate. Consider using '#align encodable.decode_of_equiv Encodable.decode_ofEquivₓ'. -/
 @[simp]
 theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :

Changes in mathlib4

mathlib3
mathlib4
chore: avoid Ne.def (adaptation for nightly-2024-03-27) (#11801)
Diff
@@ -210,7 +210,7 @@ theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = som
 
 theorem decode₂_ne_none_iff [Encodable α] {n : ℕ} :
     decode₂ α n ≠ none ↔ n ∈ Set.range (encode : α → ℕ) := by
-  simp_rw [Set.range, Set.mem_setOf_eq, Ne.def, Option.eq_none_iff_forall_not_mem,
+  simp_rw [Set.range, Set.mem_setOf_eq, Ne, Option.eq_none_iff_forall_not_mem,
     Encodable.mem_decode₂, not_forall, not_not]
 #align encodable.decode₂_ne_none_iff Encodable.decode₂_ne_none_iff
 
chore: squeeze some non-terminal simps (#11247)

This PR accompanies #11246, squeezing some non-terminal simps highlighted by the linter until I decided to stop!

Diff
@@ -191,7 +191,7 @@ def decode₂ (α) [Encodable α] (n : ℕ) : Option α :=
 
 theorem mem_decode₂' [Encodable α] {n : ℕ} {a : α} :
     a ∈ decode₂ α n ↔ a ∈ decode n ∧ encode a = n := by
-  simp [decode₂]; exact ⟨fun ⟨_, h₁, rfl, h₂⟩ => ⟨h₁, h₂⟩, fun ⟨h₁, h₂⟩ => ⟨_, h₁, rfl, h₂⟩⟩
+  simpa [decode₂] using ⟨fun ⟨_, h₁, rfl, h₂⟩ => ⟨h₁, h₂⟩, fun ⟨h₁, h₂⟩ => ⟨_, h₁, rfl, h₂⟩⟩
 #align encodable.mem_decode₂' Encodable.mem_decode₂'
 
 theorem mem_decode₂ [Encodable α] {n : ℕ} {a : α} : a ∈ decode₂ α n ↔ encode a = n :=
@@ -332,7 +332,7 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none := by
     rw [Nat.le_div_iff_mul_le]
     exacts [h, by decide]
   cases' exists_eq_succ_of_ne_zero (_root_.ne_of_gt this) with m e
-  simp [decodeSum, div2_val]; cases bodd n <;> simp [e]
+  simp only [decodeSum, boddDiv2_eq, div2_val]; cases bodd n <;> simp [e]
 #align encodable.decode_ge_two Encodable.decode_ge_two
 
 noncomputable instance _root_.Prop.encodable : Encodable Prop :=
style: homogenise porting notes (#11145)

Homogenises porting notes via capitalisation and addition of whitespace.

It makes the following changes:

  • converts "--porting note" into "-- Porting note";
  • converts "porting note" into "Porting note".
Diff
@@ -45,7 +45,7 @@ wish to enforce infiniteness. -/
 class Encodable (α : Type*) where
   /-- Encoding from Type α to ℕ -/
   encode : α → ℕ
-  --Porting note: was `decode [] : ℕ → Option α`. This means that `decode` does not take the type
+  -- Porting note: was `decode [] : ℕ → Option α`. This means that `decode` does not take the type
   --explicitly in Lean4
   /-- Decoding from ℕ to Option α-/
   decode : ℕ → Option α
@@ -261,7 +261,7 @@ section Sum
 
 variable [Encodable α] [Encodable β]
 
---Porting note: removing bit0 and bit1
+-- Porting note: removing bit0 and bit1
 /-- Explicit encoding function for the sum of two encodable types. -/
 def encodeSum : Sum α β → ℕ
   | Sum.inl a => 2 * encode a
@@ -280,13 +280,13 @@ instance _root_.Sum.encodable : Encodable (Sum α β) :=
   ⟨encodeSum, decodeSum, fun s => by cases s <;> simp [encodeSum, div2_val, decodeSum, encodek]⟩
 #align sum.encodable Sum.encodable
 
---Porting note: removing bit0 and bit1 from statement
+-- Porting note: removing bit0 and bit1 from statement
 @[simp]
 theorem encode_inl (a : α) : @encode (Sum α β) _ (Sum.inl a) = 2 * (encode a) :=
   rfl
 #align encodable.encode_inl Encodable.encode_inlₓ
 
---Porting note: removing bit0 and bit1 from statement
+-- Porting note: removing bit0 and bit1 from statement
 @[simp]
 theorem encode_inr (b : β) : @encode (Sum α β) _ (Sum.inr b) = 2 * (encode b) + 1 :=
   rfl
chore: remove include/omit porting notes (#10517)

See this Zulip discussion.

Diff
@@ -403,15 +403,11 @@ open Subtype Decidable
 
 variable {P : α → Prop} [encA : Encodable α] [decP : DecidablePred P]
 
---include encA
-
 /-- Explicit encoding function for a decidable subtype of an encodable type -/
 def encodeSubtype : { a : α // P a } → ℕ
   | ⟨v,_⟩ => encode v
 #align encodable.encode_subtype Encodable.encodeSubtype
 
---include decP
-
 /-- Explicit decoding function for a decidable subtype of an encodable type -/
 def decodeSubtype (v : ℕ) : Option { a : α // P a } :=
   (decode v).bind fun a => if h : P a then some ⟨a, h⟩ else none
refactor(Probability/Kernel/CondCdf): mv some theorems (#10036)

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

Diff
@@ -655,7 +655,11 @@ theorem rel_sequence {r : β → β → Prop} {f : α → β} (hf : Directed r f
   exact (Classical.choose_spec (hf _ a)).2
 #align directed.rel_sequence Directed.rel_sequence
 
-variable [Preorder β] {f : α → β} (hf : Directed (· ≤ ·) f)
+variable [Preorder β] {f : α → β}
+
+section
+
+variable (hf : Directed (· ≤ ·) f)
 
 theorem sequence_mono : Monotone (f ∘ hf.sequence f) :=
   monotone_nat_of_le_succ <| hf.sequence_mono_nat
@@ -665,6 +669,22 @@ theorem le_sequence (a : α) : f a ≤ f (hf.sequence f (encode a + 1)) :=
   hf.rel_sequence a
 #align directed.le_sequence Directed.le_sequence
 
+end
+
+section
+
+variable (hf : Directed (· ≥ ·) f)
+
+theorem sequence_anti : Antitone (f ∘ hf.sequence f) :=
+  antitone_nat_of_succ_le <| hf.sequence_mono_nat
+#align directed.sequence_anti Directed.sequence_anti
+
+theorem sequence_le (a : α) : f (hf.sequence f (Encodable.encode a + 1)) ≤ f a :=
+  hf.rel_sequence a
+#align directed.sequence_le Directed.sequence_le
+
+end
+
 end Directed
 
 section Quotient
chore: remove unused cases' names (#9451)

These unused names will soon acquire a linter warning. Easiest to clean them up pre-emptively.

(Thanks to @nomeata for fixing these on nightly-testing.)

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

Diff
@@ -644,7 +644,7 @@ theorem sequence_mono_nat {r : β → β → Prop} {f : α → β} (hf : Directe
     r (f (hf.sequence f n)) (f (hf.sequence f (n + 1))) := by
   dsimp [Directed.sequence]
   generalize hf.sequence f n = p
-  cases' h : (decode n: Option α) with a
+  cases' (decode n : Option α) with a
   · exact (Classical.choose_spec (hf p p)).1
   · exact (Classical.choose_spec (hf p a)).1
 #align directed.sequence_mono_nat Directed.sequence_mono_nat
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
@@ -42,7 +42,7 @@ open Option List Nat Function
 /-- Constructively countable type. Made from an explicit injection `encode : α → ℕ` and a partial
 inverse `decode : ℕ → Option α`. Note that finite types *are* countable. See `Denumerable` if you
 wish to enforce infiniteness. -/
-class Encodable (α : Type _) where
+class Encodable (α : Type*) where
   /-- Encoding from Type α to ℕ -/
   encode : α → ℕ
   --Porting note: was `decode [] : ℕ → Option α`. This means that `decode` does not take the type
@@ -57,7 +57,7 @@ attribute [simp] Encodable.encodek
 
 namespace Encodable
 
-variable {α : Type _} {β : Type _}
+variable {α : Type*} {β : Type*}
 
 universe u
 
@@ -75,7 +75,7 @@ theorem encode_inj [Encodable α] {a b : α} : encode a = encode b ↔ a = b :=
 instance (priority := 400) countable [Encodable α] : Countable α where
   exists_injective_nat' := ⟨_,encode_injective⟩
 
-theorem surjective_decode_iget (α : Type _) [Encodable α] [Inhabited α] :
+theorem surjective_decode_iget (α : Type*) [Encodable α] [Inhabited α] :
     Surjective fun n => ((Encodable.decode n).iget : α) := fun x =>
   ⟨Encodable.encode x, by simp_rw [Encodable.encodek]⟩
 #align encodable.surjective_decode_iget Encodable.surjective_decode_iget
@@ -155,7 +155,7 @@ theorem decode_unit_succ (n) : decode (succ n) = (none : Option PUnit) :=
 #align encodable.decode_unit_succ Encodable.decode_unit_succ
 
 /-- If `α` is encodable, then so is `Option α`. -/
-instance _root_.Option.encodable {α : Type _} [h : Encodable α] : Encodable (Option α) :=
+instance _root_.Option.encodable {α : Type*} [h : Encodable α] : Encodable (Option α) :=
   ⟨fun o => Option.casesOn o Nat.zero fun a => succ (encode a), fun n =>
     Nat.casesOn n (some none) fun m => (decode m).map some, fun o => by
     cases o <;> dsimp; simp [encodek, Nat.succ_ne_zero]⟩
@@ -228,7 +228,7 @@ theorem encodek₂ [Encodable α] (a : α) : decode₂ α (encode a) = some a :=
 #align encodable.encodek₂ Encodable.encodek₂
 
 /-- The encoding function has decidable range. -/
-def decidableRangeEncode (α : Type _) [Encodable α] : DecidablePred (· ∈ Set.range (@encode α _)) :=
+def decidableRangeEncode (α : Type*) [Encodable α] : DecidablePred (· ∈ Set.range (@encode α _)) :=
   fun x =>
   decidable_of_iff (Option.isSome (decode₂ α x))
     ⟨fun h => ⟨Option.get _ h, by rw [← decode₂_is_partial_inv (Option.get _ h), Option.some_get]⟩,
@@ -236,7 +236,7 @@ def decidableRangeEncode (α : Type _) [Encodable α] : DecidablePred (· ∈ Se
 #align encodable.decidable_range_encode Encodable.decidableRangeEncode
 
 /-- An encodable type is equivalent to the range of its encoding function. -/
-def equivRangeEncode (α : Type _) [Encodable α] : α ≃ Set.range (@encode α _)
+def equivRangeEncode (α : Type*) [Encodable α] : α ≃ Set.range (@encode α _)
     where
   toFun := fun a : α => ⟨encode a, Set.mem_range_self _⟩
   invFun n :=
@@ -341,7 +341,7 @@ noncomputable instance _root_.Prop.encodable : Encodable Prop :=
 
 section Sigma
 
-variable {γ : α → Type _} [Encodable α] [∀ a, Encodable (γ a)]
+variable {γ : α → Type*} [Encodable α] [∀ a, Encodable (γ a)]
 
 /-- Explicit encoding function for `Sigma γ` -/
 def encodeSigma : Sigma γ → ℕ
@@ -455,7 +455,7 @@ noncomputable def ofInj [Encodable β] (f : α → β) (hf : Injective f) : Enco
 #align encodable.of_inj Encodable.ofInj
 
 /-- If `α` is countable, then it has a (non-canonical) `Encodable` structure. -/
-noncomputable def ofCountable (α : Type _) [Countable α] : Encodable α :=
+noncomputable def ofCountable (α : Type*) [Countable α] : Encodable α :=
   Nonempty.some <|
     let ⟨f, hf⟩ := exists_injective_nat α
     ⟨ofInj f hf⟩
@@ -469,7 +469,7 @@ theorem nonempty_encodable : Nonempty (Encodable α) ↔ Countable α :=
 end Encodable
 
 /-- See also `nonempty_fintype`, `nonempty_denumerable`. -/
-theorem nonempty_encodable (α : Type _) [Countable α] : Nonempty (Encodable α) :=
+theorem nonempty_encodable (α : Type*) [Countable α] : Nonempty (Encodable α) :=
   ⟨Encodable.ofCountable _⟩
 #align nonempty_encodable nonempty_encodable
 
@@ -481,21 +481,21 @@ section ULower
 attribute [local instance] Encodable.decidableRangeEncode
 
 /-- `ULower α : Type` is an equivalent type in the lowest universe, given `Encodable α`. -/
-def ULower (α : Type _) [Encodable α] : Type :=
+def ULower (α : Type*) [Encodable α] : Type :=
   Set.range (Encodable.encode : α → ℕ)
 #align ulower ULower
 
-instance {α : Type _} [Encodable α] : DecidableEq (ULower α) :=
+instance {α : Type*} [Encodable α] : DecidableEq (ULower α) :=
   by delta ULower; exact Encodable.decidableEqOfEncodable _
 
-instance {α : Type _} [Encodable α] : Encodable (ULower α) :=
+instance {α : Type*} [Encodable α] : Encodable (ULower α) :=
   by delta ULower; infer_instance
 
 end ULower
 
 namespace ULower
 
-variable (α : Type _) [Encodable α]
+variable (α : Type*) [Encodable α]
 
 /-- The equivalence between the encodable type `α` and `ULower α : Type`. -/
 def equiv : α ≃ ULower α :=
@@ -548,15 +548,15 @@ end ULower
 Choice function for encodable types and decidable predicates.
 We provide the following API
 
-choose      {α : Type _} {p : α → Prop} [c : encodable α] [d : decidable_pred p] : (∃ x, p x) → α :=
-choose_spec {α : Type _} {p : α → Prop} [c : encodable α] [d : decidable_pred p] (ex : ∃ x, p x) :
+choose      {α : Type*} {p : α → Prop} [c : encodable α] [d : decidable_pred p] : (∃ x, p x) → α :=
+choose_spec {α : Type*} {p : α → Prop} [c : encodable α] [d : decidable_pred p] (ex : ∃ x, p x) :
   p (choose ex) :=
 -/
 namespace Encodable
 
 section FindA
 
-variable {α : Type _} (p : α → Prop) [Encodable α] [DecidablePred p]
+variable {α : Type*} (p : α → Prop) [Encodable α] [DecidablePred p]
 
 private def good : Option α → Prop
   | some a => p a
@@ -592,13 +592,13 @@ theorem choose_spec (h : ∃ x, p x) : p (choose h) :=
 end FindA
 
 /-- A constructive version of `Classical.axiom_of_choice` for `Encodable` types. -/
-theorem axiom_of_choice {α : Type _} {β : α → Type _} {R : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
+theorem axiom_of_choice {α : Type*} {β : α → Type*} {R : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
     [∀ x y, Decidable (R x y)] (H : ∀ x, ∃ y, R x y) : ∃ f : ∀ a, β a, ∀ x, R x (f x) :=
   ⟨fun x => choose (H x), fun x => choose_spec (H x)⟩
 #align encodable.axiom_of_choice Encodable.axiom_of_choice
 
 /-- A constructive version of `Classical.skolem` for `Encodable` types. -/
-theorem skolem {α : Type _} {β : α → Type _} {P : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
+theorem skolem {α : Type*} {β : α → Type*} {P : ∀ x, β x → Prop} [∀ a, Encodable (β a)]
     [∀ x y, Decidable (P x y)] : (∀ x, ∃ y, P x y) ↔ ∃ f : ∀ a, β a, ∀ x, P x (f x) :=
   ⟨axiom_of_choice, fun ⟨_, H⟩ x => ⟨_, H x⟩⟩
 #align encodable.skolem Encodable.skolem
@@ -626,7 +626,7 @@ namespace Directed
 
 open Encodable
 
-variable {α : Type _} {β : Type _} [Encodable α] [Inhabited α]
+variable {α : Type*} {β : Type*} [Encodable α] [Inhabited α]
 
 /-- Given a `Directed r` function `f : α → β` defined on an encodable inhabited type,
 construct a noncomputable sequence such that `r (f (x n)) (f (x (n + 1)))`
@@ -671,7 +671,7 @@ section Quotient
 
 open Encodable Quotient
 
-variable {α : Type _} {s : Setoid α} [@DecidableRel α (· ≈ ·)] [Encodable α]
+variable {α : Type*} {s : Setoid α} [@DecidableRel α (· ≈ ·)] [Encodable α]
 
 /-- Representative of an equivalence class. This is a computable version of `Quot.out` for a setoid
 on an encodable type. -/
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,11 +2,6 @@
 Copyright (c) 2015 Microsoft Corporation. All rights reserved.
 Released under Apache 2.0 license as described in the file LICENSE.
 Authors: Leonardo de Moura, Mario Carneiro
-
-! This file was ported from Lean 3 source module logic.encodable.basic
-! leanprover-community/mathlib commit 7c523cb78f4153682c2929e3006c863bfef463d0
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
 -/
 import Mathlib.Logic.Equiv.Nat
 import Mathlib.Data.PNat.Basic
@@ -15,6 +10,8 @@ import Mathlib.Data.Countable.Defs
 import Mathlib.Order.RelIso.Basic
 import Mathlib.Data.Fin.Basic
 
+#align_import logic.encodable.basic from "leanprover-community/mathlib"@"7c523cb78f4153682c2929e3006c863bfef463d0"
+
 /-!
 # Encodable types
 
chore: remove occurrences of semicolon after space (#5713)

This is the second half of the changes originally in #5699, removing all occurrences of ; after a space and implementing a linter rule to enforce it.

In most cases this 2-character substring has a space after it, so the following command was run first:

find . -type f -name "*.lean" -exec sed -i -E 's/ ; /; /g' {} \;

The remaining cases were few enough in number that they were done manually.

Diff
@@ -161,7 +161,7 @@ theorem decode_unit_succ (n) : decode (succ n) = (none : Option PUnit) :=
 instance _root_.Option.encodable {α : Type _} [h : Encodable α] : Encodable (Option α) :=
   ⟨fun o => Option.casesOn o Nat.zero fun a => succ (encode a), fun n =>
     Nat.casesOn n (some none) fun m => (decode m).map some, fun o => by
-    cases o <;> dsimp ; simp [encodek, Nat.succ_ne_zero]⟩
+    cases o <;> dsimp; simp [encodek, Nat.succ_ne_zero]⟩
 #align option.encodable Option.encodable
 
 @[simp]
@@ -194,7 +194,7 @@ def decode₂ (α) [Encodable α] (n : ℕ) : Option α :=
 
 theorem mem_decode₂' [Encodable α] {n : ℕ} {a : α} :
     a ∈ decode₂ α n ↔ a ∈ decode n ∧ encode a = n := by
-  simp [decode₂] ; exact ⟨fun ⟨_, h₁, rfl, h₂⟩ => ⟨h₁, h₂⟩, fun ⟨h₁, h₂⟩ => ⟨_, h₁, rfl, h₂⟩⟩
+  simp [decode₂]; exact ⟨fun ⟨_, h₁, rfl, h₂⟩ => ⟨h₁, h₂⟩, fun ⟨h₁, h₂⟩ => ⟨_, h₁, rfl, h₂⟩⟩
 #align encodable.mem_decode₂' Encodable.mem_decode₂'
 
 theorem mem_decode₂ [Encodable α] {n : ℕ} {a : α} : a ∈ decode₂ α n ↔ encode a = n :=
@@ -235,7 +235,7 @@ def decidableRangeEncode (α : Type _) [Encodable α] : DecidablePred (· ∈ Se
   fun x =>
   decidable_of_iff (Option.isSome (decode₂ α x))
     ⟨fun h => ⟨Option.get _ h, by rw [← decode₂_is_partial_inv (Option.get _ h), Option.some_get]⟩,
-      fun ⟨n, hn⟩ => by rw [← hn, encodek₂] ; exact rfl⟩
+      fun ⟨n, hn⟩ => by rw [← hn, encodek₂]; exact rfl⟩
 #align encodable.decidable_range_encode Encodable.decidableRangeEncode
 
 /-- An encodable type is equivalent to the range of its encoding function. -/
@@ -244,8 +244,8 @@ def equivRangeEncode (α : Type _) [Encodable α] : α ≃ Set.range (@encode α
   toFun := fun a : α => ⟨encode a, Set.mem_range_self _⟩
   invFun n :=
     Option.get _
-      (show isSome (decode₂ α n.1) by cases' n.2 with x hx ; rw [← hx, encodek₂] ; exact rfl)
-  left_inv a := by dsimp ; rw [← Option.some_inj, Option.some_get, encodek₂]
+      (show isSome (decode₂ α n.1) by cases' n.2 with x hx; rw [← hx, encodek₂]; exact rfl)
+  left_inv a := by dsimp; rw [← Option.some_inj, Option.some_get, encodek₂]
   right_inv := fun ⟨n, x, hx⟩ => by
     apply Subtype.eq
     dsimp
@@ -425,7 +425,7 @@ instance _root_.Subtype.encodable : Encodable { a : α // P a } :=
   ⟨encodeSubtype, decodeSubtype, fun ⟨v, h⟩ => by simp [encodeSubtype, decodeSubtype, encodek, h]⟩
 #align subtype.encodable Subtype.encodable
 
-theorem Subtype.encode_eq (a : Subtype P) : encode a = encode a.val := by cases a ; rfl
+theorem Subtype.encode_eq (a : Subtype P) : encode a = encode a.val := by cases a; rfl
 #align encodable.subtype.encode_eq Encodable.Subtype.encode_eq
 
 end Subtype
@@ -689,7 +689,7 @@ theorem Quotient.rep_spec (q : Quotient s) : ⟦q.rep⟧ = q :=
 /-- The quotient of an encodable space by a decidable equivalence relation is encodable. -/
 def encodableQuotient : Encodable (Quotient s) :=
   ⟨fun q => encode q.rep, fun n => Quotient.mk'' <$> decode n, by
-    rintro ⟨l⟩ ; dsimp ; rw [encodek] ; exact congr_arg some ⟦l⟧.rep_spec⟩
+    rintro ⟨l⟩; dsimp; rw [encodek]; exact congr_arg some ⟦l⟧.rep_spec⟩
 #align encodable_quotient encodableQuotient
 
 end Quotient
chore: formatting issues (#4947)

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Parcly Taxel <reddeloostw@gmail.com>

Diff
@@ -322,7 +322,7 @@ theorem decode_zero : (decode 0 : Option Bool) = some false :=
 #align encodable.decode_zero Encodable.decode_zero
 
 @[simp]
-theorem decode_one : (decode 1: Option Bool) = some true :=
+theorem decode_one : (decode 1 : Option Bool) = some true :=
   rfl
 #align encodable.decode_one Encodable.decode_one
 
chore: bump to nightly-2023-06-10 (#4933)

The bumps to nightly-2023-06-10, which includes @gebner's https://github.com/leanprover/lean4/pull/2266.

After this is merged I encourage everyone to look around at simp regressions!

  • depends on: #4954 (I've moved changes that work without lean4#2266 to this PR)

Open in Gitpod

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -646,7 +646,7 @@ protected noncomputable def sequence {r : β → β → Prop} (f : α → β) (h
 theorem sequence_mono_nat {r : β → β → Prop} {f : α → β} (hf : Directed r f) (n : ℕ) :
     r (f (hf.sequence f n)) (f (hf.sequence f (n + 1))) := by
   dsimp [Directed.sequence]
-  generalize eq : hf.sequence f n = p
+  generalize hf.sequence f n = p
   cases' h : (decode n: Option α) with a
   · exact (Classical.choose_spec (hf p p)).1
   · exact (Classical.choose_spec (hf p a)).1
chore: add space after exacts (#4945)

Too often tempted to change these during other PRs, so doing a mass edit here.

Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au>

Diff
@@ -333,7 +333,7 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none := by
     rfl
   have : 1 ≤ n / 2 := by
     rw [Nat.le_div_iff_mul_le]
-    exacts[h, by decide]
+    exacts [h, by decide]
   cases' exists_eq_succ_of_ne_zero (_root_.ne_of_gt this) with m e
   simp [decodeSum, div2_val]; cases bodd n <;> simp [e]
 #align encodable.decode_ge_two Encodable.decode_ge_two
chore: rename Ulower to ULower (#4430)

ref #4354

Diff
@@ -30,8 +30,8 @@ The difference with `Denumerable` is that finite types are encodable. For infini
   partial inverse `decode : ℕ → Option α`.
 * `decode₂`: Version of `decode` that is equal to `none` outside of the range of `encode`. Useful as
   we do not require this in the definition of `decode`.
-* `Ulower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
-  subtype of `ℕ`. `Ulower α` finds it.
+* `ULower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
+  subtype of `ℕ`. `ULower α` finds it.
 
 ## Implementation notes
 
@@ -479,73 +479,73 @@ theorem nonempty_encodable (α : Type _) [Countable α] : Nonempty (Encodable α
 instance : Countable ℕ+ := by delta PNat; infer_instance
 
 -- short-circuit instance search
-section Ulower
+section ULower
 
 attribute [local instance] Encodable.decidableRangeEncode
 
 /-- `ULower α : Type` is an equivalent type in the lowest universe, given `Encodable α`. -/
-def Ulower (α : Type _) [Encodable α] : Type :=
+def ULower (α : Type _) [Encodable α] : Type :=
   Set.range (Encodable.encode : α → ℕ)
-#align ulower Ulower
+#align ulower ULower
 
-instance {α : Type _} [Encodable α] : DecidableEq (Ulower α) :=
-  by delta Ulower; exact Encodable.decidableEqOfEncodable _
+instance {α : Type _} [Encodable α] : DecidableEq (ULower α) :=
+  by delta ULower; exact Encodable.decidableEqOfEncodable _
 
-instance {α : Type _} [Encodable α] : Encodable (Ulower α) :=
-  by delta Ulower; infer_instance
+instance {α : Type _} [Encodable α] : Encodable (ULower α) :=
+  by delta ULower; infer_instance
 
-end Ulower
+end ULower
 
-namespace Ulower
+namespace ULower
 
 variable (α : Type _) [Encodable α]
 
-/-- The equivalence between the encodable type `α` and `Ulower α : Type`. -/
-def equiv : α ≃ Ulower α :=
+/-- The equivalence between the encodable type `α` and `ULower α : Type`. -/
+def equiv : α ≃ ULower α :=
   Encodable.equivRangeEncode α
-#align ulower.equiv Ulower.equiv
+#align ulower.equiv ULower.equiv
 
 variable {α}
 
-/-- Lowers an `a : α` into `Ulower α`. -/
-def down (a : α) : Ulower α :=
+/-- Lowers an `a : α` into `ULower α`. -/
+def down (a : α) : ULower α :=
   equiv α a
-#align ulower.down Ulower.down
+#align ulower.down ULower.down
 
-instance [Inhabited α] : Inhabited (Ulower α) :=
+instance [Inhabited α] : Inhabited (ULower α) :=
   ⟨down default⟩
 
-/-- Lifts an `a : Ulower α` into `α`. -/
-def up (a : Ulower α) : α :=
+/-- Lifts an `a : ULower α` into `α`. -/
+def up (a : ULower α) : α :=
   (equiv α).symm a
-#align ulower.up Ulower.up
+#align ulower.up ULower.up
 
 @[simp]
-theorem down_up {a : Ulower α} : down a.up = a :=
+theorem down_up {a : ULower α} : down a.up = a :=
   Equiv.right_inv _ _
-#align ulower.down_up Ulower.down_up
+#align ulower.down_up ULower.down_up
 
 @[simp]
 theorem up_down {a : α} : (down a).up = a := by
   simp [up, down,Equiv.left_inv _ _, Equiv.symm_apply_apply]
-#align ulower.up_down Ulower.up_down
+#align ulower.up_down ULower.up_down
 
 @[simp]
-theorem up_eq_up {a b : Ulower α} : a.up = b.up ↔ a = b :=
+theorem up_eq_up {a b : ULower α} : a.up = b.up ↔ a = b :=
   Equiv.apply_eq_iff_eq _
-#align ulower.up_eq_up Ulower.up_eq_up
+#align ulower.up_eq_up ULower.up_eq_up
 
 @[simp]
 theorem down_eq_down {a b : α} : down a = down b ↔ a = b :=
   Equiv.apply_eq_iff_eq _
-#align ulower.down_eq_down Ulower.down_eq_down
+#align ulower.down_eq_down ULower.down_eq_down
 
 @[ext]
-protected theorem ext {a b : Ulower α} : a.up = b.up → a = b :=
+protected theorem ext {a b : ULower α} : a.up = b.up → a = b :=
   up_eq_up.1
-#align ulower.ext Ulower.ext
+#align ulower.ext ULower.ext
 
-end Ulower
+end ULower
 
 /-
 Choice function for encodable types and decidable predicates.
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
@@ -30,8 +30,8 @@ The difference with `Denumerable` is that finite types are encodable. For infini
   partial inverse `decode : ℕ → Option α`.
 * `decode₂`: Version of `decode` that is equal to `none` outside of the range of `encode`. Useful as
   we do not require this in the definition of `decode`.
-* `ulower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
-  subtype of `ℕ`. `ulower α` finds it.
+* `Ulower α`: Any encodable type has an equivalent type living in the lowest universe, namely a
+  subtype of `ℕ`. `Ulower α` finds it.
 
 ## Implementation notes
 
@@ -676,7 +676,7 @@ open Encodable Quotient
 
 variable {α : Type _} {s : Setoid α} [@DecidableRel α (· ≈ ·)] [Encodable α]
 
-/-- Representative of an equivalence class. This is a computable version of `quot.out` for a setoid
+/-- Representative of an equivalence class. This is a computable version of `Quot.out` for a setoid
 on an encodable type. -/
 def Quotient.rep (q : Quotient s) : α :=
   choose (exists_rep q)
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
@@ -206,8 +206,7 @@ theorem decode₂_eq_some [Encodable α] {n : ℕ} {a : α} : decode₂ α n = s
 #align encodable.decode₂_eq_some Encodable.decode₂_eq_some
 
 @[simp]
-theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = some a :=
-  by
+theorem decode₂_encode [Encodable α] (a : α) : decode₂ α (encode a) = some a := by
   ext
   simp [mem_decode₂, eq_comm, decode₂_eq_some]
 #align encodable.decode₂_encode Encodable.decode₂_encode
@@ -327,8 +326,7 @@ theorem decode_one : (decode 1: Option Bool) = some true :=
   rfl
 #align encodable.decode_one Encodable.decode_one
 
-theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none :=
-  by
+theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none := by
   suffices decodeSum n = none by
     change (decodeSum n).bind _ = none
     rw [this]
@@ -646,8 +644,7 @@ protected noncomputable def sequence {r : β → β → Prop} (f : α → β) (h
 #align directed.sequence Directed.sequence
 
 theorem sequence_mono_nat {r : β → β → Prop} {f : α → β} (hf : Directed r f) (n : ℕ) :
-    r (f (hf.sequence f n)) (f (hf.sequence f (n + 1))) :=
-  by
+    r (f (hf.sequence f n)) (f (hf.sequence f (n + 1))) := by
   dsimp [Directed.sequence]
   generalize eq : hf.sequence f n = p
   cases' h : (decode n: Option α) with a
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
@@ -120,9 +120,9 @@ theorem decode_ofEquiv {α β} [Encodable α] (e : β ≃ α) (n : ℕ) :
   by rw [Option.map_eq_bind]
 #align encodable.decode_of_equiv Encodable.decode_ofEquiv
 
-instance Nat.encodable : Encodable ℕ :=
+instance _root_.Nat.encodable : Encodable ℕ :=
   ⟨id, some, fun _ => rfl⟩
-#align nat.encodable Encodable.Nat.encodable
+#align nat.encodable Nat.encodable
 
 @[simp]
 theorem encode_nat (n : ℕ) : encode n = n :=
@@ -134,13 +134,13 @@ theorem decode_nat (n : ℕ) : decode n = some n :=
   rfl
 #align encodable.decode_nat Encodable.decode_nat
 
-instance (priority := 100) IsEmpty.toEncodable [IsEmpty α] : Encodable α :=
+instance (priority := 100) _root_.IsEmpty.toEncodable [IsEmpty α] : Encodable α :=
   ⟨isEmptyElim, fun _ => none, isEmptyElim⟩
-#align is_empty.to_encodable Encodable.IsEmpty.toEncodable
+#align is_empty.to_encodable IsEmpty.toEncodable
 
-instance PUnit.encodable : Encodable PUnit :=
+instance _root_.PUnit.encodable : Encodable PUnit :=
   ⟨fun _ => 0, fun n => Nat.casesOn n (some PUnit.unit) fun _ => none, fun _ => by simp⟩
-#align punit.encodable Encodable.PUnit.encodable
+#align punit.encodable PUnit.encodable
 
 @[simp]
 theorem encode_star : encode PUnit.unit = 0 :=
@@ -257,9 +257,9 @@ def equivRangeEncode (α : Type _) [Encodable α] : α ≃ Set.range (@encode α
 #align encodable.equiv_range_encode Encodable.equivRangeEncode
 
 /-- A type with unique element is encodable. This is not an instance to avoid diamonds. -/
-def Unique.encodable [Unique α] : Encodable α :=
+def _root_.Unique.encodable [Unique α] : Encodable α :=
   ⟨fun _ => 0, fun _ => some default, Unique.forall_iff.2 rfl⟩
-#align unique.encodable Encodable.Unique.encodable
+#align unique.encodable Unique.encodable
 
 section Sum
 
@@ -280,9 +280,9 @@ def decodeSum (n : ℕ) : Option (Sum α β) :=
 #align encodable.decode_sum Encodable.decodeSum
 
 /-- If `α` and `β` are encodable, then so is their sum. -/
-instance Sum.encodable : Encodable (Sum α β) :=
+instance _root_.Sum.encodable : Encodable (Sum α β) :=
   ⟨encodeSum, decodeSum, fun s => by cases s <;> simp [encodeSum, div2_val, decodeSum, encodek]⟩
-#align sum.encodable Encodable.Sum.encodable
+#align sum.encodable Sum.encodable
 
 --Porting note: removing bit0 and bit1 from statement
 @[simp]
@@ -303,9 +303,9 @@ theorem decode_sum_val (n : ℕ) : (decode n : Option (Sum α β)) = decodeSum n
 
 end Sum
 
-instance Bool.encodable : Encodable Bool :=
+instance _root_.Bool.encodable : Encodable Bool :=
   ofEquiv (Sum Unit Unit) Equiv.boolEquivPUnitSumPUnit
-#align bool.encodable Encodable.Bool.encodable
+#align bool.encodable Bool.encodable
 
 @[simp]
 theorem encode_true : encode true = 1 :=
@@ -340,9 +340,9 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none :=
   simp [decodeSum, div2_val]; cases bodd n <;> simp [e]
 #align encodable.decode_ge_two Encodable.decode_ge_two
 
-noncomputable instance Prop.encodable : Encodable Prop :=
+noncomputable instance _root_.Prop.encodable : Encodable Prop :=
   ofEquiv Bool Equiv.propEquivBool
-#align Prop.encodable Encodable.Prop.encodable
+#align Prop.encodable Prop.encodable
 
 section Sigma
 
@@ -359,10 +359,10 @@ def decodeSigma (n : ℕ) : Option (Sigma γ) :=
   (decode n₁).bind fun a => (decode n₂).map <| Sigma.mk a
 #align encodable.decode_sigma Encodable.decodeSigma
 
-instance Sigma.encodable : Encodable (Sigma γ) :=
+instance _root_.Sigma.encodable : Encodable (Sigma γ) :=
   ⟨encodeSigma, decodeSigma, fun ⟨a, b⟩ => by
     simp [encodeSigma, decodeSigma, unpair_pair, encodek]⟩
-#align sigma.encodable Encodable.Sigma.encodable
+#align sigma.encodable Sigma.encodable
 
 @[simp]
 theorem decode_sigma_val (n : ℕ) :
@@ -423,36 +423,36 @@ def decodeSubtype (v : ℕ) : Option { a : α // P a } :=
 #align encodable.decode_subtype Encodable.decodeSubtype
 
 /-- A decidable subtype of an encodable type is encodable. -/
-instance Subtype.encodable : Encodable { a : α // P a } :=
+instance _root_.Subtype.encodable : Encodable { a : α // P a } :=
   ⟨encodeSubtype, decodeSubtype, fun ⟨v, h⟩ => by simp [encodeSubtype, decodeSubtype, encodek, h]⟩
-#align subtype.encodable Encodable.Subtype.encodable
+#align subtype.encodable Subtype.encodable
 
 theorem Subtype.encode_eq (a : Subtype P) : encode a = encode a.val := by cases a ; rfl
 #align encodable.subtype.encode_eq Encodable.Subtype.encode_eq
 
 end Subtype
 
-instance Fin.encodable (n) : Encodable (Fin n) :=
+instance _root_.Fin.encodable (n) : Encodable (Fin n) :=
   ofEquiv _ Fin.equivSubtype
-#align fin.encodable Encodable.Fin.encodable
+#align fin.encodable Fin.encodable
 
-instance Int.encodable : Encodable ℤ :=
+instance _root_.Int.encodable : Encodable ℤ :=
   ofEquiv _ Equiv.intEquivNat
-#align int.encodable Encodable.Int.encodable
+#align int.encodable Int.encodable
 
-instance PNat.encodable : Encodable ℕ+ :=
+instance _root_.PNat.encodable : Encodable ℕ+ :=
   ofEquiv _ Equiv.pnatEquivNat
-#align pnat.encodable Encodable.PNat.encodable
+#align pnat.encodable PNat.encodable
 
-/-- The lift of an encodable type is encodable. -/
-instance ULift.encodable [Encodable α] : Encodable (ULift α) :=
+/-- The lift of an encodable type is encodable -/
+instance _root_.ULift.encodable [Encodable α] : Encodable (ULift α) :=
   ofEquiv _ Equiv.ulift
-#align ulift.encodable Encodable.ULift.encodable
+#align ulift.encodable ULift.encodable
 
 /-- The lift of an encodable type is encodable. -/
-instance PLift.encodable [Encodable α] : Encodable (PLift α) :=
+instance _root_.PLift.encodable [Encodable α] : Encodable (PLift α) :=
   ofEquiv _ Equiv.plift
-#align plift.encodable Encodable.PLift.encodable
+#align plift.encodable PLift.encodable
 
 /-- If `β` is encodable and there is an injection `f : α → β`, then `α` is encodable as well. -/
 noncomputable def ofInj [Encodable β] (f : α → β) (hf : Injective f) : Encodable α :=
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
@@ -350,7 +350,7 @@ variable {γ : α → Type _} [Encodable α] [∀ a, Encodable (γ a)]
 
 /-- Explicit encoding function for `Sigma γ` -/
 def encodeSigma : Sigma γ → ℕ
-  | ⟨a, b⟩ => mkpair (encode a) (encode b)
+  | ⟨a, b⟩ => pair (encode a) (encode b)
 #align encodable.encode_sigma Encodable.encodeSigma
 
 /-- Explicit decoding function for `Sigma γ` -/
@@ -361,7 +361,7 @@ def decodeSigma (n : ℕ) : Option (Sigma γ) :=
 
 instance Sigma.encodable : Encodable (Sigma γ) :=
   ⟨encodeSigma, decodeSigma, fun ⟨a, b⟩ => by
-    simp [encodeSigma, decodeSigma, unpair_mkpair, encodek]⟩
+    simp [encodeSigma, decodeSigma, unpair_pair, encodek]⟩
 #align sigma.encodable Encodable.Sigma.encodable
 
 @[simp]
@@ -372,7 +372,7 @@ theorem decode_sigma_val (n : ℕ) :
 #align encodable.decode_sigma_val Encodable.decode_sigma_val
 
 @[simp]
-theorem encode_sigma_val (a b) : @encode (Sigma γ) _ ⟨a, b⟩ = mkpair (encode a) (encode b) :=
+theorem encode_sigma_val (a b) : @encode (Sigma γ) _ ⟨a, b⟩ = pair (encode a) (encode b) :=
   rfl
 #align encodable.encode_sigma_val Encodable.encode_sigma_val
 
@@ -396,7 +396,7 @@ theorem decode_prod_val [i : Encodable α] (n : ℕ) :
 #align encodable.decode_prod_val Encodable.decode_prod_val
 
 @[simp]
-theorem encode_prod_val (a b) : @encode (α × β) _ (a, b) = mkpair (encode a) (encode b) :=
+theorem encode_prod_val (a b) : @encode (α × β) _ (a, b) = pair (encode a) (encode b) :=
   rfl
 #align encodable.encode_prod_val Encodable.encode_prod_val
 
Refactor uses to rename_i that have easy fixes (#2429)
Diff
@@ -567,10 +567,9 @@ private def good : Option α → Prop
   | some a => p a
   | none => False
 
--- TODO: remove `rename_i`
-private def decidable_good : DecidablePred (good p)
-  | n => by cases' n with a a <;>
-         unfold good <;> rename_i x <;> cases x <;> dsimp <;> infer_instance
+private def decidable_good : DecidablePred (good p) :=
+  fun n => by
+    cases n <;> unfold good <;> dsimp <;> infer_instance
 attribute [local instance] decidable_good
 
 open Encodable
chore: Rename Type* to Type _ (#1866)

A bunch of docstrings were still mentioning Type*. This changes them to Type _.

Diff
@@ -553,8 +553,8 @@ end Ulower
 Choice function for encodable types and decidable predicates.
 We provide the following API
 
-choose      {α : Type*} {p : α → Prop} [c : encodable α] [d : decidable_pred p] : (∃ x, p x) → α :=
-choose_spec {α : Type*} {p : α → Prop} [c : encodable α] [d : decidable_pred p] (ex : ∃ x, p x) :
+choose      {α : Type _} {p : α → Prop} [c : encodable α] [d : decidable_pred p] : (∃ x, p x) → α :=
+choose_spec {α : Type _} {p : α → Prop} [c : encodable α] [d : decidable_pred p] (ex : ∃ x, p x) :
   p (choose ex) :=
 -/
 namespace Encodable
chore: fix some phantom align statements (#1782)
Diff
@@ -340,9 +340,9 @@ theorem decode_ge_two (n) (h : 2 ≤ n) : (decode n : Option Bool) = none :=
   simp [decodeSum, div2_val]; cases bodd n <;> simp [e]
 #align encodable.decode_ge_two Encodable.decode_ge_two
 
-noncomputable instance PropCat.encodable : Encodable Prop :=
+noncomputable instance Prop.encodable : Encodable Prop :=
   ofEquiv Bool Equiv.propEquivBool
-#align Prop.encodable Encodable.PropCat.encodable
+#align Prop.encodable Encodable.Prop.encodable
 
 section Sigma
 
feat: port Logic.Denumerable (#1682)

Co-authored-by: Johan Commelin <johan@commelin.net>

Diff
@@ -129,7 +129,7 @@ theorem encode_nat (n : ℕ) : encode n = n :=
   rfl
 #align encodable.encode_nat Encodable.encode_nat
 
-@[simp]
+@[simp 1100]
 theorem decode_nat (n : ℕ) : decode n = some n :=
   rfl
 #align encodable.decode_nat Encodable.decode_nat
feat: port Logic.Encodable.Basic (#1517)

Port of logic.encodable.basic

Dependencies 2 + 144

145 files ported (98.6%)
61998 lines ported (99.8%)
Show graph

The unported dependencies are