data.fin.tuple.nat_antidiagonal
⟷
Mathlib.Data.Fin.Tuple.NatAntidiagonal
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)
(last sync)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -100,7 +100,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
· intro k x₀ x ih n
simp_rw [Fin.sum_cons, antidiagonal_tuple, List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
- @eq_comm _ _ (Prod.snd _), and_comm' (Prod.snd _ = _), ← Prod.mk.inj_iff, Prod.mk.eta,
+ @eq_comm _ _ (Prod.snd _), and_comm (Prod.snd _ = _), ← Prod.mk.inj_iff, Prod.mk.eta,
exists_prop, exists_eq_right]
#align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -121,16 +121,16 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· exact List.pairwise_singleton _ _
· rw [List.Nat.antidiagonal_succ]
refine' List.Pairwise.cons (fun a ha x hx₁ hx₂ => _) (n_ih.map _ fun a b h x hx₁ hx₂ => _)
- · rw [List.mem_map] at hx₁ hx₂ ha
+ · rw [List.mem_map] at hx₁ hx₂ ha
obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂
- rw [Fin.cons_eq_cons] at h
+ rw [Fin.cons_eq_cons] at h
injection h.1
- · rw [List.mem_map] at hx₁ hx₂
+ · rw [List.mem_map] at hx₁ hx₂
obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
- dsimp at h₁₂
- rw [Fin.cons_eq_cons, Nat.succ_inj] at h₁₂
+ dsimp at h₁₂
+ rw [Fin.cons_eq_cons, Nat.succ_inj] at h₁₂
obtain ⟨h₁₂, rfl⟩ := h₁₂
- rw [h₁₂] at h
+ rw [h₁₂] at h
exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
#align list.nat.nodup_antidiagonal_tuple List.Nat.nodup_antidiagonalTuple
-/
@@ -191,7 +191,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
exact List.pairwise_singleton _ _
· rw [antidiagonal_succ, List.pairwise_cons, List.pairwise_map']
refine' ⟨fun p hp x hx y hy => _, _⟩
- · rw [List.mem_map, Prod.exists] at hp
+ · rw [List.mem_map, Prod.exists] at hp
obtain ⟨a, b, hab, rfl : (Nat.succ a, b) = p⟩ := hp
exact Or.inl (Nat.zero_lt_succ _)
dsimp
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -128,7 +128,7 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· rw [List.mem_map] at hx₁ hx₂
obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
dsimp at h₁₂
- rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
+ rw [Fin.cons_eq_cons, Nat.succ_inj] at h₁₂
obtain ⟨h₁₂, rfl⟩ := h₁₂
rw [h₁₂] at h
exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
@@ -195,7 +195,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
obtain ⟨a, b, hab, rfl : (Nat.succ a, b) = p⟩ := hp
exact Or.inl (Nat.zero_lt_succ _)
dsimp
- simp_rw [Nat.succ_inj', Nat.succ_lt_succ_iff]
+ simp_rw [Nat.succ_inj, Nat.succ_lt_succ_iff]
exact n_ih
#align list.nat.antidiagonal_tuple_pairwise_pi_lex List.Nat.antidiagonalTuple_pairwise_pi_lex
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,10 +3,10 @@ Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-/
-import Mathbin.Algebra.BigOperators.Fin
-import Mathbin.Data.Finset.NatAntidiagonal
-import Mathbin.Data.Fin.VecNotation
-import Mathbin.Logic.Equiv.Fin
+import Algebra.BigOperators.Fin
+import Data.Finset.NatAntidiagonal
+import Data.Fin.VecNotation
+import Logic.Equiv.Fin
#align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"34ee86e6a59d911a8e4f89b68793ee7577ae79c7"
mathlib commit https://github.com/leanprover-community/mathlib/commit/32a7e535287f9c73f2e4d2aef306a39190f0b504
@@ -151,7 +151,7 @@ theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] :=
by
simp_rw [antidiagonal_tuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton,
- tsub_self, List.bind_append, List.bind_singleton, antidiagonal_tuple_zero_zero,
+ tsub_self, List.append_bind, List.bind_singleton, antidiagonal_tuple_zero_zero,
List.map_singleton, List.map_bind]
conv_rhs => rw [← List.nil_append [![n]]]
congr 1
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,17 +2,14 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.fin.tuple.nat_antidiagonal
-! leanprover-community/mathlib commit 34ee86e6a59d911a8e4f89b68793ee7577ae79c7
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Algebra.BigOperators.Fin
import Mathbin.Data.Finset.NatAntidiagonal
import Mathbin.Data.Fin.VecNotation
import Mathbin.Logic.Equiv.Fin
+#align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"34ee86e6a59d911a8e4f89b68793ee7577ae79c7"
+
/-!
# Collections of tuples of naturals with the same sum
mathlib commit https://github.com/leanprover-community/mathlib/commit/a3e83f0fa4391c8740f7d773a7a9b74e311ae2a3
@@ -92,7 +92,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = []
#print List.Nat.mem_antidiagonalTuple /-
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n :=
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n :=
by
revert n
refine' Fin.consInduction _ _ x
@@ -233,7 +233,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = 0 :
#print Multiset.Nat.mem_antidiagonalTuple /-
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n :=
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n :=
List.Nat.mem_antidiagonalTuple
#align multiset.nat.mem_antidiagonal_tuple Multiset.Nat.mem_antidiagonalTuple
-/
@@ -294,7 +294,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = ∅
#print Finset.Nat.mem_antidiagonalTuple /-
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n :=
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n :=
List.Nat.mem_antidiagonalTuple
#align finset.nat.mem_antidiagonal_tuple Finset.Nat.mem_antidiagonalTuple
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -124,16 +124,16 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· exact List.pairwise_singleton _ _
· rw [List.Nat.antidiagonal_succ]
refine' List.Pairwise.cons (fun a ha x hx₁ hx₂ => _) (n_ih.map _ fun a b h x hx₁ hx₂ => _)
- · rw [List.mem_map] at hx₁ hx₂ ha
+ · rw [List.mem_map] at hx₁ hx₂ ha
obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂
- rw [Fin.cons_eq_cons] at h
+ rw [Fin.cons_eq_cons] at h
injection h.1
- · rw [List.mem_map] at hx₁ hx₂
+ · rw [List.mem_map] at hx₁ hx₂
obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
- dsimp at h₁₂
- rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
+ dsimp at h₁₂
+ rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
obtain ⟨h₁₂, rfl⟩ := h₁₂
- rw [h₁₂] at h
+ rw [h₁₂] at h
exact h (List.mem_map_of_mem _ hx₁) (List.mem_map_of_mem _ hx₂)
#align list.nat.nodup_antidiagonal_tuple List.Nat.nodup_antidiagonalTuple
-/
@@ -194,7 +194,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
exact List.pairwise_singleton _ _
· rw [antidiagonal_succ, List.pairwise_cons, List.pairwise_map']
refine' ⟨fun p hp x hx y hy => _, _⟩
- · rw [List.mem_map, Prod.exists] at hp
+ · rw [List.mem_map, Prod.exists] at hp
obtain ⟨a, b, hab, rfl : (Nat.succ a, b) = p⟩ := hp
exact Or.inl (Nat.zero_lt_succ _)
dsimp
@@ -327,7 +327,7 @@ section EquivProd
This is the tuple version of `finset.nat.sigma_antidiagonal_equiv_prod`. -/
@[simps]
-def sigmaAntidiagonalTupleEquivTuple (k : ℕ) : (Σn, antidiagonalTuple k n) ≃ (Fin k → ℕ)
+def sigmaAntidiagonalTupleEquivTuple (k : ℕ) : (Σ n, antidiagonalTuple k n) ≃ (Fin k → ℕ)
where
toFun x := x.2
invFun x := ⟨∑ i, x i, x, mem_antidiagonalTuple.mpr rfl⟩
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -48,7 +48,7 @@ support finitely-supported functions, as is done with `cut` in
-/
-open BigOperators
+open scoped BigOperators
/-! ### Lists -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -101,7 +101,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
· simp
· simp [eq_comm]
· intro k x₀ x ih n
- simp_rw [Fin.sum_cons, antidiagonal_tuple, List.mem_bind, List.mem_map',
+ simp_rw [Fin.sum_cons, antidiagonal_tuple, List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm' (Prod.snd _ = _), ← Prod.mk.inj_iff, Prod.mk.eta,
exists_prop, exists_eq_right]
@@ -124,11 +124,11 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· exact List.pairwise_singleton _ _
· rw [List.Nat.antidiagonal_succ]
refine' List.Pairwise.cons (fun a ha x hx₁ hx₂ => _) (n_ih.map _ fun a b h x hx₁ hx₂ => _)
- · rw [List.mem_map'] at hx₁ hx₂ ha
+ · rw [List.mem_map] at hx₁ hx₂ ha
obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂
rw [Fin.cons_eq_cons] at h
injection h.1
- · rw [List.mem_map'] at hx₁ hx₂
+ · rw [List.mem_map] at hx₁ hx₂
obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
dsimp at h₁₂
rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
@@ -183,7 +183,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
| 0, n + 1 => List.Pairwise.nil
| k + 1, n =>
by
- simp_rw [antidiagonal_tuple, List.pairwise_bind, List.pairwise_map', List.mem_map',
+ simp_rw [antidiagonal_tuple, List.pairwise_bind, List.pairwise_map', List.mem_map,
forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
simp only [mem_antidiagonal, Prod.forall, and_imp, forall_apply_eq_imp_iff₂]
simp only [Fin.pi_lex_lt_cons_cons, eq_self_iff_true, true_and_iff, lt_self_iff_false,
@@ -194,7 +194,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
exact List.pairwise_singleton _ _
· rw [antidiagonal_succ, List.pairwise_cons, List.pairwise_map']
refine' ⟨fun p hp x hx y hy => _, _⟩
- · rw [List.mem_map', Prod.exists] at hp
+ · rw [List.mem_map, Prod.exists] at hp
obtain ⟨a, b, hab, rfl : (Nat.succ a, b) = p⟩ := hp
exact Or.inl (Nat.zero_lt_succ _)
dsimp
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -87,7 +87,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
· simp [eq_comm]
| h x₀ x ih =>
simp_rw [Fin.sum_cons]
- rw [antidiagonalTuple] -- porting note: simp_rw doesn't use the equation lemma properly
+ rw [antidiagonalTuple] -- Porting note: simp_rw doesn't use the equation lemma properly
simp_rw [List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _),
@@ -33,7 +33,7 @@ the sequence of elements `x : Fin k → ℕ` such that `n = ∑ i, x i`.
## Implementation notes
-While we could implement this by filtering `(Fintype.PiFinset $ fun _ ↦ range (n + 1))` or similar,
+While we could implement this by filtering `(Fintype.PiFinset fun _ ↦ range (n + 1))` or similar,
this implementation would be much slower.
In the future, we could consider generalizing `Finset.Nat.antidiagonalTuple` further to
@@ -91,7 +91,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
simp_rw [List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _),
- ←Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right]
+ ← Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right]
#align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple
/-- The antidiagonal of `n` does not contain duplicate entries. -/
This is the supremum of
along with some minor fixes from failures on nightly-testing as Mathlib master
is merged into it.
Note that some PRs for changes that are already compatible with the current toolchain and will be necessary have already been split out: #8380.
I am hopeful that in future we will be able to progressively merge adaptation PRs into a bump/v4.X.0
branch, so we never end up with a "big merge" like this. However one of these adaptation PRs (#8056) predates my new scheme for combined CI, and it wasn't possible to keep that PR viable in the meantime.
In particular this includes adjustments for the Lean PRs
We can get rid of all the
local macro_rules | `($x ^ $y) => `(HPow.hPow $x $y) -- Porting note: See issue [lean4#2220](https://github.com/leanprover/lean4/pull/2220)
macros across Mathlib (and in any projects that want to write natural number powers of reals).
Changes the default behaviour of simp
to (config := {decide := false})
. This makes simp
(and consequentially norm_num
) less powerful, but also more consistent, and less likely to blow up in long failures. This requires a variety of changes: changing some previously by simp
or norm_num
to decide
or rfl
, or adding (config := {decide := true})
.
This changed the behaviour of simp
so that simp [f]
will only unfold "fully applied" occurrences of f
. The old behaviour can be recovered with simp (config := { unfoldPartialApp := true })
. We may in future add a syntax for this, e.g. simp [!f]
; please provide feedback! In the meantime, we have made the following changes:
(config := { unfoldPartialApp := true })
in some places, to recover the old behaviour@[eqns]
to manually adjust the equation lemmas for a particular definition, recovering the old behaviour just for that definition. See #8371, where we do this for Function.comp
and Function.flip
.This change in Lean may require further changes down the line (e.g. adding the !f
syntax, and/or upstreaming the special treatment for Function.comp
and Function.flip
, and/or removing this special treatment). Please keep an open and skeptical mind about these changes!
Co-authored-by: leanprover-community-mathlib4-bot <leanprover-community-mathlib4-bot@users.noreply.github.com> Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Mauricio Collares <mauricio@collares.org>
@@ -83,7 +83,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
induction x using Fin.consInduction generalizing n with
| h0 =>
cases n
- · simp
+ · decide
· simp [eq_comm]
| h x₀ x ih =>
simp_rw [Fin.sum_cons]
Finset.Nat.antidiagonal
(#7486)
We define a type class Finset.HasAntidiagonal A
which contains a function
antidiagonal : A → Finset (A × A)
such that antidiagonal n
is the Finset of all pairs adding to n
, as witnessed by mem_antidiagonal
.
When A
is a canonically ordered add monoid with locally finite order
this typeclass can be instantiated with Finset.antidiagonalOfLocallyFinite
.
This applies in particular when A
is ℕ
, more generally or σ →₀ ℕ
,
or even ι →₀ A
under the additional assumption OrderedSub A
that make it a canonically ordered add monoid.
(In fact, we would just need an AddMonoid
with a compatible order,
finite Iic
, such that if a + b = n
, then a, b ≤ n
,
and any finiteness condition would be OK.)
For computational reasons it is better to manually provide instances for ℕ
and σ →₀ ℕ
, to avoid quadratic runtime performance.
These instances are provided as Finset.Nat.instHasAntidiagonal
and Finsupp.instHasAntidiagonal
.
This is why Finset.antidiagonalOfLocallyFinite
is an abbrev
and not an instance
.
This definition does not exactly match with that of Multiset.antidiagonal
defined in Mathlib.Data.Multiset.Antidiagonal
, because of the multiplicities.
Indeed, by counting multiplicities, Multiset α
is equivalent to α →₀ ℕ
,
but Finset.antidiagonal
and Multiset.antidiagonal
will return different objects.
For example, for s : Multiset ℕ := {0,0,0}
, Multiset.antidiagonal s
has 8 elements
but Finset.antidiagonal s
has only 4.
def s : Multiset ℕ := {0, 0, 0}
#eval (Finset.antidiagonal s).card -- 4
#eval Multiset.card (Multiset.antidiagonal s) -- 8
HasMulAntidiagonal
(for monoids).
For PNat
, we will recover the set of divisors of a strictly positive integer.This closes #7917
Co-authored by: María Inés de Frutos-Fernández <mariaines.dff@gmail.com> and Eric Wieser <efw27@cam.ac.uk>
Co-authored-by: Antoine Chambert-Loir <antoine.chambert-loir@math.univ-paris-diderot.fr> Co-authored-by: Mario Carneiro <di.gama@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -264,7 +264,7 @@ section EquivProd
/-- The disjoint union of antidiagonal tuples `Σ n, antidiagonalTuple k n` is equivalent to the
`k`-tuple `Fin k → ℕ`. This is such an equivalence, obtained by mapping `(n, x)` to `x`.
-This is the tuple version of `Finset.Nat.sigmaAntidiagonalEquivProd`. -/
+This is the tuple version of `Finset.sigmaAntidiagonalEquivProd`. -/
@[simps]
def sigmaAntidiagonalTupleEquivTuple (k : ℕ) : (Σ n, antidiagonalTuple k n) ≃ (Fin k → ℕ)
where
@@ -91,7 +91,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
simp_rw [List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _),
- ←Prod.mk.inj_iff (a₁ := Prod.fst _), Prod.mk.eta, exists_eq_right]
+ ←Prod.mk.inj_iff (a₁ := Prod.fst _), exists_eq_right]
#align list.nat.mem_antidiagonal_tuple List.Nat.mem_antidiagonalTuple
/-- The antidiagonal of `n` does not contain duplicate entries. -/
@@ -132,7 +132,7 @@ theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]
@[simp]
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] := by
simp_rw [antidiagonalTuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton,
- tsub_self, List.bind_append, List.bind_singleton, List.map_bind]
+ tsub_self, List.append_bind, List.bind_singleton, List.map_bind]
conv_rhs => rw [← List.nil_append [![n]]]
congr 1
simp_rw [List.bind_eq_nil, List.mem_range, List.map_eq_nil]
@@ -2,17 +2,14 @@
Copyright (c) 2022 Eric Wieser. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Eric Wieser
-
-! This file was ported from Lean 3 source module data.fin.tuple.nat_antidiagonal
-! leanprover-community/mathlib commit 98e83c3d541c77cdb7da20d79611a780ff8e7d90
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Algebra.BigOperators.Fin
import Mathlib.Data.Finset.NatAntidiagonal
import Mathlib.Data.Fin.VecNotation
import Mathlib.Logic.Equiv.Fin
+#align_import data.fin.tuple.nat_antidiagonal from "leanprover-community/mathlib"@"98e83c3d541c77cdb7da20d79611a780ff8e7d90"
+
/-!
# Collections of tuples of naturals with the same sum
∑'
precedence (#5615)
∑
, ∏
and variants).([^a-zA-Zα-ωΑ-Ω'𝓝ℳ₀𝕂ₛ)]) \(([∑∏][^()∑∏]*,[^()∑∏:]*)\) ([⊂⊆=<≤])
replaced by $1 $2 $3
@@ -82,7 +82,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = []
#align list.nat.antidiagonal_tuple_zero_succ List.Nat.antidiagonalTuple_zero_succ
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n := by
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n := by
induction x using Fin.consInduction generalizing n with
| h0 =>
cases n
@@ -199,7 +199,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = 0 :
#align multiset.nat.antidiagonal_tuple_zero_succ Multiset.Nat.antidiagonalTuple_zero_succ
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n :=
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n :=
List.Nat.mem_antidiagonalTuple
#align multiset.nat.mem_antidiagonal_tuple Multiset.Nat.mem_antidiagonalTuple
@@ -244,7 +244,7 @@ theorem antidiagonalTuple_zero_succ (n : ℕ) : antidiagonalTuple 0 n.succ = ∅
#align finset.nat.antidiagonal_tuple_zero_succ Finset.Nat.antidiagonalTuple_zero_succ
theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
- x ∈ antidiagonalTuple k n ↔ (∑ i, x i) = n :=
+ x ∈ antidiagonalTuple k n ↔ ∑ i, x i = n :=
List.Nat.mem_antidiagonalTuple
#align finset.nat.mem_antidiagonal_tuple Finset.Nat.mem_antidiagonalTuple
@@ -36,7 +36,7 @@ the sequence of elements `x : Fin k → ℕ` such that `n = ∑ i, x i`.
## Implementation notes
-While we could implement this by filtering `(Fintype.PiFinset $ λ _, range (n + 1))` or similar,
+While we could implement this by filtering `(Fintype.PiFinset $ fun _ ↦ range (n + 1))` or similar,
this implementation would be much slower.
In the future, we could consider generalizing `Finset.Nat.antidiagonalTuple` further to
by
s! (#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 by
s".
@@ -126,8 +126,7 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]
| 0 => (congr_arg fun x => [x]) <| Subsingleton.elim _ _
- | k + 1 =>
- by
+ | k + 1 => by
rw [antidiagonalTuple, antidiagonal_zero, List.bind_singleton, antidiagonalTuple_zero_right k,
List.map_singleton]
exact congr_arg (fun x => [x]) Matrix.cons_zero_zero
@@ -157,8 +156,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
∀ k n, (antidiagonalTuple k n).Pairwise (Pi.Lex (· < ·) @fun _ => (· < ·))
| 0, 0 => List.pairwise_singleton _ _
| 0, _ + 1 => List.Pairwise.nil
- | k + 1, n =>
- by
+ | k + 1, n => by
simp_rw [antidiagonalTuple, List.pairwise_bind, List.pairwise_map, List.mem_map,
forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
simp only [mem_antidiagonal, Prod.forall, and_imp, forall_apply_eq_imp_iff₂]
closes #3680, see https://leanprover.zulipchat.com/#narrow/stream/287929-mathlib4/topic/Stepping.20through.20simp_rw/near/326712986
@@ -136,8 +136,7 @@ theorem antidiagonalTuple_zero_right : ∀ k, antidiagonalTuple k 0 = [0]
@[simp]
theorem antidiagonalTuple_one (n : ℕ) : antidiagonalTuple 1 n = [![n]] := by
simp_rw [antidiagonalTuple, antidiagonal, List.range_succ, List.map_append, List.map_singleton,
- tsub_self, List.bind_append, List.bind_singleton, antidiagonalTuple_zero_zero,
- List.map_singleton, List.map_bind]
+ tsub_self, List.bind_append, List.bind_singleton, List.map_bind]
conv_rhs => rw [← List.nil_append [![n]]]
congr 1
simp_rw [List.bind_eq_nil, List.mem_range, List.map_eq_nil]
Notably incorporates https://github.com/leanprover/std4/pull/98 and https://github.com/leanprover/std4/pull/109.
https://github.com/leanprover/std4/pull/98 moves a number of lemmas from Mathlib to Std, so the bump requires deleting them in Mathlib. I did check on each lemma whether its attributes were kept in the move (and gave attribute markings in Mathlib if they were not present in Std), but a reviewer may wish to re-check.
List.mem_map
changed statement from b ∈ l.map f ↔ ∃ a, a ∈ l ∧ b = f a
to b ∈ l.map f ↔ ∃ a, a ∈ l ∧ f a = b
. Similarly for List.exists_of_mem_map
. This was a deliberate change, so I have simply adjusted proofs (many become simpler, which supports the change). I also deleted List.mem_map'
, List.exists_of_mem_map'
, which were temporary versions in Mathlib while waiting for this change (replacing their uses with the unprimed versions).
Also, the lemma sublist_nil_iff_eq_nil
seems to have been renamed to sublist_nil
during the move, so I added an alias for the old name.
(another issue fixed during review by @digama0) List.Sublist.filter
had an argument change from explicit to implicit. This appears to have been an oversight (cc @JamesGallicchio). I have temporarily introduced List.Sublist.filter'
with the argument explicit, and replaced Mathlib uses of Sublist.filter
with Sublist.filter'
. Later we can fix the argument in Std, and then delete List.Sublist.filter'
.
@@ -91,7 +91,7 @@ theorem mem_antidiagonalTuple {n : ℕ} {k : ℕ} {x : Fin k → ℕ} :
| h x₀ x ih =>
simp_rw [Fin.sum_cons]
rw [antidiagonalTuple] -- porting note: simp_rw doesn't use the equation lemma properly
- simp_rw [List.mem_bind, List.mem_map',
+ simp_rw [List.mem_bind, List.mem_map,
List.Nat.mem_antidiagonal, Fin.cons_eq_cons, exists_eq_right_right, ih,
@eq_comm _ _ (Prod.snd _), and_comm (a := Prod.snd _ = _),
←Prod.mk.inj_iff (a₁ := Prod.fst _), Prod.mk.eta, exists_eq_right]
@@ -111,11 +111,11 @@ theorem nodup_antidiagonalTuple (k n : ℕ) : List.Nodup (antidiagonalTuple k n)
· exact List.pairwise_singleton _ _
· rw [List.Nat.antidiagonal_succ]
refine' List.Pairwise.cons (fun a ha x hx₁ hx₂ => _) (n_ih.map _ fun a b h x hx₁ hx₂ => _)
- · rw [List.mem_map'] at hx₁ hx₂ ha
+ · rw [List.mem_map] at hx₁ hx₂ ha
obtain ⟨⟨a, -, rfl⟩, ⟨x₁, -, rfl⟩, ⟨x₂, -, h⟩⟩ := ha, hx₁, hx₂
rw [Fin.cons_eq_cons] at h
injection h.1
- · rw [List.mem_map'] at hx₁ hx₂
+ · rw [List.mem_map] at hx₁ hx₂
obtain ⟨⟨x₁, hx₁, rfl⟩, ⟨x₂, hx₂, h₁₂⟩⟩ := hx₁, hx₂
dsimp at h₁₂
rw [Fin.cons_eq_cons, Nat.succ_inj'] at h₁₂
@@ -160,7 +160,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
| 0, _ + 1 => List.Pairwise.nil
| k + 1, n =>
by
- simp_rw [antidiagonalTuple, List.pairwise_bind, List.pairwise_map, List.mem_map',
+ simp_rw [antidiagonalTuple, List.pairwise_bind, List.pairwise_map, List.mem_map,
forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
simp only [mem_antidiagonal, Prod.forall, and_imp, forall_apply_eq_imp_iff₂]
simp only [Fin.pi_lex_lt_cons_cons, eq_self_iff_true, true_and_iff, lt_self_iff_false,
@@ -171,7 +171,7 @@ theorem antidiagonalTuple_pairwise_pi_lex :
exact List.pairwise_singleton _ _
· rw [antidiagonal_succ, List.pairwise_cons, List.pairwise_map]
refine' ⟨fun p hp x hx y hy => _, _⟩
- · rw [List.mem_map', Prod.exists] at hp
+ · rw [List.mem_map, Prod.exists] at hp
obtain ⟨a, b, _, rfl : (Nat.succ a, b) = p⟩ := hp
exact Or.inl (Nat.zero_lt_succ _)
dsimp
The unported dependencies are