data.fin_enum
⟷
Mathlib.Data.FinEnum
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)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -181,7 +181,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
· exact Or.inr (h _ hx)
intro h; exists s \ ({xs_hd} : Finset α)
simp only [and_imp, mem_sdiff, mem_singleton]
- simp only [Classical.or_iff_not_imp_left] at h
+ simp only [Classical.or_iff_not_imp_left] at h
exists h
by_cases xs_hd ∈ s
· have : {xs_hd} ⊆ s; simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -24,7 +24,7 @@ universe u v
open Finset
#print FinEnum /-
-/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:400:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -24,7 +24,7 @@ universe u v
open Finset
#print FinEnum /-
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:404:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -181,7 +181,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
· exact Or.inr (h _ hx)
intro h; exists s \ ({xs_hd} : Finset α)
simp only [and_imp, mem_sdiff, mem_singleton]
- simp only [or_iff_not_imp_left] at h
+ simp only [Classical.or_iff_not_imp_left] at h
exists h
by_cases xs_hd ∈ s
· have : {xs_hd} ⊆ s; simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,9 +3,9 @@ Copyright (c) 2019 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-/
-import Mathbin.Control.Monad.Basic
-import Mathbin.Data.Fintype.Basic
-import Mathbin.Data.List.ProdSigma
+import Control.Monad.Basic
+import Data.Fintype.Basic
+import Data.List.ProdSigma
#align_import data.fin_enum from "leanprover-community/mathlib"@"cc70d9141824ea8982d1562ce009952f2c3ece30"
@@ -24,7 +24,7 @@ universe u v
open Finset
#print FinEnum /-
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,16 +2,13 @@
Copyright (c) 2019 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.fin_enum
-! leanprover-community/mathlib commit cc70d9141824ea8982d1562ce009952f2c3ece30
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Control.Monad.Basic
import Mathbin.Data.Fintype.Basic
import Mathbin.Data.List.ProdSigma
+#align_import data.fin_enum from "leanprover-community/mathlib"@"cc70d9141824ea8982d1562ce009952f2c3ece30"
+
/-!
> THIS FILE IS SYNCHRONIZED WITH MATHLIB4.
> Any changes to this file require a corresponding PR to mathlib4.
mathlib commit https://github.com/leanprover-community/mathlib/commit/2a0ce625dbb0ffbc7d1316597de0b25c1ec75303
@@ -279,12 +279,12 @@ theorem mem_pi {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β a)] (
(f : ∀ a, a ∈ xs → β a) : f ∈ pi xs fun x => toList (β x) :=
by
induction xs <;> simp [pi, -List.map_eq_map, monad_norm, functor_norm]
- · ext (a⟨⟩)
+ · ext a ⟨⟩
· exists pi.cons xs_hd xs_tl (f _ (List.mem_cons_self _ _))
constructor; exact ⟨_, rfl⟩
exists pi.tail f; constructor
· apply xs_ih
- · ext (x h); simp [pi.cons]; split_ifs; subst x; rfl; rfl
+ · ext x h; simp [pi.cons]; split_ifs; subst x; rfl; rfl
#align fin_enum.mem_pi FinEnum.mem_pi
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -26,7 +26,8 @@ universe u v
open Finset
-/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+#print FinEnum /-
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
@@ -34,6 +35,7 @@ class FinEnum (α : Sort _) where
Equiv : α ≃ Fin card
[decEq : DecidableEq α]
#align fin_enum FinEnum
+-/
attribute [instance 100] FinEnum.decEq
@@ -272,6 +274,7 @@ def pi {β : α → Type max u v} [DecidableEq α] :
#align fin_enum.pi FinEnum.pi
-/
+#print FinEnum.mem_pi /-
theorem mem_pi {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β a)] (xs : List α)
(f : ∀ a, a ∈ xs → β a) : f ∈ pi xs fun x => toList (β x) :=
by
@@ -283,6 +286,7 @@ theorem mem_pi {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β a)] (
· apply xs_ih
· ext (x h); simp [pi.cons]; split_ifs; subst x; rfl; rfl
#align fin_enum.mem_pi FinEnum.mem_pi
+-/
#print FinEnum.pi.enum /-
/-- enumerate all functions whose domain and range are finitely enumerable -/
@@ -303,12 +307,14 @@ instance pi.finEnum {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β
#align fin_enum.pi.fin_enum FinEnum.pi.finEnum
-/
+#print FinEnum.pfunFinEnum /-
instance pfunFinEnum (p : Prop) [Decidable p] (α : p → Type _) [∀ hp, FinEnum (α hp)] :
FinEnum (∀ hp : p, α hp) :=
if hp : p then
ofList ((toList (α hp)).map fun x hp' => x) (by intro <;> simp <;> exact ⟨x hp, rfl⟩)
else ofList [fun hp' => (hp hp').elim] (by intro <;> simp <;> ext hp' <;> cases hp hp')
#align fin_enum.pfun_fin_enum FinEnum.pfunFinEnum
+-/
end FinEnum
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -26,7 +26,7 @@ universe u v
open Finset
-/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:394:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -89,7 +89,7 @@ theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by
#print FinEnum.nodup_toList /-
@[simp]
theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by
- simp [to_list] <;> apply List.Nodup.map <;> [apply Equiv.injective;apply List.nodup_finRange]
+ simp [to_list] <;> apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange]
#align fin_enum.nodup_to_list FinEnum.nodup_toList
-/
@@ -177,12 +177,12 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
· constructor; rintro ⟨a, h, h'⟩ x hx
cases h'
· right; apply h; subst a; exact hx
- · simp only [h', mem_union, mem_singleton] at hx⊢; cases hx
+ · simp only [h', mem_union, mem_singleton] at hx ⊢; cases hx
· exact Or.inl hx
· exact Or.inr (h _ hx)
intro h; exists s \ ({xs_hd} : Finset α)
simp only [and_imp, mem_sdiff, mem_singleton]
- simp only [or_iff_not_imp_left] at h
+ simp only [or_iff_not_imp_left] at h
exists h
by_cases xs_hd ∈ s
· have : {xs_hd} ⊆ s; simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
@@ -212,14 +212,14 @@ instance (β : α → Type v) [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Si
(by intro x <;> cases x <;> simp)
#print FinEnum.PSigma.finEnum /-
-instance PSigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ'a, β a) :=
+instance PSigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ' a, β a) :=
FinEnum.ofEquiv _ (Equiv.psigmaEquivSigma _)
#align fin_enum.psigma.fin_enum FinEnum.PSigma.finEnum
-/
#print FinEnum.PSigma.finEnumPropLeft /-
instance PSigma.finEnumPropLeft {α : Prop} {β : α → Type v} [∀ a, FinEnum (β a)] [Decidable α] :
- FinEnum (Σ'a, β a) :=
+ FinEnum (Σ' a, β a) :=
if h : α then ofList ((toList (β h)).map <| PSigma.mk h) fun ⟨a, Ba⟩ => by simp
else ofList [] fun ⟨a, Ba⟩ => (h a).elim
#align fin_enum.psigma.fin_enum_prop_left FinEnum.PSigma.finEnumPropLeft
@@ -227,7 +227,7 @@ instance PSigma.finEnumPropLeft {α : Prop} {β : α → Type v} [∀ a, FinEnum
#print FinEnum.PSigma.finEnumPropRight /-
instance PSigma.finEnumPropRight {β : α → Prop} [FinEnum α] [∀ a, Decidable (β a)] :
- FinEnum (Σ'a, β a) :=
+ FinEnum (Σ' a, β a) :=
FinEnum.ofEquiv { a // β a }
⟨fun ⟨x, y⟩ => ⟨x, y⟩, fun ⟨x, y⟩ => ⟨x, y⟩, fun ⟨x, y⟩ => rfl, fun ⟨x, y⟩ => rfl⟩
#align fin_enum.psigma.fin_enum_prop_right FinEnum.PSigma.finEnumPropRight
@@ -235,7 +235,7 @@ instance PSigma.finEnumPropRight {β : α → Prop} [FinEnum α] [∀ a, Decidab
#print FinEnum.PSigma.finEnumPropProp /-
instance PSigma.finEnumPropProp {α : Prop} {β : α → Prop} [Decidable α] [∀ a, Decidable (β a)] :
- FinEnum (Σ'a, β a) :=
+ FinEnum (Σ' a, β a) :=
if h : ∃ a, β a then ofList [⟨h.fst, h.snd⟩] (by rintro ⟨⟩ <;> simp)
else ofList [] fun a => (h ⟨a.fst, a.snd⟩).elim
#align fin_enum.psigma.fin_enum_prop_prop FinEnum.PSigma.finEnumPropProp
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -26,12 +26,6 @@ universe u v
open Finset
-/- warning: fin_enum -> FinEnum is a dubious translation:
-lean 3 declaration is
- Sort.{u1} -> Sort.{max 1 (imax 1 u1) u1}
-but is expected to have type
- Sort.{u1} -> Sort.{max 1 u1}
-Case conversion may be inaccurate. Consider using '#align fin_enum FinEnumₓ'. -/
/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
@@ -278,12 +272,6 @@ def pi {β : α → Type max u v} [DecidableEq α] :
#align fin_enum.pi FinEnum.pi
-/
-/- warning: fin_enum.mem_pi -> FinEnum.mem_pi is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : α -> Type.{max u1 u2}} [_inst_1 : FinEnum.{succ u1} α] [_inst_2 : forall (a : α), FinEnum.{succ (max u1 u2)} (β a)] (xs : List.{u1} α) (f : forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a xs) -> (β a)), Membership.Mem.{max u1 u2, max u1 u2} (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a xs) -> (β a)) (List.{max u1 u2} (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a xs) -> (β a))) (List.hasMem.{max u1 u2} (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a xs) -> (β a))) f (FinEnum.pi.{u1, u2} α (fun (x : α) => β x) (fun (a : α) (b : α) => FinEnum.decEq.{succ u1} α _inst_1 a b) xs (fun (x : α) => FinEnum.toList.{max u1 u2} (β x) (_inst_2 x)))
-but is expected to have type
- forall {α : Type.{u2}} {β : α -> Type.{max u2 u1}} [_inst_1 : FinEnum.{succ u2} α] [_inst_2 : forall (a : α), FinEnum.{succ (max u2 u1)} (β a)] (xs : List.{u2} α) (f : forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a xs) -> (β a)), Membership.mem.{max u2 u1, max u2 u1} (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a xs) -> (β a)) (List.{max u2 u1} (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a xs) -> (β a))) (List.instMembershipList.{max u2 u1} (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a xs) -> (β a))) f (FinEnum.pi.{u2, u1} α (fun (x : α) => β x) (fun (a : α) (b : α) => FinEnum.decEq.{succ u2} α _inst_1 a b) xs (fun (x : α) => FinEnum.toList.{max u2 u1} (β x) (_inst_2 x)))
-Case conversion may be inaccurate. Consider using '#align fin_enum.mem_pi FinEnum.mem_piₓ'. -/
theorem mem_pi {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β a)] (xs : List α)
(f : ∀ a, a ∈ xs → β a) : f ∈ pi xs fun x => toList (β x) :=
by
@@ -315,12 +303,6 @@ instance pi.finEnum {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β
#align fin_enum.pi.fin_enum FinEnum.pi.finEnum
-/
-/- warning: fin_enum.pfun_fin_enum -> FinEnum.pfunFinEnum is a dubious translation:
-lean 3 declaration is
- forall (p : Prop) [_inst_1 : Decidable p] (α : p -> Type.{u_1}) [_inst_2 : forall (hp : p), FinEnum.{succ u_1} (α hp)], FinEnum.{succ u_1} (forall (hp : p), α hp)
-but is expected to have type
- forall (p : Prop) [_inst_1 : Decidable p] (α : p -> Type) [_inst_2 : forall (hp : p), FinEnum.{1} (α hp)], FinEnum.{1} (forall (hp : p), α hp)
-Case conversion may be inaccurate. Consider using '#align fin_enum.pfun_fin_enum FinEnum.pfunFinEnumₓ'. -/
instance pfunFinEnum (p : Prop) [Decidable p] (α : p → Type _) [∀ hp, FinEnum (α hp)] :
FinEnum (∀ hp : p, α hp) :=
if hp : p then
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -179,36 +179,24 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
s ∈ Finset.enum xs ↔ ∀ x ∈ s, x ∈ xs :=
by
induction xs generalizing s <;> simp [*, finset.enum]
- · simp [Finset.eq_empty_iff_forall_not_mem, (· ∉ ·)]
- rfl
- · constructor
- rintro ⟨a, h, h'⟩ x hx
+ · simp [Finset.eq_empty_iff_forall_not_mem, (· ∉ ·)]; rfl
+ · constructor; rintro ⟨a, h, h'⟩ x hx
cases h'
- · right
- apply h
- subst a
- exact hx
- · simp only [h', mem_union, mem_singleton] at hx⊢
- cases hx
+ · right; apply h; subst a; exact hx
+ · simp only [h', mem_union, mem_singleton] at hx⊢; cases hx
· exact Or.inl hx
· exact Or.inr (h _ hx)
- intro h
- exists s \ ({xs_hd} : Finset α)
+ intro h; exists s \ ({xs_hd} : Finset α)
simp only [and_imp, mem_sdiff, mem_singleton]
simp only [or_iff_not_imp_left] at h
exists h
by_cases xs_hd ∈ s
- · have : {xs_hd} ⊆ s
- simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
+ · have : {xs_hd} ⊆ s; simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
simp only [union_sdiff_of_subset this, or_true_iff, Finset.union_sdiff_of_subset,
eq_self_iff_true]
- · left
- symm
- simp only [sdiff_eq_self]
- intro a
- simp only [and_imp, mem_inter, mem_singleton]
- rintro h₀ rfl
- apply h h₀
+ · left; symm; simp only [sdiff_eq_self]
+ intro a; simp only [and_imp, mem_inter, mem_singleton]
+ rintro h₀ rfl; apply h h₀
#align fin_enum.finset.mem_enum FinEnum.Finset.mem_enum
-/
@@ -302,17 +290,10 @@ theorem mem_pi {β : α → Type max u v} [FinEnum α] [∀ a, FinEnum (β a)] (
induction xs <;> simp [pi, -List.map_eq_map, monad_norm, functor_norm]
· ext (a⟨⟩)
· exists pi.cons xs_hd xs_tl (f _ (List.mem_cons_self _ _))
- constructor
- exact ⟨_, rfl⟩
- exists pi.tail f
- constructor
+ constructor; exact ⟨_, rfl⟩
+ exists pi.tail f; constructor
· apply xs_ih
- · ext (x h)
- simp [pi.cons]
- split_ifs
- subst x
- rfl
- rfl
+ · ext (x h); simp [pi.cons]; split_ifs; subst x; rfl; rfl
#align fin_enum.mem_pi FinEnum.mem_pi
#print FinEnum.pi.enum /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/8d33f09cd7089ecf074b4791907588245aec5d1b
@@ -95,7 +95,7 @@ theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by
#print FinEnum.nodup_toList /-
@[simp]
theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by
- simp [to_list] <;> apply List.Nodup.map <;> [apply Equiv.injective, apply List.nodup_finRange]
+ simp [to_list] <;> apply List.Nodup.map <;> [apply Equiv.injective;apply List.nodup_finRange]
#align fin_enum.nodup_to_list FinEnum.nodup_toList
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/09079525fd01b3dda35e96adaa08d2f943e1648c
@@ -32,7 +32,7 @@ lean 3 declaration is
but is expected to have type
Sort.{u1} -> Sort.{max 1 u1}
Case conversion may be inaccurate. Consider using '#align fin_enum FinEnumₓ'. -/
-/- ./././Mathport/Syntax/Translate/Command.lean:388:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
+/- ./././Mathport/Syntax/Translate/Command.lean:393:30: infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `fin_enum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `fin n` for some n. -/
class FinEnum (α : Sort _) where
@@ -41,7 +41,7 @@ class FinEnum (α : Sort _) where
[decEq : DecidableEq α]
#align fin_enum FinEnum
-attribute [instance] FinEnum.decEq
+attribute [instance 100] FinEnum.decEq
namespace FinEnum
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -232,7 +232,7 @@ theorem mem_pi {β : α → Type _} [FinEnum α] [∀ a, FinEnum (β a)] (xs : L
· ext a ⟨⟩
· exists Pi.cons xs_hd xs_tl (f _ (List.mem_cons_self _ _))
constructor
- exact ⟨_, rfl⟩
+ · exact ⟨_, rfl⟩
exists Pi.tail f
constructor
· apply xs_ih
@@ -48,13 +48,12 @@ def ofEquiv (α) {β} [FinEnum α] (h : β ≃ α) : FinEnum β
#align fin_enum.of_equiv FinEnum.ofEquiv
/-- create a `FinEnum` instance from an exhaustive list without duplicates -/
-def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α
- where
+def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) :
+ FinEnum α where
card := xs.length
equiv :=
- ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, fun ⟨i, h⟩ =>
- xs.nthLe _ h, fun x => by simp, fun ⟨i, h⟩ => by
- simp [*]⟩
+ ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, xs.get, fun x => by simp,
+ fun i => by ext; simp [List.get_indexOf h']⟩
#align fin_enum.of_nodup_list FinEnum.ofNodupList
/-- create a `FinEnum` instance from an exhaustive list; duplicates are removed -/
Removes nonterminal simps on lines looking like simp [...]
@@ -238,7 +238,7 @@ theorem mem_pi {β : α → Type _} [FinEnum α] [∀ a, FinEnum (β a)] (xs : L
constructor
· apply xs_ih
· ext x h
- simp [Pi.cons]
+ simp only [Pi.cons]
split_ifs
· subst x
rfl
Many proofs use the "stream of consciousness" style from Lean 3, rather than have ... :=
or suffices ... from/by
.
This PR updates a fraction of these to the preferred Lean 4 style.
I think a good goal would be to delete the "deferred" versions of have
, suffices
, and let
at the bottom of Mathlib.Tactic.Have
(Anyone who would like to contribute more cleanup is welcome to push directly to this branch.)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -155,8 +155,8 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
simp only [or_iff_not_imp_left] at h
exists h
by_cases h : xs_hd ∈ s
- · have : {xs_hd} ⊆ s
- simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
+ · have : {xs_hd} ⊆ s := by
+ simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
simp only [union_sdiff_of_subset this, or_true_iff, Finset.union_sdiff_of_subset,
eq_self_iff_true]
· left
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -24,7 +24,7 @@ open Finset
infer kinds are unsupported in Lean 4: #[`Equiv] [] -/
/-- `FinEnum α` means that `α` is finite and can be enumerated in some order,
i.e. `α` has an explicit bijection with `Fin n` for some n. -/
-class FinEnum (α : Sort _) where
+class FinEnum (α : Sort*) where
/-- `FinEnum.card` is the cardinality of the `FinEnum` -/
card : ℕ
/-- `FinEnum.Equiv` states that type `α` is in bijection with `Fin card`,
@@ -2,16 +2,13 @@
Copyright (c) 2019 Simon Hudon. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Simon Hudon
-
-! This file was ported from Lean 3 source module data.fin_enum
-! leanprover-community/mathlib commit 9003f28797c0664a49e4179487267c494477d853
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Control.Monad.Basic
import Mathlib.Data.Fintype.Basic
import Mathlib.Data.List.ProdSigma
+#align_import data.fin_enum from "leanprover-community/mathlib"@"9003f28797c0664a49e4179487267c494477d853"
+
/-!
Type class for finitely enumerable types. The property is stronger
than `Fintype` in that it assigns each element a rank in a finite
@@ -32,7 +32,7 @@ class FinEnum (α : Sort _) where
card : ℕ
/-- `FinEnum.Equiv` states that type `α` is in bijection with `Fin card`,
the size of the `FinEnum` -/
- Equiv : α ≃ Fin card
+ equiv : α ≃ Fin card
[decEq : DecidableEq α]
#align fin_enum FinEnum
@@ -46,15 +46,15 @@ variable {α : Type u} {β : α → Type v}
def ofEquiv (α) {β} [FinEnum α] (h : β ≃ α) : FinEnum β
where
card := card α
- Equiv := h.trans (Equiv)
- decEq := (h.trans (Equiv)).decidableEq
+ equiv := h.trans (equiv)
+ decEq := (h.trans (equiv)).decidableEq
#align fin_enum.of_equiv FinEnum.ofEquiv
/-- create a `FinEnum` instance from an exhaustive list without duplicates -/
def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' : List.Nodup xs) : FinEnum α
where
card := xs.length
- Equiv :=
+ equiv :=
⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, fun ⟨i, h⟩ =>
xs.nthLe _ h, fun x => by simp, fun ⟨i, h⟩ => by
simp [*]⟩
@@ -67,14 +67,14 @@ def ofList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) : FinEnum
/-- create an exhaustive list of the values of a given type -/
def toList (α) [FinEnum α] : List α :=
- (List.finRange (card α)).map (Equiv).symm
+ (List.finRange (card α)).map (equiv).symm
#align fin_enum.to_list FinEnum.toList
open Function
@[simp]
theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by
- simp [toList]; exists Equiv x; simp
+ simp [toList]; exists equiv x; simp
#align fin_enum.mem_to_list FinEnum.mem_toList
@[simp]
@@ -207,7 +207,7 @@ instance PSigma.finEnumPropProp {α : Prop} {β : α → Prop} [Decidable α] [
#align fin_enum.psigma.fin_enum_prop_prop FinEnum.PSigma.finEnumPropProp
instance (priority := 100) [FinEnum α] : Fintype α where
- elems := univ.map (Equiv).symm.toEmbedding
+ elems := univ.map (equiv).symm.toEmbedding
complete := by intros; simp
/-- For `Pi.cons x xs y f` create a function where every `i ∈ xs` is mapped to `f i` and
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.
@@ -55,7 +55,7 @@ def ofNodupList [DecidableEq α] (xs : List α) (h : ∀ x : α, x ∈ xs) (h' :
where
card := xs.length
Equiv :=
- ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length] ; apply h⟩, fun ⟨i, h⟩ =>
+ ⟨fun x => ⟨xs.indexOf x, by rw [List.indexOf_lt_length]; apply h⟩, fun ⟨i, h⟩ =>
xs.nthLe _ h, fun x => by simp, fun ⟨i, h⟩ => by
simp [*]⟩
#align fin_enum.of_nodup_list FinEnum.ofNodupList
@@ -74,17 +74,17 @@ open Function
@[simp]
theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by
- simp [toList] ; exists Equiv x ; simp
+ simp [toList]; exists Equiv x; simp
#align fin_enum.mem_to_list FinEnum.mem_toList
@[simp]
theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by
- simp [toList] ; apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange]
+ simp [toList]; apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange]
#align fin_enum.nodup_to_list FinEnum.nodup_toList
/-- create a `FinEnum` instance using a surjection -/
def ofSurjective {β} (f : β → α) [DecidableEq α] [FinEnum β] (h : Surjective f) : FinEnum α :=
- ofList ((toList β).map f) (by intro ; simp ; exact h _)
+ ofList ((toList β).map f) (by intro; simp; exact h _)
#align fin_enum.of_surjective FinEnum.ofSurjective
/-- create a `FinEnum` instance using an injection -/
@@ -107,12 +107,12 @@ instance empty : FinEnum Empty :=
#align fin_enum.empty FinEnum.empty
instance punit : FinEnum PUnit :=
- ofList [PUnit.unit] fun x => by cases x ; simp
+ ofList [PUnit.unit] fun x => by cases x; simp
#align fin_enum.punit FinEnum.punit
/- ./././Mathport/Syntax/Translate/Expr.lean:177:8: unsupported: ambiguous notation -/
instance prod {β} [FinEnum α] [FinEnum β] : FinEnum (α × β) :=
- ofList (toList α ×ˢ toList β) fun x => by cases x ; simp
+ ofList (toList α ×ˢ toList β) fun x => by cases x; simp
#align fin_enum.prod FinEnum.prod
instance sum {β} [FinEnum α] [FinEnum β] : FinEnum (Sum α β) :=
@@ -172,17 +172,17 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
#align fin_enum.finset.mem_enum FinEnum.Finset.mem_enum
instance Finset.finEnum [FinEnum α] : FinEnum (Finset α) :=
- ofList (Finset.enum (toList α)) (by intro ; simp)
+ ofList (Finset.enum (toList α)) (by intro; simp)
#align fin_enum.finset.fin_enum FinEnum.Finset.finEnum
instance Subtype.finEnum [FinEnum α] (p : α → Prop) [DecidablePred p] : FinEnum { x // p x } :=
ofList ((toList α).filterMap fun x => if h : p x then some ⟨_, h⟩ else none)
- (by rintro ⟨x, h⟩ ; simp ; exists x ; simp [*])
+ (by rintro ⟨x, h⟩; simp; exists x; simp [*])
#align fin_enum.subtype.fin_enum FinEnum.Subtype.finEnum
instance (β : α → Type v) [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Sigma β) :=
ofList ((toList α).bind fun a => (toList (β a)).map <| Sigma.mk a)
- (by intro x ; cases x ; simp)
+ (by intro x; cases x; simp)
instance PSigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ'a, β a) :=
FinEnum.ofEquiv _ (Equiv.psigmaEquivSigma _)
@@ -202,13 +202,13 @@ instance PSigma.finEnumPropRight {β : α → Prop} [FinEnum α] [∀ a, Decidab
instance PSigma.finEnumPropProp {α : Prop} {β : α → Prop} [Decidable α] [∀ a, Decidable (β a)] :
FinEnum (Σ'a, β a) :=
- if h : ∃ a, β a then ofList [⟨h.fst, h.snd⟩] (by rintro ⟨⟩ ; simp)
+ if h : ∃ a, β a then ofList [⟨h.fst, h.snd⟩] (by rintro ⟨⟩; simp)
else ofList [] fun a => (h ⟨a.fst, a.snd⟩).elim
#align fin_enum.psigma.fin_enum_prop_prop FinEnum.PSigma.finEnumPropProp
instance (priority := 100) [FinEnum α] : Fintype α where
elems := univ.map (Equiv).symm.toEmbedding
- complete := by intros ; simp
+ complete := by intros; simp
/-- For `Pi.cons x xs y f` create a function where every `i ∈ xs` is mapped to `f i` and
`x` is mapped to `y` -/
@@ -254,7 +254,7 @@ def pi.enum (β : α → Type (max u v)) [FinEnum α] [∀ a, FinEnum (β a)] :
#align fin_enum.pi.enum FinEnum.pi.enum
theorem pi.mem_enum {β : α → Type (max u v)} [FinEnum α] [∀ a, FinEnum (β a)] (f : ∀ a, β a) :
- f ∈ pi.enum.{u, v} β := by simp [pi.enum] ; refine' ⟨fun a _ => f a, mem_pi _ _, rfl⟩
+ f ∈ pi.enum.{u, v} β := by simp [pi.enum]; refine' ⟨fun a _ => f a, mem_pi _ _, rfl⟩
#align fin_enum.pi.mem_enum FinEnum.pi.mem_enum
instance pi.finEnum {β : α → Type (max u v)} [FinEnum α] [∀ a, FinEnum (β a)] :
@@ -265,8 +265,8 @@ instance pi.finEnum {β : α → Type (max u v)} [FinEnum α] [∀ a, FinEnum (
instance pfunFinEnum (p : Prop) [Decidable p] (α : p → Type) [∀ hp, FinEnum (α hp)] :
FinEnum (∀ hp : p, α hp) :=
if hp : p then
- ofList ((toList (α hp)).map fun x _ => x) (by intro x ; simp ; exact ⟨x hp, rfl⟩)
- else ofList [fun hp' => (hp hp').elim] (by intro ; simp ; ext hp' ; cases hp hp')
+ ofList ((toList (α hp)).map fun x _ => x) (by intro x; simp; exact ⟨x hp, rfl⟩)
+ else ofList [fun hp' => (hp hp').elim] (by intro; simp; ext hp'; cases hp hp')
#align fin_enum.pfun_fin_enum FinEnum.pfunFinEnum
end FinEnum
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -148,7 +148,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
apply h
subst a
exact hx
- · simp only [h', mem_union, mem_singleton] at hx⊢
+ · simp only [h', mem_union, mem_singleton] at hx ⊢
cases' hx with hx hx'
· exact Or.inl hx
· exact Or.inr (h _ hx')
ext
(#5258)
Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: Joël Riou <joel.riou@universite-paris-saclay.fr> Co-authored-by: Riccardo Brasca <riccardo.brasca@gmail.com> Co-authored-by: Yury G. Kudryashov <urkud@urkud.name> Co-authored-by: Scott Morrison <scott.morrison@anu.edu.au> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Jeremy Tan Jie Rui <reddeloostw@gmail.com> Co-authored-by: Pol'tta / Miyahara Kō <pol_tta@outlook.jp> Co-authored-by: Jason Yuen <jason_yuen2007@hotmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Jireh Loreaux <loreaujy@gmail.com> Co-authored-by: Ruben Van de Velde <65514131+Ruben-VandeVelde@users.noreply.github.com> Co-authored-by: Kyle Miller <kmill31415@gmail.com> Co-authored-by: Heather Macbeth <25316162+hrmacbeth@users.noreply.github.com> Co-authored-by: Jujian Zhang <jujian.zhang1998@outlook.com> Co-authored-by: Yaël Dillies <yael.dillies@gmail.com>
@@ -233,14 +233,14 @@ def pi {β : α → Type max u v} [DecidableEq α] :
theorem mem_pi {β : α → Type _} [FinEnum α] [∀ a, FinEnum (β a)] (xs : List α)
(f : ∀ a, a ∈ xs → β a) : f ∈ pi xs fun x => toList (β x) := by
induction' xs with xs_hd xs_tl xs_ih <;> simp [pi, -List.map_eq_map, monad_norm, functor_norm]
- · ext (a⟨⟩)
+ · ext a ⟨⟩
· exists Pi.cons xs_hd xs_tl (f _ (List.mem_cons_self _ _))
constructor
exact ⟨_, rfl⟩
exists Pi.tail f
constructor
· apply xs_ih
- · ext (x h)
+ · ext x h
simp [Pi.cons]
split_ifs
· subst x
The main breaking change is that tac <;> [t1, t2]
is now written tac <;> [t1; t2]
, to avoid clashing with tactics like cases
and use
that take comma-separated lists.
@@ -79,7 +79,7 @@ theorem mem_toList [FinEnum α] (x : α) : x ∈ toList α := by
@[simp]
theorem nodup_toList [FinEnum α] : List.Nodup (toList α) := by
- simp [toList] ; apply List.Nodup.map <;> [apply Equiv.injective, apply List.nodup_finRange]
+ simp [toList] ; apply List.Nodup.map <;> [apply Equiv.injective; apply List.nodup_finRange]
#align fin_enum.nodup_to_list FinEnum.nodup_toList
/-- create a `FinEnum` instance using a surjection -/
See discussion at https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/mathport.20drops.20priorities.20in.20.60attribute.20.5Binstance.5D.60. mathport
has been dropping the priorities on instances when using the attribute
command.
This PR adds back all the priorities, except for local attribute
, and instances involving coercions, which I didn't want to mess with.
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -36,7 +36,7 @@ class FinEnum (α : Sort _) where
[decEq : DecidableEq α]
#align fin_enum FinEnum
-attribute [instance] FinEnum.decEq
+attribute [instance 100] FinEnum.decEq
namespace FinEnum
@@ -157,7 +157,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
simp only [and_imp, mem_sdiff, mem_singleton]
simp only [or_iff_not_imp_left] at h
exists h
- by_cases xs_hd ∈ s
+ by_cases h : xs_hd ∈ s
· have : {xs_hd} ⊆ s
simp only [HasSubset.Subset, *, forall_eq, mem_singleton]
simp only [union_sdiff_of_subset this, or_true_iff, Finset.union_sdiff_of_subset,
@@ -184,27 +184,27 @@ instance (β : α → Type v) [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Si
ofList ((toList α).bind fun a => (toList (β a)).map <| Sigma.mk a)
(by intro x ; cases x ; simp)
-instance Psigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ'a, β a) :=
+instance PSigma.finEnum [FinEnum α] [∀ a, FinEnum (β a)] : FinEnum (Σ'a, β a) :=
FinEnum.ofEquiv _ (Equiv.psigmaEquivSigma _)
-#align fin_enum.psigma.fin_enum FinEnum.Psigma.finEnum
+#align fin_enum.psigma.fin_enum FinEnum.PSigma.finEnum
-instance Psigma.finEnumPropLeft {α : Prop} {β : α → Type v} [∀ a, FinEnum (β a)] [Decidable α] :
+instance PSigma.finEnumPropLeft {α : Prop} {β : α → Type v} [∀ a, FinEnum (β a)] [Decidable α] :
FinEnum (Σ'a, β a) :=
if h : α then ofList ((toList (β h)).map <| PSigma.mk h) fun ⟨a, Ba⟩ => by simp
else ofList [] fun ⟨a, Ba⟩ => (h a).elim
-#align fin_enum.psigma.fin_enum_prop_left FinEnum.Psigma.finEnumPropLeft
+#align fin_enum.psigma.fin_enum_prop_left FinEnum.PSigma.finEnumPropLeft
-instance Psigma.finEnumPropRight {β : α → Prop} [FinEnum α] [∀ a, Decidable (β a)] :
+instance PSigma.finEnumPropRight {β : α → Prop} [FinEnum α] [∀ a, Decidable (β a)] :
FinEnum (Σ'a, β a) :=
FinEnum.ofEquiv { a // β a }
⟨fun ⟨x, y⟩ => ⟨x, y⟩, fun ⟨x, y⟩ => ⟨x, y⟩, fun ⟨_, _⟩ => rfl, fun ⟨_, _⟩ => rfl⟩
-#align fin_enum.psigma.fin_enum_prop_right FinEnum.Psigma.finEnumPropRight
+#align fin_enum.psigma.fin_enum_prop_right FinEnum.PSigma.finEnumPropRight
-instance Psigma.finEnumPropProp {α : Prop} {β : α → Prop} [Decidable α] [∀ a, Decidable (β a)] :
+instance PSigma.finEnumPropProp {α : Prop} {β : α → Prop} [Decidable α] [∀ a, Decidable (β a)] :
FinEnum (Σ'a, β a) :=
if h : ∃ a, β a then ofList [⟨h.fst, h.snd⟩] (by rintro ⟨⟩ ; simp)
else ofList [] fun a => (h ⟨a.fst, a.snd⟩).elim
-#align fin_enum.psigma.fin_enum_prop_prop FinEnum.Psigma.finEnumPropProp
+#align fin_enum.psigma.fin_enum_prop_prop FinEnum.PSigma.finEnumPropProp
instance (priority := 100) [FinEnum α] : Fintype α where
elems := univ.map (Equiv).symm.toEmbedding
In FinEnum.lean there was a bug that prevented the symm
tactic from working properly. After discussing on zulip, it's been fixed!
@@ -163,7 +163,7 @@ theorem Finset.mem_enum [DecidableEq α] (s : Finset α) (xs : List α) :
simp only [union_sdiff_of_subset this, or_true_iff, Finset.union_sdiff_of_subset,
eq_self_iff_true]
· left
- apply Eq.symm
+ symm
simp only [sdiff_eq_self]
intro a
simp only [and_imp, mem_inter, mem_singleton]
The unported dependencies are