data.finite.basic
⟷
Mathlib.Data.Finite.Basic
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.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -155,13 +155,13 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
· infer_instance
· refine' h.elim fun f => _
haveI : Finite α := Finite.of_injective _ f.injective
- exact Finite.of_injective _ FunLike.coe_injective
+ exact Finite.of_injective _ DFunLike.coe_injective
#align function.embedding.finite Function.Embedding.finite
-/
#print Equiv.finite_right /-
instance Equiv.finite_right {α β : Sort _} [Finite β] : Finite (α ≃ β) :=
- Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by convert FunLike.congr_fun h
+ Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by convert DFunLike.congr_fun h
#align equiv.finite_right Equiv.finite_right
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,11 +3,11 @@ Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-/
-import Mathbin.Data.Fintype.Powerset
-import Mathbin.Data.Fintype.Prod
-import Mathbin.Data.Fintype.Sigma
-import Mathbin.Data.Fintype.Sum
-import Mathbin.Data.Fintype.Vector
+import Data.Fintype.Powerset
+import Data.Fintype.Prod
+import Data.Fintype.Sigma
+import Data.Fintype.Sum
+import Data.Fintype.Vector
#align_import data.finite.basic from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,11 +2,6 @@
Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-
-! This file was ported from Lean 3 source module data.finite.basic
-! leanprover-community/mathlib commit 327c3c0d9232d80e250dc8f65e7835b82b266ea5
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Fintype.Powerset
import Mathbin.Data.Fintype.Prod
@@ -14,6 +9,8 @@ import Mathbin.Data.Fintype.Sigma
import Mathbin.Data.Fintype.Sum
import Mathbin.Data.Fintype.Vector
+#align_import data.finite.basic from "leanprover-community/mathlib"@"327c3c0d9232d80e250dc8f65e7835b82b266ea5"
+
/-!
# Finite types
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -151,6 +151,7 @@ instance Quotient.finite {α : Sort _} [Finite α] (s : Setoid α) : Finite (Quo
#align quotient.finite Quotient.finite
-/
+#print Function.Embedding.finite /-
instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪ β) :=
by
cases' isEmpty_or_nonempty (α ↪ β) with _ h
@@ -159,14 +160,19 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
haveI : Finite α := Finite.of_injective _ f.injective
exact Finite.of_injective _ FunLike.coe_injective
#align function.embedding.finite Function.Embedding.finite
+-/
+#print Equiv.finite_right /-
instance Equiv.finite_right {α β : Sort _} [Finite β] : Finite (α ≃ β) :=
Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by convert FunLike.congr_fun h
#align equiv.finite_right Equiv.finite_right
+-/
+#print Equiv.finite_left /-
instance Equiv.finite_left {α β : Sort _} [Finite α] : Finite (α ≃ β) :=
Finite.of_equiv _ ⟨Equiv.symm, Equiv.symm, Equiv.symm_symm, Equiv.symm_symm⟩
#align equiv.finite_left Equiv.finite_left
+-/
instance [Finite α] {n : ℕ} : Finite (Sym α n) := by haveI := Fintype.ofFinite α; infer_instance
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -105,10 +105,10 @@ theorem sum_right (α) [Finite (Sum α β)] : Finite β :=
#align finite.sum_right Finite.sum_right
-/
-instance {β : α → Type _} [Finite α] [∀ a, Finite (β a)] : Finite (Σa, β a) := by
+instance {β : α → Type _} [Finite α] [∀ a, Finite (β a)] : Finite (Σ a, β a) := by
letI := Fintype.ofFinite α; letI := fun a => Fintype.ofFinite (β a); infer_instance
-instance {ι : Sort _} {π : ι → Sort _} [Finite ι] [∀ i, Finite (π i)] : Finite (Σ'i, π i) :=
+instance {ι : Sort _} {π : ι → Sort _} [Finite ι] [∀ i, Finite (π i)] : Finite (Σ' i, π i) :=
of_equiv _ (Equiv.psigmaEquivSigmaPLift π).symm
instance [Finite α] : Finite (Set α) := by cases nonempty_fintype α; infer_instance
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -51,7 +51,7 @@ finiteness, finite types
noncomputable section
-open Classical
+open scoped Classical
variable {α β γ : Type _}
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -151,12 +151,6 @@ instance Quotient.finite {α : Sort _} [Finite α] (s : Setoid α) : Finite (Quo
#align quotient.finite Quotient.finite
-/
-/- warning: function.embedding.finite -> Function.Embedding.finite is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u2} β], Finite.{max 1 (imax u1 u2)} (Function.Embedding.{u1, u2} α β)
-but is expected to have type
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u2} β], Finite.{max (max 1 u2) u1} (Function.Embedding.{u1, u2} α β)
-Case conversion may be inaccurate. Consider using '#align function.embedding.finite Function.Embedding.finiteₓ'. -/
instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪ β) :=
by
cases' isEmpty_or_nonempty (α ↪ β) with _ h
@@ -166,22 +160,10 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
exact Finite.of_injective _ FunLike.coe_injective
#align function.embedding.finite Function.Embedding.finite
-/- warning: equiv.finite_right -> Equiv.finite_right is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u2} β], Finite.{max 1 (imax u1 u2) (imax u2 u1)} (Equiv.{u1, u2} α β)
-but is expected to have type
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u2} β], Finite.{max (max 1 u2) u1} (Equiv.{u1, u2} α β)
-Case conversion may be inaccurate. Consider using '#align equiv.finite_right Equiv.finite_rightₓ'. -/
instance Equiv.finite_right {α β : Sort _} [Finite β] : Finite (α ≃ β) :=
Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by convert FunLike.congr_fun h
#align equiv.finite_right Equiv.finite_right
-/- warning: equiv.finite_left -> Equiv.finite_left is a dubious translation:
-lean 3 declaration is
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u1} α], Finite.{max 1 (imax u1 u2) (imax u2 u1)} (Equiv.{u1, u2} α β)
-but is expected to have type
- forall {α : Sort.{u1}} {β : Sort.{u2}} [_inst_1 : Finite.{u1} α], Finite.{max (max 1 u2) u1} (Equiv.{u1, u2} α β)
-Case conversion may be inaccurate. Consider using '#align equiv.finite_left Equiv.finite_leftₓ'. -/
instance Equiv.finite_left {α β : Sort _} [Finite α] : Finite (α ≃ β) :=
Finite.of_equiv _ ⟨Equiv.symm, Equiv.symm, Equiv.symm_symm, Equiv.symm_symm⟩
#align equiv.finite_left Equiv.finite_left
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -72,11 +72,8 @@ instance prop (p : Prop) : Finite p :=
#align finite.prop Finite.prop
-/
-instance [Finite α] [Finite β] : Finite (α × β) :=
- by
- haveI := Fintype.ofFinite α
- haveI := Fintype.ofFinite β
- infer_instance
+instance [Finite α] [Finite β] : Finite (α × β) := by haveI := Fintype.ofFinite α;
+ haveI := Fintype.ofFinite β; infer_instance
instance {α β : Sort _} [Finite α] [Finite β] : Finite (PProd α β) :=
of_equiv _ Equiv.pprodEquivProdPLift.symm
@@ -93,11 +90,8 @@ theorem prod_right (α) [Finite (α × β)] [Nonempty α] : Finite β :=
#align finite.prod_right Finite.prod_right
-/
-instance [Finite α] [Finite β] : Finite (Sum α β) :=
- by
- haveI := Fintype.ofFinite α
- haveI := Fintype.ofFinite β
- infer_instance
+instance [Finite α] [Finite β] : Finite (Sum α β) := by haveI := Fintype.ofFinite α;
+ haveI := Fintype.ofFinite β; infer_instance
#print Finite.sum_left /-
theorem sum_left (β) [Finite (Sum α β)] : Finite α :=
@@ -111,19 +105,13 @@ theorem sum_right (α) [Finite (Sum α β)] : Finite β :=
#align finite.sum_right Finite.sum_right
-/
-instance {β : α → Type _} [Finite α] [∀ a, Finite (β a)] : Finite (Σa, β a) :=
- by
- letI := Fintype.ofFinite α
- letI := fun a => Fintype.ofFinite (β a)
- infer_instance
+instance {β : α → Type _} [Finite α] [∀ a, Finite (β a)] : Finite (Σa, β a) := by
+ letI := Fintype.ofFinite α; letI := fun a => Fintype.ofFinite (β a); infer_instance
instance {ι : Sort _} {π : ι → Sort _} [Finite ι] [∀ i, Finite (π i)] : Finite (Σ'i, π i) :=
of_equiv _ (Equiv.psigmaEquivSigmaPLift π).symm
-instance [Finite α] : Finite (Set α) :=
- by
- cases nonempty_fintype α
- infer_instance
+instance [Finite α] : Finite (Set α) := by cases nonempty_fintype α; infer_instance
end Finite
@@ -146,10 +134,8 @@ instance Pi.finite {α : Sort _} {β : α → Sort _} [Finite α] [∀ a, Finite
-/
#print Vector.finite /-
-instance Vector.finite {α : Type _} [Finite α] {n : ℕ} : Finite (Vector α n) :=
- by
- haveI := Fintype.ofFinite α
- infer_instance
+instance Vector.finite {α : Type _} [Finite α] {n : ℕ} : Finite (Vector α n) := by
+ haveI := Fintype.ofFinite α; infer_instance
#align vector.finite Vector.finite
-/
@@ -200,8 +186,5 @@ instance Equiv.finite_left {α β : Sort _} [Finite α] : Finite (α ≃ β) :=
Finite.of_equiv _ ⟨Equiv.symm, Equiv.symm, Equiv.symm_symm, Equiv.symm_symm⟩
#align equiv.finite_left Equiv.finite_left
-instance [Finite α] {n : ℕ} : Finite (Sym α n) :=
- by
- haveI := Fintype.ofFinite α
- infer_instance
+instance [Finite α] {n : ℕ} : Finite (Sym α n) := by haveI := Fintype.ofFinite α; infer_instance
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -57,7 +57,7 @@ instance (priority := 100) of_subsingleton {α : Sort*} [Subsingleton α] : Fini
#align finite.of_subsingleton Finite.of_subsingleton
-- Higher priority for `Prop`s
--- @[nolint instance_priority] -- Porting note: linter not found
+-- Porting note(#12096): removed @[nolint instance_priority], linter not ported yet
instance prop (p : Prop) : Finite p :=
Finite.of_subsingleton
#align finite.prop Finite.prop
open Classical
(#11199)
We remove all but one open Classical
s, instead preferring to use open scoped Classical
. The only real side-effect this led to is moving a couple declarations to use Exists.choose
instead of Classical.choose
.
The first few commits are explicitly labelled regex replaces for ease of review.
@@ -33,7 +33,7 @@ instances or other `Fintype` instances, then we need to "lower" the instance
to be a `Finite` instance by removing the `Decidable` instances and switching
the `Fintype` instances to `Finite` instances. These are precisely the ones
that cannot be inferred using `Finite.of_fintype`. (However, when using
-`open Classical` or the `classical` tactic the instances relying only
+`open scoped Classical` or the `classical` tactic the instances relying only
on `Decidable` instances will give `Finite` instances.) In the future we might
consider writing automation to create these "lowered" instances.
@@ -45,7 +45,7 @@ finiteness, finite types
noncomputable section
-open Classical
+open scoped Classical
variable {α β γ : Type*}
@@ -105,11 +105,6 @@ instance [Finite α] : Finite (Set α) := by
end Finite
-/-- This instance also provides `[Finite s]` for `s : Set α`. -/
-instance Subtype.finite {α : Sort*} [Finite α] {p : α → Prop} : Finite { x // p x } :=
- Finite.of_injective (↑) Subtype.coe_injective
-#align subtype.finite Subtype.finite
-
instance Pi.finite {α : Sort*} {β : α → Sort*} [Finite α] [∀ a, Finite (β a)] :
Finite (∀ a, β a) := by
haveI := Fintype.ofFinite (PLift α)
FunLike
to DFunLike
(#9785)
This prepares for the introduction of a non-dependent synonym of FunLike, which helps a lot with keeping #8386 readable.
This is entirely search-and-replace in 680197f combined with manual fixes in 4145626, e900597 and b8428f8. The commands that generated this change:
sed -i 's/\bFunLike\b/DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoFunLike\b/toDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/import Mathlib.Data.DFunLike/import Mathlib.Data.FunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bHom_FunLike\b/Hom_DFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\binstFunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\bfunLike\b/instDFunLike/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
sed -i 's/\btoo many metavariables to apply `fun_like.has_coe_to_fun`/too many metavariables to apply `DFunLike.hasCoeToFun`/g' {Archive,Counterexamples,Mathlib,test}/**/*.lean
Co-authored-by: Anne Baanen <Vierkantor@users.noreply.github.com>
@@ -140,12 +140,12 @@ instance Function.Embedding.finite {α β : Sort*} [Finite β] : Finite (α ↪
· refine' h.elim fun f => _
haveI : Finite α := Finite.of_injective _ f.injective
- exact Finite.of_injective _ FunLike.coe_injective
+ exact Finite.of_injective _ DFunLike.coe_injective
#align function.embedding.finite Function.Embedding.finite
instance Equiv.finite_right {α β : Sort*} [Finite β] : Finite (α ≃ β) :=
Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by
- convert FunLike.congr_fun h using 0
+ convert DFunLike.congr_fun h using 0
#align equiv.finite_right Equiv.finite_right
instance Equiv.finite_left {α β : Sort*} [Finite α] : Finite (α ≃ β) :=
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -47,12 +47,12 @@ noncomputable section
open Classical
-variable {α β γ : Type _}
+variable {α β γ : Type*}
namespace Finite
-- see Note [lower instance priority]
-instance (priority := 100) of_subsingleton {α : Sort _} [Subsingleton α] : Finite α :=
+instance (priority := 100) of_subsingleton {α : Sort*} [Subsingleton α] : Finite α :=
of_injective (Function.const α ()) <| Function.injective_of_subsingleton _
#align finite.of_subsingleton Finite.of_subsingleton
@@ -67,7 +67,7 @@ instance [Finite α] [Finite β] : Finite (α × β) := by
haveI := Fintype.ofFinite β
infer_instance
-instance {α β : Sort _} [Finite α] [Finite β] : Finite (PProd α β) :=
+instance {α β : Sort*} [Finite α] [Finite β] : Finite (PProd α β) :=
of_equiv _ Equiv.pprodEquivProdPLift.symm
theorem prod_left (β) [Finite (α × β)] [Nonempty β] : Finite α :=
@@ -91,12 +91,12 @@ theorem sum_right (α) [Finite (Sum α β)] : Finite β :=
of_injective (Sum.inr : β → Sum α β) Sum.inr_injective
#align finite.sum_right Finite.sum_right
-instance {β : α → Type _} [Finite α] [∀ a, Finite (β a)] : Finite (Σa, β a) := by
+instance {β : α → Type*} [Finite α] [∀ a, Finite (β a)] : Finite (Σa, β a) := by
letI := Fintype.ofFinite α
letI := fun a => Fintype.ofFinite (β a)
infer_instance
-instance {ι : Sort _} {π : ι → Sort _} [Finite ι] [∀ i, Finite (π i)] : Finite (Σ'i, π i) :=
+instance {ι : Sort*} {π : ι → Sort*} [Finite ι] [∀ i, Finite (π i)] : Finite (Σ'i, π i) :=
of_equiv _ (Equiv.psigmaEquivSigmaPLift π).symm
instance [Finite α] : Finite (Set α) := by
@@ -106,11 +106,11 @@ instance [Finite α] : Finite (Set α) := by
end Finite
/-- This instance also provides `[Finite s]` for `s : Set α`. -/
-instance Subtype.finite {α : Sort _} [Finite α] {p : α → Prop} : Finite { x // p x } :=
+instance Subtype.finite {α : Sort*} [Finite α] {p : α → Prop} : Finite { x // p x } :=
Finite.of_injective (↑) Subtype.coe_injective
#align subtype.finite Subtype.finite
-instance Pi.finite {α : Sort _} {β : α → Sort _} [Finite α] [∀ a, Finite (β a)] :
+instance Pi.finite {α : Sort*} {β : α → Sort*} [Finite α] [∀ a, Finite (β a)] :
Finite (∀ a, β a) := by
haveI := Fintype.ofFinite (PLift α)
haveI := fun a => Fintype.ofFinite (PLift (β a))
@@ -119,20 +119,20 @@ instance Pi.finite {α : Sort _} {β : α → Sort _} [Finite α] [∀ a, Finite
(Equiv.piCongr Equiv.plift fun _ => Equiv.plift)
#align pi.finite Pi.finite
-instance Vector.finite {α : Type _} [Finite α] {n : ℕ} : Finite (Vector α n) := by
+instance Vector.finite {α : Type*} [Finite α] {n : ℕ} : Finite (Vector α n) := by
haveI := Fintype.ofFinite α
infer_instance
#align vector.finite Vector.finite
-instance Quot.finite {α : Sort _} [Finite α] (r : α → α → Prop) : Finite (Quot r) :=
+instance Quot.finite {α : Sort*} [Finite α] (r : α → α → Prop) : Finite (Quot r) :=
Finite.of_surjective _ (surjective_quot_mk r)
#align quot.finite Quot.finite
-instance Quotient.finite {α : Sort _} [Finite α] (s : Setoid α) : Finite (Quotient s) :=
+instance Quotient.finite {α : Sort*} [Finite α] (s : Setoid α) : Finite (Quotient s) :=
Quot.finite _
#align quotient.finite Quotient.finite
-instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪ β) := by
+instance Function.Embedding.finite {α β : Sort*} [Finite β] : Finite (α ↪ β) := by
cases' isEmpty_or_nonempty (α ↪ β) with _ h
· -- Porting note: infer_instance fails because it applies `Finite.of_fintype` and produces a
-- "stuck at solving universe constraint" error.
@@ -143,12 +143,12 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
exact Finite.of_injective _ FunLike.coe_injective
#align function.embedding.finite Function.Embedding.finite
-instance Equiv.finite_right {α β : Sort _} [Finite β] : Finite (α ≃ β) :=
+instance Equiv.finite_right {α β : Sort*} [Finite β] : Finite (α ≃ β) :=
Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by
convert FunLike.congr_fun h using 0
#align equiv.finite_right Equiv.finite_right
-instance Equiv.finite_left {α β : Sort _} [Finite α] : Finite (α ≃ β) :=
+instance Equiv.finite_left {α β : Sort*} [Finite α] : Finite (α ≃ β) :=
Finite.of_equiv _ ⟨Equiv.symm, Equiv.symm, Equiv.symm_symm, Equiv.symm_symm⟩
#align equiv.finite_left Equiv.finite_left
@@ -2,11 +2,6 @@
Copyright (c) 2022 Kyle Miller. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Kyle Miller
-
-! This file was ported from Lean 3 source module data.finite.basic
-! leanprover-community/mathlib commit 1126441d6bccf98c81214a0780c73d499f6721fe
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Fintype.Powerset
import Mathlib.Data.Fintype.Prod
@@ -14,6 +9,8 @@ import Mathlib.Data.Fintype.Sigma
import Mathlib.Data.Fintype.Sum
import Mathlib.Data.Fintype.Vector
+#align_import data.finite.basic from "leanprover-community/mathlib"@"1126441d6bccf98c81214a0780c73d499f6721fe"
+
/-!
# Finite types
fix-comments.py
on all files.@@ -33,7 +33,7 @@ defined.
There is an apparent duplication of many `Fintype` instances in this module,
however they follow a pattern: if a `Fintype` instance depends on `Decidable`
instances or other `Fintype` instances, then we need to "lower" the instance
-to be a `Finite` instance by removing the `decidable` instances and switching
+to be a `Finite` instance by removing the `Decidable` instances and switching
the `Fintype` instances to `Finite` instances. These are precisely the ones
that cannot be inferred using `Finite.of_fintype`. (However, when using
`open Classical` or the `classical` tactic the instances relying only
congr!
and convert
(#2606)
congr!
, convert
, and convert_to
to control parts of the congruence algorithm, in particular transparency settings when applying congruence lemmas.congr!
now applies congruence lemmas with reducible transparency by default. This prevents it from unfolding definitions when applying congruence lemmas. It also now tries both the LHS-biased and RHS-biased simp congruence lemmas, with a configuration option to set which it should try first.HEq
congruence lemma generator that gives each hypothesis access to the proofs of previous hypotheses. This means that if you have an equality ⊢ ⟨a, x⟩ = ⟨b, y⟩
of sigma types, congr!
turns this into goals ⊢ a = b
and ⊢ a = b → HEq x y
(note that congr!
will also auto-introduce a = b
for you in the second goal). This congruence lemma generator applies to more cases than the simp congruence lemma generator does.congr!
(and hence convert
) are more careful about applying lemmas that don't force definitions to unfold. There were a number of cases in mathlib where the implementation of congr
was being abused to unfold definitions.set_option trace.congr! true
you can see what congr!
sees when it is deciding on congruence lemmas.convert_to
to do using 1
when there is no using
clause, to match its documentation.Note that congr!
is more capable than congr
at finding a way to equate left-hand sides and right-hand sides, so you will frequently need to limit its depth with a using
clause. However, there is also a new heuristic to prevent considering unlikely-to-be-provable type equalities (controlled by the typeEqs
option), which can help limit the depth automatically.
There is also a predefined configuration that you can invoke with, for example, convert (config := .unfoldSameFun) h
, that causes it to behave more like congr
, including using default transparency when unfolding.
@@ -147,7 +147,8 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
#align function.embedding.finite Function.Embedding.finite
instance Equiv.finite_right {α β : Sort _} [Finite β] : Finite (α ≃ β) :=
- Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by convert FunLike.congr_fun h
+ Finite.of_injective Equiv.toEmbedding fun e₁ e₂ h => Equiv.ext <| by
+ convert FunLike.congr_fun h using 0
#align equiv.finite_right Equiv.finite_right
instance Equiv.finite_left {α β : Sort _} [Finite α] : Finite (α ≃ β) :=
congr!
and improvement to convert
(#2566)
This introduces a tactic congr!
that is an analogue to mathlib 3's congr'
. It is a more insistent version of congr
that makes use of more congruence lemmas (including user congruence lemmas), propext
, funext
, and Subsingleton
instances. It also has a feature to lift reflexive relations to equalities. Along with funext
, the tactic does intros
, allowing congr!
to get access to function bodies; the introduced variables can be named using rename_i
if needed.
This also modifies convert
to use congr!
rather than congr
, which makes it work more like the mathlib3 version of the tactic.
@@ -140,7 +140,7 @@ instance Function.Embedding.finite {α β : Sort _} [Finite β] : Finite (α ↪
· -- Porting note: infer_instance fails because it applies `Finite.of_fintype` and produces a
-- "stuck at solving universe constraint" error.
apply Finite.of_subsingleton
-
+
· refine' h.elim fun f => _
haveI : Finite α := Finite.of_injective _ f.injective
exact Finite.of_injective _ FunLike.coe_injective
The unported dependencies are