data.list.func
⟷
Mathlib.Data.List.Func
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)
(last sync)
These are all just typo fixes, no proof adaptations.
This deliberately leaves alone things related to category theory and algebraic geometry, as there the lack of polymorphism is likely deliberate.
@@ -354,7 +354,7 @@ by {apply get_pointwise, apply sub_zero}
(sub xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
-@[simp] lemma nil_sub {α : Type} [add_group α]
+@[simp] lemma nil_sub {α : Type*} [add_group α]
(as : list α) : sub [] as = neg as :=
begin
rw [sub, nil_pointwise],
@@ -362,7 +362,7 @@ begin
rw [zero_sub]
end
-@[simp] lemma sub_nil {α : Type} [add_group α]
+@[simp] lemma sub_nil {α : Type*} [add_group α]
(as : list α) : sub as [] = as :=
begin
rw [sub, pointwise_nil],
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(first ported)
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -3,7 +3,7 @@ Copyright (c) 2019 Seul Baek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
-/
-import Data.Nat.Order.Basic
+import Algebra.Order.Group.Nat
#align_import data.list.func from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -44,16 +44,13 @@ variable {a : α}
variable {as as1 as2 as3 : List α}
-#print List.Func.neg /-
/-- Elementwise negation of a list -/
def neg [Neg α] (as : List α) :=
as.map fun a => -a
#align list.func.neg List.Func.neg
--/
variable [Inhabited α] [Inhabited β]
-#print List.Func.set /-
/-- Update element of a list by index. If the index is out of range, extend the list with default
elements
-/
@@ -64,11 +61,9 @@ def set (a : α) : List α → ℕ → List α
| h :: as, k + 1 => h :: Set as k
| [], k + 1 => default :: Set ([] : List α) k
#align list.func.set List.Func.set
--/
scoped notation as " {" m " ↦ " a "}" => List.Func.set a as m
-#print List.Func.get /-
/-- Get element of a list by index. If the index is out of range, return the default element -/
@[simp]
def get : ℕ → List α → α
@@ -76,18 +71,14 @@ def get : ℕ → List α → α
| 0, a :: as => a
| n + 1, a :: as => get n as
#align list.func.get List.Func.get
--/
-#print List.Func.Equiv /-
/-- Pointwise equality of lists. If lists are different lengths, compare with the default
element.
-/
def Equiv (as1 as2 : List α) : Prop :=
∀ m : Nat, get m as1 = get m as2
#align list.func.equiv List.Func.Equiv
--/
-#print List.Func.pointwise /-
/-- Pointwise operations on lists. If lists are different lengths, use the default element. -/
@[simp]
def pointwise (f : α → β → γ) : List α → List β → List γ
@@ -96,23 +87,17 @@ def pointwise (f : α → β → γ) : List α → List β → List γ
| a :: as, [] => map (fun x => f x default) (a :: as)
| a :: as, b :: bs => f a b :: pointwise as bs
#align list.func.pointwise List.Func.pointwise
--/
-#print List.Func.add /-
/-- Pointwise addition on lists. If lists are different lengths, use zero. -/
def add {α : Type u} [Zero α] [Add α] : List α → List α → List α :=
@pointwise α α α ⟨0⟩ ⟨0⟩ (· + ·)
#align list.func.add List.Func.add
--/
-#print List.Func.sub /-
/-- Pointwise subtraction on lists. If lists are different lengths, use zero. -/
def sub {α : Type u} [Zero α] [Sub α] : List α → List α → List α :=
@pointwise α α α ⟨0⟩ ⟨0⟩ (@Sub.sub α _)
#align list.func.sub List.Func.sub
--/
-#print List.Func.length_set /-
-- set
theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.length (m + 1)
| 0, [] => rfl
@@ -120,15 +105,11 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
| m + 1, [] => by simp only [Set, Nat.zero_max, length, @length_set m]
| m + 1, a :: as => by simp only [Set, Nat.succ_max_succ, length, @length_set m]
#align list.func.length_set List.Func.length_set
--/
-#print List.Func.get_nil /-
@[simp]
theorem get_nil {k : ℕ} : (get k [] : α) = default := by cases k <;> rfl
#align list.func.get_nil List.Func.get_nil
--/
-#print List.Func.get_eq_default_of_le /-
theorem get_eq_default_of_le : ∀ (k : ℕ) {as : List α}, as.length ≤ k → get k as = default
| 0, [], h1 => rfl
| 0, a :: as, h1 => by cases h1
@@ -137,17 +118,13 @@ theorem get_eq_default_of_le : ∀ (k : ℕ) {as : List α}, as.length ≤ k →
apply get_eq_default_of_le k
rw [← Nat.succ_le_succ_iff]; apply h1
#align list.func.get_eq_default_of_le List.Func.get_eq_default_of_le
--/
-#print List.Func.get_set /-
@[simp]
theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) = a
| 0, as => by cases as <;> rfl
| k + 1, as => by cases as <;> simp [get_set]
#align list.func.get_set List.Func.get_set
--/
-#print List.Func.eq_get_of_mem /-
theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
| b :: as, h => by
@@ -156,9 +133,7 @@ theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat,
· cases' eq_get_of_mem h with n h2
exists n + 1; apply h2
#align list.func.eq_get_of_mem List.Func.eq_get_of_mem
--/
-#print List.Func.mem_get_of_le /-
theorem mem_get_of_le : ∀ {n : ℕ} {as : List α}, n < as.length → get n as ∈ as
| _, [], h1 => by cases h1
| 0, a :: as, _ => Or.inl rfl
@@ -167,9 +142,7 @@ theorem mem_get_of_le : ∀ {n : ℕ} {as : List α}, n < as.length → get n as
apply mem_get_of_le
apply Nat.lt_of_succ_lt_succ h1
#align list.func.mem_get_of_le List.Func.mem_get_of_le
--/
-#print List.Func.mem_get_of_ne_zero /-
theorem mem_get_of_ne_zero : ∀ {n : ℕ} {as : List α}, get n as ≠ default → get n as ∈ as
| _, [], h1 => by exfalso; apply h1; rw [get_nil]
| 0, a :: as, h1 => Or.inl rfl
@@ -178,9 +151,7 @@ theorem mem_get_of_ne_zero : ∀ {n : ℕ} {as : List α}, get n as ≠ default
apply Or.inr (mem_get_of_ne_zero _)
apply h1
#align list.func.mem_get_of_ne_zero List.Func.mem_get_of_ne_zero
--/
-#print List.Func.get_set_eq_of_ne /-
theorem get_set_eq_of_ne {a : α} :
∀ {as : List α} (k : ℕ) (m : ℕ), m ≠ k → get m (as {k ↦ a}) = get m as
| as, 0, m, h1 => by cases m; contradiction; cases as <;> simp only [Set, get, get_nil]
@@ -196,9 +167,7 @@ theorem get_set_eq_of_ne {a : α} :
· apply get_set_eq_of_ne k m
intro hc; apply h1; simp [hc]
#align list.func.get_set_eq_of_ne List.Func.get_set_eq_of_ne
--/
-#print List.Func.get_map /-
theorem get_map {f : α → β} :
∀ {n : ℕ} {as : List α}, n < as.length → get n (as.map f) = f (get n as)
| _, [], h => by cases h
@@ -210,9 +179,7 @@ theorem get_map {f : α → β} :
apply h1
apply get_map h2
#align list.func.get_map List.Func.get_map
--/
-#print List.Func.get_map' /-
theorem get_map' {f : α → β} {n : ℕ} {as : List α} :
f default = default → get n (as.map f) = f (get n as) :=
by
@@ -222,9 +189,7 @@ theorem get_map' {f : α → β} {n : ℕ} {as : List α} :
rw [get_eq_default_of_le _ h2, get_eq_default_of_le, h1]
rw [length_map]; apply h2
#align list.func.get_map' List.Func.get_map'
--/
-#print List.Func.forall_val_of_forall_mem /-
theorem forall_val_of_forall_mem {as : List α} {p : α → Prop} :
p default → (∀ x ∈ as, p x) → ∀ n, p (get n as) :=
by
@@ -234,31 +199,21 @@ theorem forall_val_of_forall_mem {as : List α} {p : α → Prop} :
· rw [not_lt] at h3
rw [get_eq_default_of_le _ h3]; apply h1
#align list.func.forall_val_of_forall_mem List.Func.forall_val_of_forall_mem
--/
-#print List.Func.equiv_refl /-
-- equiv
theorem equiv_refl : Equiv as as := fun k => rfl
#align list.func.equiv_refl List.Func.equiv_refl
--/
-#print List.Func.equiv_symm /-
theorem equiv_symm : Equiv as1 as2 → Equiv as2 as1 := fun h1 k => (h1 k).symm
#align list.func.equiv_symm List.Func.equiv_symm
--/
-#print List.Func.equiv_trans /-
theorem equiv_trans : Equiv as1 as2 → Equiv as2 as3 → Equiv as1 as3 := fun h1 h2 k =>
Eq.trans (h1 k) (h2 k)
#align list.func.equiv_trans List.Func.equiv_trans
--/
-#print List.Func.equiv_of_eq /-
theorem equiv_of_eq : as1 = as2 → Equiv as1 as2 := by intro h1; rw [h1]; apply equiv_refl
#align list.func.equiv_of_eq List.Func.equiv_of_eq
--/
-#print List.Func.eq_of_equiv /-
theorem eq_of_equiv : ∀ {as1 as2 : List α}, as1.length = as2.length → Equiv as1 as2 → as1 = as2
| [], [], h1, h2 => rfl
| _ :: _, [], h1, h2 => by cases h1
@@ -270,7 +225,6 @@ theorem eq_of_equiv : ∀ {as1 as2 : List α}, as1.length = as2.length → Equiv
apply eq_of_equiv h3
intro m; apply h2 (m + 1)
#align list.func.eq_of_equiv List.Func.eq_of_equiv
--/
end Func
@@ -278,40 +232,31 @@ end Func
-- so we close and open the namespace
namespace Func
-#print List.Func.get_neg /-
-- neg
@[simp]
theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as := by
unfold neg; rw [@get_map' α α ⟨0⟩]; apply neg_zero
#align list.func.get_neg List.Func.get_neg
--/
-#print List.Func.length_neg /-
@[simp]
theorem length_neg [Neg α] (as : List α) : (neg as).length = as.length := by
simp only [neg, length_map]
#align list.func.length_neg List.Func.length_neg
--/
variable [Inhabited α] [Inhabited β]
-#print List.Func.nil_pointwise /-
-- pointwise
theorem nil_pointwise {f : α → β → γ} : ∀ bs : List β, pointwise f [] bs = bs.map (f default)
| [] => rfl
| b :: bs => by simp only [nil_pointwise bs, pointwise, eq_self_iff_true, and_self_iff, map]
#align list.func.nil_pointwise List.Func.nil_pointwise
--/
-#print List.Func.pointwise_nil /-
theorem pointwise_nil {f : α → β → γ} :
∀ as : List α, pointwise f as [] = as.map fun a => f a default
| [] => rfl
| a :: as => by simp only [pointwise_nil as, pointwise, eq_self_iff_true, and_self_iff, List.map]
#align list.func.pointwise_nil List.Func.pointwise_nil
--/
-#print List.Func.get_pointwise /-
theorem get_pointwise [Inhabited γ] {f : α → β → γ} (h1 : f default default = default) :
∀ (k : Nat) (as : List α) (bs : List β), get k (pointwise f as bs) = f (get k as) (get k bs)
| k, [], [] => by simp only [h1, get_nil, pointwise, get]
@@ -327,9 +272,7 @@ theorem get_pointwise [Inhabited γ] {f : α → β → γ} (h1 : f default defa
| 0, a :: as, b :: bs => by simp only [pointwise, get]
| k + 1, a :: as, b :: bs => by simp only [pointwise, get, get_pointwise k]
#align list.func.get_pointwise List.Func.get_pointwise
--/
-#print List.Func.length_pointwise /-
theorem length_pointwise {f : α → β → γ} :
∀ {as : List α} {bs : List β}, (pointwise f as bs).length = max as.length bs.length
| [], [] => rfl
@@ -339,30 +282,24 @@ theorem length_pointwise {f : α → β → γ} :
simp only [pointwise, length, length_map, max_eq_left (Nat.zero_le (length as + 1))]
| a :: as, b :: bs => by simp only [pointwise, length, Nat.succ_max_succ, @length_pointwise as bs]
#align list.func.length_pointwise List.Func.length_pointwise
--/
end Func
namespace Func
-#print List.Func.get_add /-
-- add
@[simp]
theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
@get α ⟨0⟩ k (add xs ys) = @get α ⟨0⟩ k xs + @get α ⟨0⟩ k ys := by apply get_pointwise;
apply zero_add
#align list.func.get_add List.Func.get_add
--/
-#print List.Func.length_add /-
@[simp]
theorem length_add {α : Type u} [Zero α] [Add α] {xs ys : List α} :
(add xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_add List.Func.length_add
--/
-#print List.Func.nil_add /-
@[simp]
theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
by
@@ -371,9 +308,7 @@ theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
congr with x
rw [zero_add, id]
#align list.func.nil_add List.Func.nil_add
--/
-#print List.Func.add_nil /-
@[simp]
theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
by
@@ -382,9 +317,7 @@ theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
congr with x
rw [add_zero, id]
#align list.func.add_nil List.Func.add_nil
--/
-#print List.Func.map_add_map /-
theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α} :
add (as.map f) (as.map g) = as.map fun x => f x + g x :=
by
@@ -400,26 +333,20 @@ theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α
repeat' rw [get_eq_default_of_le m] <;> try rw [length_map]; apply h
apply zero_add
#align list.func.map_add_map List.Func.map_add_map
--/
-#print List.Func.get_sub /-
-- sub
@[simp]
theorem get_sub {α : Type u} [AddGroup α] {k : ℕ} {xs ys : List α} :
@get α ⟨0⟩ k (sub xs ys) = @get α ⟨0⟩ k xs - @get α ⟨0⟩ k ys := by apply get_pointwise;
apply sub_zero
#align list.func.get_sub List.Func.get_sub
--/
-#print List.Func.length_sub /-
@[simp]
theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
(sub xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_sub List.Func.length_sub
--/
-#print List.Func.nil_sub /-
@[simp]
theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as :=
by
@@ -427,9 +354,7 @@ theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as
congr with x
rw [zero_sub]
#align list.func.nil_sub List.Func.nil_sub
--/
-#print List.Func.sub_nil /-
@[simp]
theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
by
@@ -438,7 +363,6 @@ theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
congr with x
rw [sub_zero, id]
#align list.func.sub_nil List.Func.sub_nil
--/
end Func
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -151,7 +151,7 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
| b :: as, h => by
- rw [mem_cons_iff] at h ; cases h
+ rw [mem_cons_iff] at h; cases h
· exists 0; intro d; apply h
· cases' eq_get_of_mem h with n h2
exists n + 1; apply h2
@@ -218,7 +218,7 @@ theorem get_map' {f : α → β} {n : ℕ} {as : List α} :
by
intro h1; by_cases h2 : n < as.length
· apply get_map h2
- · rw [not_lt] at h2
+ · rw [not_lt] at h2
rw [get_eq_default_of_le _ h2, get_eq_default_of_le, h1]
rw [length_map]; apply h2
#align list.func.get_map' List.Func.get_map'
@@ -231,7 +231,7 @@ theorem forall_val_of_forall_mem {as : List α} {p : α → Prop} :
intro h1 h2 n
by_cases h3 : n < as.length
· apply h2 _ (mem_get_of_le h3)
- · rw [not_lt] at h3
+ · rw [not_lt] at h3
rw [get_eq_default_of_le _ h3]; apply h1
#align list.func.forall_val_of_forall_mem List.Func.forall_val_of_forall_mem
-/
@@ -396,7 +396,7 @@ theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α
rw [get_add]
by_cases h : m < length as
· repeat' rw [@get_map α α ⟨0⟩ ⟨0⟩ _ _ _ h]
- rw [not_lt] at h
+ rw [not_lt] at h
repeat' rw [get_eq_default_of_le m] <;> try rw [length_map]; apply h
apply zero_add
#align list.func.map_add_map List.Func.map_add_map
mathlib commit https://github.com/leanprover-community/mathlib/commit/65a1391a0106c9204fe45bc73a039f056558cb83
@@ -118,7 +118,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
| 0, [] => rfl
| 0, a :: as => by rw [max_eq_left]; rfl; simp [Nat.le_add_right]
| m + 1, [] => by simp only [Set, Nat.zero_max, length, @length_set m]
- | m + 1, a :: as => by simp only [Set, Nat.max_succ_succ, length, @length_set m]
+ | m + 1, a :: as => by simp only [Set, Nat.succ_max_succ, length, @length_set m]
#align list.func.length_set List.Func.length_set
-/
@@ -337,7 +337,7 @@ theorem length_pointwise {f : α → β → γ} :
simp only [pointwise, length, length_map, max_eq_right (Nat.zero_le (length bs + 1))]
| a :: as, [] => by
simp only [pointwise, length, length_map, max_eq_left (Nat.zero_le (length as + 1))]
- | a :: as, b :: bs => by simp only [pointwise, length, Nat.max_succ_succ, @length_pointwise as bs]
+ | a :: as, b :: bs => by simp only [pointwise, length, Nat.succ_max_succ, @length_pointwise as bs]
#align list.func.length_pointwise List.Func.length_pointwise
-/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2019 Seul Baek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
-/
-import Mathbin.Data.Nat.Order.Basic
+import Data.Nat.Order.Basic
#align_import data.list.func from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2019 Seul Baek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
-
-! This file was ported from Lean 3 source module data.list.func
-! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.Nat.Order.Basic
+#align_import data.list.func from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
+
/-!
# Lists as Functions
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -69,7 +69,6 @@ def set (a : α) : List α → ℕ → List α
#align list.func.set List.Func.set
-/
--- mathport name: list.func.set
scoped notation as " {" m " ↦ " a "}" => List.Func.set a as m
#print List.Func.get /-
@@ -116,6 +115,7 @@ def sub {α : Type u} [Zero α] [Sub α] : List α → List α → List α :=
#align list.func.sub List.Func.sub
-/
+#print List.Func.length_set /-
-- set
theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.length (m + 1)
| 0, [] => rfl
@@ -123,6 +123,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
| m + 1, [] => by simp only [Set, Nat.zero_max, length, @length_set m]
| m + 1, a :: as => by simp only [Set, Nat.max_succ_succ, length, @length_set m]
#align list.func.length_set List.Func.length_set
+-/
#print List.Func.get_nil /-
@[simp]
@@ -149,6 +150,7 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
#align list.func.get_set List.Func.get_set
-/
+#print List.Func.eq_get_of_mem /-
theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
| b :: as, h => by
@@ -157,6 +159,7 @@ theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat,
· cases' eq_get_of_mem h with n h2
exists n + 1; apply h2
#align list.func.eq_get_of_mem List.Func.eq_get_of_mem
+-/
#print List.Func.mem_get_of_le /-
theorem mem_get_of_le : ∀ {n : ℕ} {as : List α}, n < as.length → get n as ∈ as
@@ -278,11 +281,13 @@ end Func
-- so we close and open the namespace
namespace Func
+#print List.Func.get_neg /-
-- neg
@[simp]
theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as := by
unfold neg; rw [@get_map' α α ⟨0⟩]; apply neg_zero
#align list.func.get_neg List.Func.get_neg
+-/
#print List.Func.length_neg /-
@[simp]
@@ -327,6 +332,7 @@ theorem get_pointwise [Inhabited γ] {f : α → β → γ} (h1 : f default defa
#align list.func.get_pointwise List.Func.get_pointwise
-/
+#print List.Func.length_pointwise /-
theorem length_pointwise {f : α → β → γ} :
∀ {as : List α} {bs : List β}, (pointwise f as bs).length = max as.length bs.length
| [], [] => rfl
@@ -336,24 +342,30 @@ theorem length_pointwise {f : α → β → γ} :
simp only [pointwise, length, length_map, max_eq_left (Nat.zero_le (length as + 1))]
| a :: as, b :: bs => by simp only [pointwise, length, Nat.max_succ_succ, @length_pointwise as bs]
#align list.func.length_pointwise List.Func.length_pointwise
+-/
end Func
namespace Func
+#print List.Func.get_add /-
-- add
@[simp]
theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
@get α ⟨0⟩ k (add xs ys) = @get α ⟨0⟩ k xs + @get α ⟨0⟩ k ys := by apply get_pointwise;
apply zero_add
#align list.func.get_add List.Func.get_add
+-/
+#print List.Func.length_add /-
@[simp]
theorem length_add {α : Type u} [Zero α] [Add α] {xs ys : List α} :
(add xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_add List.Func.length_add
+-/
+#print List.Func.nil_add /-
@[simp]
theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
by
@@ -362,7 +374,9 @@ theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
congr with x
rw [zero_add, id]
#align list.func.nil_add List.Func.nil_add
+-/
+#print List.Func.add_nil /-
@[simp]
theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
by
@@ -371,7 +385,9 @@ theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
congr with x
rw [add_zero, id]
#align list.func.add_nil List.Func.add_nil
+-/
+#print List.Func.map_add_map /-
theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α} :
add (as.map f) (as.map g) = as.map fun x => f x + g x :=
by
@@ -387,20 +403,26 @@ theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α
repeat' rw [get_eq_default_of_le m] <;> try rw [length_map]; apply h
apply zero_add
#align list.func.map_add_map List.Func.map_add_map
+-/
+#print List.Func.get_sub /-
-- sub
@[simp]
theorem get_sub {α : Type u} [AddGroup α] {k : ℕ} {xs ys : List α} :
@get α ⟨0⟩ k (sub xs ys) = @get α ⟨0⟩ k xs - @get α ⟨0⟩ k ys := by apply get_pointwise;
apply sub_zero
#align list.func.get_sub List.Func.get_sub
+-/
+#print List.Func.length_sub /-
@[simp]
theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
(sub xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_sub List.Func.length_sub
+-/
+#print List.Func.nil_sub /-
@[simp]
theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as :=
by
@@ -408,7 +430,9 @@ theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as
congr with x
rw [zero_sub]
#align list.func.nil_sub List.Func.nil_sub
+-/
+#print List.Func.sub_nil /-
@[simp]
theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
by
@@ -417,6 +441,7 @@ theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
congr with x
rw [sub_zero, id]
#align list.func.sub_nil List.Func.sub_nil
+-/
end Func
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -152,7 +152,7 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
| b :: as, h => by
- rw [mem_cons_iff] at h; cases h
+ rw [mem_cons_iff] at h ; cases h
· exists 0; intro d; apply h
· cases' eq_get_of_mem h with n h2
exists n + 1; apply h2
@@ -218,7 +218,7 @@ theorem get_map' {f : α → β} {n : ℕ} {as : List α} :
by
intro h1; by_cases h2 : n < as.length
· apply get_map h2
- · rw [not_lt] at h2
+ · rw [not_lt] at h2
rw [get_eq_default_of_le _ h2, get_eq_default_of_le, h1]
rw [length_map]; apply h2
#align list.func.get_map' List.Func.get_map'
@@ -231,7 +231,7 @@ theorem forall_val_of_forall_mem {as : List α} {p : α → Prop} :
intro h1 h2 n
by_cases h3 : n < as.length
· apply h2 _ (mem_get_of_le h3)
- · rw [not_lt] at h3
+ · rw [not_lt] at h3
rw [get_eq_default_of_le _ h3]; apply h1
#align list.func.forall_val_of_forall_mem List.Func.forall_val_of_forall_mem
-/
@@ -383,7 +383,7 @@ theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α
rw [get_add]
by_cases h : m < length as
· repeat' rw [@get_map α α ⟨0⟩ ⟨0⟩ _ _ _ h]
- rw [not_lt] at h
+ rw [not_lt] at h
repeat' rw [get_eq_default_of_le m] <;> try rw [length_map]; apply h
apply zero_add
#align list.func.map_add_map List.Func.map_add_map
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -149,16 +149,14 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
#align list.func.get_set List.Func.get_set
-/
-/- warning: list.func.eq_get_of_mem clashes with [anonymous] -> [anonymous]
-Case conversion may be inaccurate. Consider using '#align list.func.eq_get_of_mem [anonymous]ₓ'. -/
-theorem [anonymous] {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
+theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
| b :: as, h => by
rw [mem_cons_iff] at h; cases h
· exists 0; intro d; apply h
· cases' eq_get_of_mem h with n h2
exists n + 1; apply h2
-#align list.func.eq_get_of_mem [anonymous]
+#align list.func.eq_get_of_mem List.Func.eq_get_of_mem
#print List.Func.mem_get_of_le /-
theorem mem_get_of_le : ∀ {n : ℕ} {as : List α}, n < as.length → get n as ∈ as
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -116,12 +116,6 @@ def sub {α : Type u} [Zero α] [Sub α] : List α → List α → List α :=
#align list.func.sub List.Func.sub
-/
-/- warning: list.func.length_set -> List.Func.length_set is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {a : α} [_inst_1 : Inhabited.{succ u1} α] {m : Nat} {as : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.set.{u1} α _inst_1 a as m)) (LinearOrder.max.{0} Nat Nat.linearOrder (List.length.{u1} α as) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat Nat.hasAdd) m (OfNat.ofNat.{0} Nat 1 (OfNat.mk.{0} Nat 1 (One.one.{0} Nat Nat.hasOne)))))
-but is expected to have type
- forall {α : Type.{u1}} {a : α} [_inst_1 : Inhabited.{succ u1} α] {m : Nat} {as : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.set.{u1} α _inst_1 a as m)) (Max.max.{0} Nat Nat.instMaxNat (List.length.{u1} α as) (HAdd.hAdd.{0, 0, 0} Nat Nat Nat (instHAdd.{0} Nat instAddNat) m (OfNat.ofNat.{0} Nat 1 (instOfNatNat 1))))
-Case conversion may be inaccurate. Consider using '#align list.func.length_set List.Func.length_setₓ'. -/
-- set
theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.length (m + 1)
| 0, [] => rfl
@@ -156,11 +150,6 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
-/
/- warning: list.func.eq_get_of_mem clashes with [anonymous] -> [anonymous]
-warning: list.func.eq_get_of_mem -> [anonymous] is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u}} [_inst_1 : Inhabited.{succ u} α] {a : α} {as : List.{u} α}, (Membership.Mem.{u, u} α (List.{u} α) (List.hasMem.{u} α) a as) -> (Exists.{1} Nat (fun (n : Nat) => α -> (Eq.{succ u} α a (List.Func.get.{u} α _inst_1 n as))))
-but is expected to have type
- forall {α : Type.{u}} {_inst_1 : Type.{v}}, (Nat -> α -> _inst_1) -> Nat -> (List.{u} α) -> (List.{v} _inst_1)
Case conversion may be inaccurate. Consider using '#align list.func.eq_get_of_mem [anonymous]ₓ'. -/
theorem [anonymous] {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀ d : α, a = get n as
| [], h => by cases h
@@ -291,12 +280,6 @@ end Func
-- so we close and open the namespace
namespace Func
-/- warning: list.func.get_neg -> List.Func.get_neg is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] {k : Nat} {as : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))))))) k (List.Func.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as)) (Neg.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))))))) k as))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] {k : Nat} {as : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1))))))) k (List.Func.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) as)) (Neg.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1))))))) k as))
-Case conversion may be inaccurate. Consider using '#align list.func.get_neg List.Func.get_negₓ'. -/
-- neg
@[simp]
theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as := by
@@ -346,12 +329,6 @@ theorem get_pointwise [Inhabited γ] {f : α → β → γ} (h1 : f default defa
#align list.func.get_pointwise List.Func.get_pointwise
-/
-/- warning: list.func.length_pointwise -> List.Func.length_pointwise is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : Inhabited.{succ u1} α] [_inst_2 : Inhabited.{succ u2} β] {f : α -> β -> γ} {as : List.{u1} α} {bs : List.{u2} β}, Eq.{1} Nat (List.length.{u3} γ (List.Func.pointwise.{u1, u2, u3} α β γ _inst_1 _inst_2 f as bs)) (LinearOrder.max.{0} Nat Nat.linearOrder (List.length.{u1} α as) (List.length.{u2} β bs))
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} {γ : Type.{u3}} [_inst_1 : Inhabited.{succ u1} α] [_inst_2 : Inhabited.{succ u2} β] {f : α -> β -> γ} {as : List.{u1} α} {bs : List.{u2} β}, Eq.{1} Nat (List.length.{u3} γ (List.Func.pointwise.{u1, u2, u3} α β γ _inst_1 _inst_2 f as bs)) (Max.max.{0} Nat Nat.instMaxNat (List.length.{u1} α as) (List.length.{u2} β bs))
-Case conversion may be inaccurate. Consider using '#align list.func.length_pointwise List.Func.length_pointwiseₓ'. -/
theorem length_pointwise {f : α → β → γ} :
∀ {as : List α} {bs : List β}, (pointwise f as bs).length = max as.length bs.length
| [], [] => rfl
@@ -366,12 +343,6 @@ end Func
namespace Func
-/- warning: list.func.get_add -> List.Func.get_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] {k : Nat} {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)))))) k (List.Func.add.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) xs ys)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1))) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)))))) k xs) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)))))) k ys))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] {k : Nat} {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (AddMonoid.toZero.{u1} α _inst_1)))) k (List.Func.add.{u1} α (AddMonoid.toZero.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) xs ys)) (HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1))) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (AddMonoid.toZero.{u1} α _inst_1)))) k xs) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (AddMonoid.toZero.{u1} α _inst_1)))) k ys))
-Case conversion may be inaccurate. Consider using '#align list.func.get_add List.Func.get_addₓ'. -/
-- add
@[simp]
theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
@@ -379,24 +350,12 @@ theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
apply zero_add
#align list.func.get_add List.Func.get_add
-/- warning: list.func.length_add -> List.Func.length_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Zero.{u1} α] [_inst_2 : Add.{u1} α] {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.add.{u1} α _inst_1 _inst_2 xs ys)) (LinearOrder.max.{0} Nat Nat.linearOrder (List.length.{u1} α xs) (List.length.{u1} α ys))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Zero.{u1} α] [_inst_2 : Add.{u1} α] {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.add.{u1} α _inst_1 _inst_2 xs ys)) (Max.max.{0} Nat Nat.instMaxNat (List.length.{u1} α xs) (List.length.{u1} α ys))
-Case conversion may be inaccurate. Consider using '#align list.func.length_add List.Func.length_addₓ'. -/
@[simp]
theorem length_add {α : Type u} [Zero α] [Add α] {xs ys : List α} :
(add xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_add List.Func.length_add
-/- warning: list.func.nil_add -> List.Func.nil_add is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (List.nil.{u1} α) as) as
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddMonoid.toZero.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (List.nil.{u1} α) as) as
-Case conversion may be inaccurate. Consider using '#align list.func.nil_add List.Func.nil_addₓ'. -/
@[simp]
theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
by
@@ -406,12 +365,6 @@ theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
rw [zero_add, id]
#align list.func.nil_add List.Func.nil_add
-/- warning: list.func.add_nil -> List.Func.add_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) as (List.nil.{u1} α)) as
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddMonoid.toZero.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) as (List.nil.{u1} α)) as
-Case conversion may be inaccurate. Consider using '#align list.func.add_nil List.Func.add_nilₓ'. -/
@[simp]
theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
by
@@ -421,12 +374,6 @@ theorem add_nil {α : Type u} [AddMonoid α] (as : List α) : add as [] = as :=
rw [add_zero, id]
#align list.func.add_nil List.Func.add_nil
-/- warning: list.func.map_add_map -> List.Func.map_add_map is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (f : α -> α) (g : α -> α) {as : List.{u1} α}, Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (List.map.{u1, u1} α α f as) (List.map.{u1, u1} α α g as)) (List.map.{u1, u1} α α (fun (x : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toHasAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1))) (f x) (g x)) as)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddMonoid.{u1} α] (f : α -> α) (g : α -> α) {as : List.{u1} α}, Eq.{succ u1} (List.{u1} α) (List.Func.add.{u1} α (AddMonoid.toZero.{u1} α _inst_1) (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1)) (List.map.{u1, u1} α α f as) (List.map.{u1, u1} α α g as)) (List.map.{u1, u1} α α (fun (x : α) => HAdd.hAdd.{u1, u1, u1} α α α (instHAdd.{u1} α (AddZeroClass.toAdd.{u1} α (AddMonoid.toAddZeroClass.{u1} α _inst_1))) (f x) (g x)) as)
-Case conversion may be inaccurate. Consider using '#align list.func.map_add_map List.Func.map_add_mapₓ'. -/
theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α} :
add (as.map f) (as.map g) = as.map fun x => f x + g x :=
by
@@ -443,12 +390,6 @@ theorem map_add_map {α : Type u} [AddMonoid α] (f g : α → α) {as : List α
apply zero_add
#align list.func.map_add_map List.Func.map_add_map
-/- warning: list.func.get_sub -> List.Func.get_sub is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] {k : Nat} {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))))))) k (List.Func.sub.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) xs ys)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))))))) k xs) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (OfNat.mk.{u1} α 0 (Zero.zero.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))))))) k ys))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] {k : Nat} {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{succ u1} α (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1))))))) k (List.Func.sub.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) xs ys)) (HSub.hSub.{u1, u1, u1} α α α (instHSub.{u1} α (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1))) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1))))))) k xs) (List.Func.get.{u1} α (Inhabited.mk.{succ u1} α (OfNat.ofNat.{u1} α 0 (Zero.toOfNat0.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1))))))) k ys))
-Case conversion may be inaccurate. Consider using '#align list.func.get_sub List.Func.get_subₓ'. -/
-- sub
@[simp]
theorem get_sub {α : Type u} [AddGroup α] {k : ℕ} {xs ys : List α} :
@@ -456,24 +397,12 @@ theorem get_sub {α : Type u} [AddGroup α] {k : ℕ} {xs ys : List α} :
apply sub_zero
#align list.func.get_sub List.Func.get_sub
-/- warning: list.func.length_sub -> List.Func.length_sub is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Zero.{u1} α] [_inst_2 : Sub.{u1} α] {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.sub.{u1} α _inst_1 _inst_2 xs ys)) (LinearOrder.max.{0} Nat Nat.linearOrder (List.length.{u1} α xs) (List.length.{u1} α ys))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Zero.{u1} α] [_inst_2 : Sub.{u1} α] {xs : List.{u1} α} {ys : List.{u1} α}, Eq.{1} Nat (List.length.{u1} α (List.Func.sub.{u1} α _inst_1 _inst_2 xs ys)) (Max.max.{0} Nat Nat.instMaxNat (List.length.{u1} α xs) (List.length.{u1} α ys))
-Case conversion may be inaccurate. Consider using '#align list.func.length_sub List.Func.length_subₓ'. -/
@[simp]
theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
(sub xs ys).length = max xs.length ys.length :=
@length_pointwise α α α ⟨0⟩ ⟨0⟩ _ _ _
#align list.func.length_sub List.Func.length_sub
-/- warning: list.func.nil_sub -> List.Func.nil_sub is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) (List.nil.{u1} α) as) (List.Func.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) (List.nil.{u1} α) as) (List.Func.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) as)
-Case conversion may be inaccurate. Consider using '#align list.func.nil_sub List.Func.nil_subₓ'. -/
@[simp]
theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as :=
by
@@ -482,12 +411,6 @@ theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as
rw [zero_sub]
#align list.func.nil_sub List.Func.nil_sub
-/- warning: list.func.sub_nil -> List.Func.sub_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as (List.nil.{u1} α)) as
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as (List.nil.{u1} α)) as
-Case conversion may be inaccurate. Consider using '#align list.func.sub_nil List.Func.sub_nilₓ'. -/
@[simp]
theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
by
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -125,10 +125,7 @@ Case conversion may be inaccurate. Consider using '#align list.func.length_set L
-- set
theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.length (m + 1)
| 0, [] => rfl
- | 0, a :: as => by
- rw [max_eq_left]
- rfl
- simp [Nat.le_add_right]
+ | 0, a :: as => by rw [max_eq_left]; rfl; simp [Nat.le_add_right]
| m + 1, [] => by simp only [Set, Nat.zero_max, length, @length_set m]
| m + 1, a :: as => by simp only [Set, Nat.max_succ_succ, length, @length_set m]
#align list.func.length_set List.Func.length_set
@@ -169,12 +166,9 @@ theorem [anonymous] {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, ∀
| [], h => by cases h
| b :: as, h => by
rw [mem_cons_iff] at h; cases h
- · exists 0
- intro d
- apply h
+ · exists 0; intro d; apply h
· cases' eq_get_of_mem h with n h2
- exists n + 1
- apply h2
+ exists n + 1; apply h2
#align list.func.eq_get_of_mem [anonymous]
#print List.Func.mem_get_of_le /-
@@ -202,25 +196,18 @@ theorem mem_get_of_ne_zero : ∀ {n : ℕ} {as : List α}, get n as ≠ default
#print List.Func.get_set_eq_of_ne /-
theorem get_set_eq_of_ne {a : α} :
∀ {as : List α} (k : ℕ) (m : ℕ), m ≠ k → get m (as {k ↦ a}) = get m as
- | as, 0, m, h1 => by
- cases m
- contradiction
- cases as <;> simp only [Set, get, get_nil]
+ | as, 0, m, h1 => by cases m; contradiction; cases as <;> simp only [Set, get, get_nil]
| as, k + 1, m, h1 => by
cases as <;> cases m
simp only [Set, get]
· have h3 : get m (nil {k ↦ a}) = default :=
by
rw [get_set_eq_of_ne k m, get_nil]
- intro hc
- apply h1
- simp [hc]
+ intro hc; apply h1; simp [hc]
apply h3
simp only [Set, get]
· apply get_set_eq_of_ne k m
- intro hc
- apply h1
- simp [hc]
+ intro hc; apply h1; simp [hc]
#align list.func.get_set_eq_of_ne List.Func.get_set_eq_of_ne
-/
@@ -246,8 +233,7 @@ theorem get_map' {f : α → β} {n : ℕ} {as : List α} :
· apply get_map h2
· rw [not_lt] at h2
rw [get_eq_default_of_le _ h2, get_eq_default_of_le, h1]
- rw [length_map]
- apply h2
+ rw [length_map]; apply h2
#align list.func.get_map' List.Func.get_map'
-/
@@ -259,8 +245,7 @@ theorem forall_val_of_forall_mem {as : List α} {p : α → Prop} :
by_cases h3 : n < as.length
· apply h2 _ (mem_get_of_le h3)
· rw [not_lt] at h3
- rw [get_eq_default_of_le _ h3]
- apply h1
+ rw [get_eq_default_of_le _ h3]; apply h1
#align list.func.forall_val_of_forall_mem List.Func.forall_val_of_forall_mem
-/
@@ -296,8 +281,7 @@ theorem eq_of_equiv : ∀ {as1 as2 : List α}, as1.length = as2.length → Equiv
· apply h2 0
have h3 : as1.length = as2.length := by simpa [add_left_inj, add_comm, length] using h1
apply eq_of_equiv h3
- intro m
- apply h2 (m + 1)
+ intro m; apply h2 (m + 1)
#align list.func.eq_of_equiv List.Func.eq_of_equiv
-/
@@ -315,11 +299,8 @@ but is expected to have type
Case conversion may be inaccurate. Consider using '#align list.func.get_neg List.Func.get_negₓ'. -/
-- neg
@[simp]
-theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as :=
- by
- unfold neg
- rw [@get_map' α α ⟨0⟩]
- apply neg_zero
+theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as := by
+ unfold neg; rw [@get_map' α α ⟨0⟩]; apply neg_zero
#align list.func.get_neg List.Func.get_neg
#print List.Func.length_neg /-
@@ -394,9 +375,7 @@ Case conversion may be inaccurate. Consider using '#align list.func.get_add List
-- add
@[simp]
theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
- @get α ⟨0⟩ k (add xs ys) = @get α ⟨0⟩ k xs + @get α ⟨0⟩ k ys :=
- by
- apply get_pointwise
+ @get α ⟨0⟩ k (add xs ys) = @get α ⟨0⟩ k xs + @get α ⟨0⟩ k ys := by apply get_pointwise;
apply zero_add
#align list.func.get_add List.Func.get_add
@@ -473,9 +452,7 @@ Case conversion may be inaccurate. Consider using '#align list.func.get_sub List
-- sub
@[simp]
theorem get_sub {α : Type u} [AddGroup α] {k : ℕ} {xs ys : List α} :
- @get α ⟨0⟩ k (sub xs ys) = @get α ⟨0⟩ k xs - @get α ⟨0⟩ k ys :=
- by
- apply get_pointwise
+ @get α ⟨0⟩ k (sub xs ys) = @get α ⟨0⟩ k xs - @get α ⟨0⟩ k ys := by apply get_pointwise;
apply sub_zero
#align list.func.get_sub List.Func.get_sub
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce86f4e05e9a9b8da5e316b22c76ce76440c56a1
@@ -493,9 +493,9 @@ theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
/- warning: list.func.nil_sub -> List.Func.nil_sub is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u_1}} [_inst_1 : AddGroup.{u_1} α] (as : List.{u_1} α), Eq.{succ u_1} (List.{u_1} α) (List.Func.sub.{u_1} α (AddZeroClass.toHasZero.{u_1} α (AddMonoid.toAddZeroClass.{u_1} α (SubNegMonoid.toAddMonoid.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)))) (SubNegMonoid.toHasSub.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) (List.nil.{u_1} α) as) (List.Func.neg.{u_1} α (SubNegMonoid.toHasNeg.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) as)
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) (List.nil.{u1} α) as) (List.Func.neg.{u1} α (SubNegMonoid.toHasNeg.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as)
but is expected to have type
- forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (NegZeroClass.toZero.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) (SubNegMonoid.toSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) (List.nil.{0} α) as) (List.Func.neg.{0} α (NegZeroClass.toNeg.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) as)
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) (List.nil.{u1} α) as) (List.Func.neg.{u1} α (NegZeroClass.toNeg.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) as)
Case conversion may be inaccurate. Consider using '#align list.func.nil_sub List.Func.nil_subₓ'. -/
@[simp]
theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as :=
@@ -507,9 +507,9 @@ theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as
/- warning: list.func.sub_nil -> List.Func.sub_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u_1}} [_inst_1 : AddGroup.{u_1} α] (as : List.{u_1} α), Eq.{succ u_1} (List.{u_1} α) (List.Func.sub.{u_1} α (AddZeroClass.toHasZero.{u_1} α (AddMonoid.toAddZeroClass.{u_1} α (SubNegMonoid.toAddMonoid.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)))) (SubNegMonoid.toHasSub.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) as (List.nil.{u_1} α)) as
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (AddZeroClass.toHasZero.{u1} α (AddMonoid.toAddZeroClass.{u1} α (SubNegMonoid.toAddMonoid.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)))) (SubNegMonoid.toHasSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as (List.nil.{u1} α)) as
but is expected to have type
- forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (NegZeroClass.toZero.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) (SubNegMonoid.toSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) as (List.nil.{0} α)) as
+ forall {α : Type.{u1}} [_inst_1 : AddGroup.{u1} α] (as : List.{u1} α), Eq.{succ u1} (List.{u1} α) (List.Func.sub.{u1} α (NegZeroClass.toZero.{u1} α (SubNegZeroMonoid.toNegZeroClass.{u1} α (SubtractionMonoid.toSubNegZeroMonoid.{u1} α (AddGroup.toSubtractionMonoid.{u1} α _inst_1)))) (SubNegMonoid.toSub.{u1} α (AddGroup.toSubNegMonoid.{u1} α _inst_1)) as (List.nil.{u1} α)) as
Case conversion may be inaccurate. Consider using '#align list.func.sub_nil List.Func.sub_nilₓ'. -/
@[simp]
theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/d11893b411025250c8e61ff2f12ccbd7ee35ab15
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
! This file was ported from Lean 3 source module data.list.func
-! leanprover-community/mathlib commit c3291da49cfa65f0d43b094750541c0731edc932
+! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -493,12 +493,12 @@ theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
/- warning: list.func.nil_sub -> List.Func.nil_sub is a dubious translation:
lean 3 declaration is
- forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (AddZeroClass.toHasZero.{0} α (AddMonoid.toAddZeroClass.{0} α (SubNegMonoid.toAddMonoid.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)))) (SubNegMonoid.toHasSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) (List.nil.{0} α) as) (List.Func.neg.{0} α (SubNegMonoid.toHasNeg.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) as)
+ forall {α : Type.{u_1}} [_inst_1 : AddGroup.{u_1} α] (as : List.{u_1} α), Eq.{succ u_1} (List.{u_1} α) (List.Func.sub.{u_1} α (AddZeroClass.toHasZero.{u_1} α (AddMonoid.toAddZeroClass.{u_1} α (SubNegMonoid.toAddMonoid.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)))) (SubNegMonoid.toHasSub.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) (List.nil.{u_1} α) as) (List.Func.neg.{u_1} α (SubNegMonoid.toHasNeg.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) as)
but is expected to have type
forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (NegZeroClass.toZero.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) (SubNegMonoid.toSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) (List.nil.{0} α) as) (List.Func.neg.{0} α (NegZeroClass.toNeg.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) as)
Case conversion may be inaccurate. Consider using '#align list.func.nil_sub List.Func.nil_subₓ'. -/
@[simp]
-theorem nil_sub {α : Type} [AddGroup α] (as : List α) : sub [] as = neg as :=
+theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as :=
by
rw [sub, nil_pointwise]
congr with x
@@ -507,12 +507,12 @@ theorem nil_sub {α : Type} [AddGroup α] (as : List α) : sub [] as = neg as :=
/- warning: list.func.sub_nil -> List.Func.sub_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (AddZeroClass.toHasZero.{0} α (AddMonoid.toAddZeroClass.{0} α (SubNegMonoid.toAddMonoid.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)))) (SubNegMonoid.toHasSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) as (List.nil.{0} α)) as
+ forall {α : Type.{u_1}} [_inst_1 : AddGroup.{u_1} α] (as : List.{u_1} α), Eq.{succ u_1} (List.{u_1} α) (List.Func.sub.{u_1} α (AddZeroClass.toHasZero.{u_1} α (AddMonoid.toAddZeroClass.{u_1} α (SubNegMonoid.toAddMonoid.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)))) (SubNegMonoid.toHasSub.{u_1} α (AddGroup.toSubNegMonoid.{u_1} α _inst_1)) as (List.nil.{u_1} α)) as
but is expected to have type
forall {α : Type} [_inst_1 : AddGroup.{0} α] (as : List.{0} α), Eq.{1} (List.{0} α) (List.Func.sub.{0} α (NegZeroClass.toZero.{0} α (SubNegZeroMonoid.toNegZeroClass.{0} α (SubtractionMonoid.toSubNegZeroMonoid.{0} α (AddGroup.toSubtractionMonoid.{0} α _inst_1)))) (SubNegMonoid.toSub.{0} α (AddGroup.toSubNegMonoid.{0} α _inst_1)) as (List.nil.{0} α)) as
Case conversion may be inaccurate. Consider using '#align list.func.sub_nil List.Func.sub_nilₓ'. -/
@[simp]
-theorem sub_nil {α : Type} [AddGroup α] (as : List α) : sub as [] = as :=
+theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as :=
by
rw [sub, pointwise_nil]
apply Eq.trans _ (map_id as)
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
Empty lines were removed by executing the following Python script twice
import os
import re
# Loop through each file in the repository
for dir_path, dirs, files in os.walk('.'):
for filename in files:
if filename.endswith('.lean'):
file_path = os.path.join(dir_path, filename)
# Open the file and read its contents
with open(file_path, 'r') as file:
content = file.read()
# Use a regular expression to replace sequences of "variable" lines separated by empty lines
# with sequences without empty lines
modified_content = re.sub(r'(variable.*\n)\n(variable(?! .* in))', r'\1\2', content)
# Write the modified content back to the file
with open(file_path, 'w') as file:
file.write(modified_content)
@@ -38,7 +38,6 @@ namespace List
namespace Func
variable {a : α}
-
variable {as as1 as2 as3 : List α}
/-- Elementwise negation of a list -/
@@ -103,8 +103,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
| 0, a :: as => by
rw [max_eq_left]
· rfl
- · simp [Nat.le_add_right]
- exact Nat.succ_le_succ (Nat.zero_le _)
+ · simpa [Nat.le_add_right] using Nat.succ_le_succ (Nat.zero_le _)
| m + 1, [] => by
simp [set, length, @length_set m, Nat.zero_max]
| m + 1, _ :: as => by
Homogenises porting notes via capitalisation and addition of whitespace.
It makes the following changes:
@@ -170,7 +170,7 @@ theorem get_set_eq_of_ne {a : α} :
contradiction
cases as <;> simp only [set, get, get_nil]
| as, k + 1, m, h1 => by
- -- porting note: I somewhat rearranged the case split
+ -- Porting note: I somewhat rearranged the case split
match as, m with
| as, 0 => cases as <;> simp only [set, get]
| [], m+1 =>
@@ -254,7 +254,7 @@ namespace Func
@[simp]
theorem get_neg [AddGroup α] {k : ℕ} {as : List α} : @get α ⟨0⟩ k (neg as) = -@get α ⟨0⟩ k as := by
unfold neg
- rw [@get_map' α α ⟨0⟩ ⟨0⟩] -- porting note: had to add a `⟨0⟩` b/c of instance troubles
+ rw [@get_map' α α ⟨0⟩ ⟨0⟩] -- Porting note: had to add a `⟨0⟩` b/c of instance troubles
apply neg_zero
#align list.func.get_neg List.Func.get_neg
@@ -330,7 +330,7 @@ theorem nil_add {α : Type u} [AddMonoid α] (as : List α) : add [] as = as :=
apply Eq.trans _ (map_id as)
congr with x
exact zero_add x
- -- porting note: instead of `zero_add`, it was the commented `rw` below
+ -- Porting note: instead of `zero_add`, it was the commented `rw` below
-- (similarly at other places below)
--rw [zero_add, id]
#align list.func.nil_add List.Func.nil_add
@@ -111,7 +111,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
simp [set, length, @length_set m, Nat.succ_max_succ]
#align list.func.length_set List.Func.length_set
--- Porting note: @[simp] has been removed since `#lint` says this is
+-- Porting note (#11119): @[simp] has been removed since `#lint` says this is
theorem get_nil {k : ℕ} : (get k [] : α) = default := by cases k <;> rfl
#align list.func.get_nil List.Func.get_nil
In this pull request, I have systematically eliminated the leading whitespace preceding the colon (:
) within all unlabelled or unclassified porting notes. This adjustment facilitates a more efficient review process for the remaining notes by ensuring no entries are overlooked due to formatting inconsistencies.
@@ -111,7 +111,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
simp [set, length, @length_set m, Nat.succ_max_succ]
#align list.func.length_set List.Func.length_set
--- porting note : @[simp] has been removed since `#lint` says this is
+-- Porting note: @[simp] has been removed since `#lint` says this is
theorem get_nil {k : ℕ} : (get k [] : α) = default := by cases k <;> rfl
#align list.func.get_nil List.Func.get_nil
@@ -133,19 +133,19 @@ theorem get_set {a : α} : ∀ {k : ℕ} {as : List α}, get k (as {k ↦ a}) =
theorem eq_get_of_mem {a : α} : ∀ {as : List α}, a ∈ as → ∃ n : Nat, a = get n as
| [], h => by cases h
| b :: as, h => by
- rw [mem_cons] at h -- porting note : `mem_cons_iff` is now named `mem_cons`
+ rw [mem_cons] at h -- Porting note: `mem_cons_iff` is now named `mem_cons`
cases h with
| inl h => exact ⟨0, h⟩
| inr h =>
rcases eq_get_of_mem h with ⟨n, h⟩
exact ⟨n + 1, h⟩
#noalign list.func.eq_get_of_mem
--- porting note : the signature has been changed to correct what was presumably a bug,
+-- Porting note: the signature has been changed to correct what was presumably a bug,
-- hence the #noalign
theorem mem_get_of_le : ∀ {n : ℕ} {as : List α}, n < as.length → get n as ∈ as
| _, [], h1 => by cases h1
- -- porting note : needed to add to `rw [mem_cons] here` in the two cases below
+ -- Porting note: needed to add to `rw [mem_cons] here` in the two cases below
-- and in other lemmas (presumably because previously lean could see through the def of `mem` ?)
| 0, a :: as, _ => by rw [mem_cons]; exact Or.inl rfl
| n + 1, a :: as, h1 => by
@@ -311,7 +311,7 @@ namespace Func
-- add
@[simp]
theorem get_add {α : Type u} [AddMonoid α] {k : ℕ} {xs ys : List α} :
- -- porting note : `@` and `⟨0⟩`s added b/c of instance troubles
+ -- Porting note: `@` and `⟨0⟩`s added b/c of instance troubles
-- (similarly at other places below)
@get α ⟨0⟩ k (add xs ys) = @get α ⟨0⟩ k xs + @get α ⟨0⟩ k ys := by
apply @get_pointwise _ _ _ ⟨0⟩ ⟨0⟩ ⟨0⟩
cases x with | ...
instead of cases x; case => ...
(#9321)
This converts usages of the pattern
cases h
case inl h' => ...
case inr h' => ...
which derive from mathported code, to the "structured cases
" syntax:
cases h with
| inl h' => ...
| inr h' => ...
The case where the subgoals are handled with ·
instead of case
is more contentious (and much more numerous) so I left those alone. This pattern also appears with cases'
, induction
, induction'
, and rcases
. Furthermore, there is a similar transformation for by_cases
:
by_cases h : cond
case pos => ...
case neg => ...
is replaced by:
if h : cond then
...
else
...
Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -170,20 +170,16 @@ theorem get_set_eq_of_ne {a : α} :
contradiction
cases as <;> simp only [set, get, get_nil]
| as, k + 1, m, h1 => by
- -- porting note : I somewhat rearranged the case split
- cases as <;> cases m
- case nil =>
- simp only [set, get]
- case nil m =>
- have h3 : get m (nil {k ↦ a}) = default := by
- rw [get_set_eq_of_ne k m, get_nil]
- intro hc
- apply h1
- simp [hc]
- apply h3
- case zero =>
- simp only [set, get]
- case _ _ m =>
+ -- porting note: I somewhat rearranged the case split
+ match as, m with
+ | as, 0 => cases as <;> simp only [set, get]
+ | [], m+1 =>
+ show get m (nil {k ↦ a}) = default
+ rw [get_set_eq_of_ne k m, get_nil]
+ intro hc
+ apply h1
+ simp [hc]
+ | _::_, m+1 =>
apply get_set_eq_of_ne k m
intro hc
apply h1
bump/v4.5.0
branch. (#9188)
This PR:
v4.5.0-rc1
v4.5.0-rc1
bump/v4.5.0
branch
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com>
@@ -106,7 +106,6 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
· simp [Nat.le_add_right]
exact Nat.succ_le_succ (Nat.zero_le _)
| m + 1, [] => by
- have := @length_set m []
simp [set, length, @length_set m, Nat.zero_max]
| m + 1, _ :: as => by
simp [set, length, @length_set m, Nat.succ_max_succ]
@@ -109,7 +109,7 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
have := @length_set m []
simp [set, length, @length_set m, Nat.zero_max]
| m + 1, _ :: as => by
- simp [set, length, @length_set m, Nat.max_succ_succ]
+ simp [set, length, @length_set m, Nat.succ_max_succ]
#align list.func.length_set List.Func.length_set
-- porting note : @[simp] has been removed since `#lint` says this is
@@ -306,7 +306,7 @@ theorem length_pointwise {f : α → β → γ} :
| _ :: as, [] => by
simp only [pointwise, length, length_map, max_eq_left (Nat.zero_le (length as + 1))]
| _ :: as, _ :: bs => by
- simp only [pointwise, length, Nat.max_succ_succ, @length_pointwise _ as bs]
+ simp only [pointwise, length, Nat.succ_max_succ, @length_pointwise _ as bs]
#align list.func.length_pointwise List.Func.length_pointwise
end Func
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -378,14 +378,14 @@ theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
#align list.func.length_sub List.Func.length_sub
@[simp]
-theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as := by
+theorem nil_sub {α : Type*} [AddGroup α] (as : List α) : sub [] as = neg as := by
rw [sub, @nil_pointwise _ _ _ ⟨0⟩ ⟨0⟩]
congr with x
exact zero_sub x
#align list.func.nil_sub List.Func.nil_sub
@[simp]
-theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as := by
+theorem sub_nil {α : Type*} [AddGroup α] (as : List α) : sub as [] = as := by
rw [sub, @pointwise_nil _ _ _ ⟨0⟩ ⟨0⟩]
apply Eq.trans _ (map_id as)
congr with x
@@ -2,14 +2,11 @@
Copyright (c) 2019 Seul Baek. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
-
-! This file was ported from Lean 3 source module data.list.func
-! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.Nat.Order.Basic
+#align_import data.list.func from "leanprover-community/mathlib"@"d11893b411025250c8e61ff2f12ccbd7ee35ab15"
+
/-!
# Lists as Functions
fix-comments.py
on all files.@@ -254,7 +254,7 @@ theorem eq_of_equiv : ∀ {as1 as2 : List α}, as1.length = as2.length → Equiv
end Func
--- We want to drop the `inhabited` instances for a moment,
+-- We want to drop the `Inhabited` instances for a moment,
-- so we close and open the namespace
namespace Func
This PR fixes two things:
align
statements for definitions and theorems and instances that are separated by two newlines from the relevant declaration (s/\n\n#align/\n#align
). This is often seen in the mathport output after ending calc
blocks.#align
statements. (This was needed for a script I wrote for #3630.)@@ -113,7 +113,6 @@ theorem length_set : ∀ {m : ℕ} {as : List α}, as {m ↦ a}.length = max as.
simp [set, length, @length_set m, Nat.zero_max]
| m + 1, _ :: as => by
simp [set, length, @length_set m, Nat.max_succ_succ]
-
#align list.func.length_set List.Func.length_set
-- porting note : @[simp] has been removed since `#lint` says this is
I forgot to add the SHAs in #3121 when forward-porting leanprover-community/mathlib#18644
@@ -4,7 +4,7 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Seul Baek
! This file was ported from Lean 3 source module data.list.func
-! leanprover-community/mathlib commit aba57d4d3dae35460225919dcd82fe91355162f9
+! leanprover-community/mathlib commit d11893b411025250c8e61ff2f12ccbd7ee35ab15
! Please do not edit these lines, except to modify the commit id
! if you have ported upstream changes.
-/
@@ -382,14 +382,14 @@ theorem length_sub [Zero α] [Sub α] {xs ys : List α} :
#align list.func.length_sub List.Func.length_sub
@[simp]
-theorem nil_sub {α : Type} [AddGroup α] (as : List α) : sub [] as = neg as := by
+theorem nil_sub {α : Type _} [AddGroup α] (as : List α) : sub [] as = neg as := by
rw [sub, @nil_pointwise _ _ _ ⟨0⟩ ⟨0⟩]
congr with x
exact zero_sub x
#align list.func.nil_sub List.Func.nil_sub
@[simp]
-theorem sub_nil {α : Type} [AddGroup α] (as : List α) : sub as [] = as := by
+theorem sub_nil {α : Type _} [AddGroup α] (as : List α) : sub as [] = as := by
rw [sub, @pointwise_nil _ _ _ ⟨0⟩ ⟨0⟩]
apply Eq.trans _ (map_id as)
congr with x