data.list.min_max
⟷
Mathlib.Data.List.MinMax
The following section lists changes to this file in mathlib3 and mathlib4 that occured after the initial port. Most recent changes are shown first. Hovering over a commit will show all commits associated with the same mathlib3 commit.
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(no changes)
(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
@@ -78,14 +78,14 @@ theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
induction' l using List.reverseRecOn with tl a ih
· exact fun _ _ _ h => absurd h <| not_mem_nil _
intro b m o hb ho
- rw [foldl_append, foldl_cons, foldl_nil, arg_aux] at ho
+ rw [foldl_append, foldl_cons, foldl_nil, arg_aux] at ho
cases' hf : foldl (arg_aux r) o tl with c
- · rw [hf] at ho
- rw [foldl_arg_aux_eq_none] at hf
+ · rw [hf] at ho
+ rw [foldl_arg_aux_eq_none] at hf
simp_all [hf.1, hf.2, hr₀ _]
- rw [hf, Option.mem_def] at ho
- dsimp only at ho
- split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
+ rw [hf, Option.mem_def] at ho
+ dsimp only at ho
+ split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
· exact fun hba => ih h hf (hr₁ hba hac)
· simp_all [hr₀ _]
· exact ih h hf
@@ -253,11 +253,11 @@ theorem index_of_argmax :
by
simp only [index_of_cons, argmax_cons, Option.mem_def] at hm ⊢
cases h : argmax f tl
- · rw [h] at hm
+ · rw [h] at hm
simp_all
- rw [h] at hm
- dsimp only at hm
- obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
+ rw [h] at hm
+ dsimp only at hm
+ obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
· cases not_le_of_lt ‹_› ‹_›
· rw [if_neg, if_neg]
exact Nat.succ_le_succ (index_of_argmax h ha ham)
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce64cd319bb6b3e82f31c2d38e79080d377be451
@@ -3,7 +3,7 @@ Copyright (c) 2019 Minchao Wu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Minchao Wu, Chris Hughes, Mantas Bakšys
-/
-import Mathbin.Data.List.Basic
+import Data.List.Basic
#align_import data.list.min_max from "leanprover-community/mathlib"@"00f4ab49e7d5139216e0b3daad15fffa504897ab"
mathlib commit https://github.com/leanprover-community/mathlib/commit/ffde2d8a6e689149e44fd95fa862c23a57f8c780
@@ -455,10 +455,10 @@ theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l :=
#align list.le_maximum_of_mem' List.le_maximum_of_mem'
-/
-#print List.le_minimum_of_mem' /-
-theorem le_minimum_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
+#print List.minimum_le_of_mem' /-
+theorem minimum_le_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
@le_maximum_of_mem' αᵒᵈ _ _ _ ha
-#align list.le_minimum_of_mem' List.le_minimum_of_mem'
+#align list.le_minimum_of_mem' List.minimum_le_of_mem'
-/
#print List.minimum_concat /-
mathlib commit https://github.com/leanprover-community/mathlib/commit/8ea5598db6caeddde6cb734aa179cc2408dbd345
@@ -2,14 +2,11 @@
Copyright (c) 2019 Minchao Wu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Minchao Wu, Chris Hughes, Mantas Bakšys
-
-! This file was ported from Lean 3 source module data.list.min_max
-! leanprover-community/mathlib commit 00f4ab49e7d5139216e0b3daad15fffa504897ab
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathbin.Data.List.Basic
+#align_import data.list.min_max from "leanprover-community/mathlib"@"00f4ab49e7d5139216e0b3daad15fffa504897ab"
+
/-!
# Minimum and maximum of lists
mathlib commit https://github.com/leanprover-community/mathlib/commit/9fb8964792b4237dac6200193a0d533f1b3f7423
@@ -120,63 +120,87 @@ def argmin (f : α → β) (l : List α) :=
#align list.argmin List.argmin
-/
+#print List.argmax_nil /-
@[simp]
theorem argmax_nil (f : α → β) : argmax f [] = none :=
rfl
#align list.argmax_nil List.argmax_nil
+-/
+#print List.argmin_nil /-
@[simp]
theorem argmin_nil (f : α → β) : argmin f [] = none :=
rfl
#align list.argmin_nil List.argmin_nil
+-/
+#print List.argmax_singleton /-
@[simp]
theorem argmax_singleton {f : α → β} {a : α} : argmax f [a] = a :=
rfl
#align list.argmax_singleton List.argmax_singleton
+-/
+#print List.argmin_singleton /-
@[simp]
theorem argmin_singleton {f : α → β} {a : α} : argmin f [a] = a :=
rfl
#align list.argmin_singleton List.argmin_singleton
+-/
+#print List.not_lt_of_mem_argmax /-
theorem not_lt_of_mem_argmax : a ∈ l → m ∈ argmax f l → ¬f m < f a :=
not_of_mem_foldl_argAux _ (fun _ => lt_irrefl _) fun _ _ _ => gt_trans
#align list.not_lt_of_mem_argmax List.not_lt_of_mem_argmax
+-/
+#print List.not_lt_of_mem_argmin /-
theorem not_lt_of_mem_argmin : a ∈ l → m ∈ argmin f l → ¬f a < f m :=
not_of_mem_foldl_argAux _ (fun _ => lt_irrefl _) fun _ _ _ => lt_trans
#align list.not_lt_of_mem_argmin List.not_lt_of_mem_argmin
+-/
+#print List.argmax_concat /-
theorem argmax_concat (f : α → β) (a : α) (l : List α) :
argmax f (l ++ [a]) =
Option.casesOn (argmax f l) (some a) fun c => if f c < f a then some a else some c :=
by rw [argmax, argmax] <;> simp [arg_aux]
#align list.argmax_concat List.argmax_concat
+-/
+#print List.argmin_concat /-
theorem argmin_concat (f : α → β) (a : α) (l : List α) :
argmin f (l ++ [a]) =
Option.casesOn (argmin f l) (some a) fun c => if f a < f c then some a else some c :=
@argmax_concat _ βᵒᵈ _ _ _ _ _
#align list.argmin_concat List.argmin_concat
+-/
+#print List.argmax_mem /-
theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
| [], m => by simp
| hd :: tl, m => by simpa [argmax, arg_aux] using foldl_arg_aux_mem _ tl hd m
#align list.argmax_mem List.argmax_mem
+-/
+#print List.argmin_mem /-
theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
@argmax_mem _ βᵒᵈ _ _ _
#align list.argmin_mem List.argmin_mem
+-/
+#print List.argmax_eq_none /-
@[simp]
theorem argmax_eq_none : l.argmax f = none ↔ l = [] := by simp [argmax]
#align list.argmax_eq_none List.argmax_eq_none
+-/
+#print List.argmin_eq_none /-
@[simp]
theorem argmin_eq_none : l.argmin f = none ↔ l = [] :=
@argmax_eq_none _ βᵒᵈ _ _ _ _
#align list.argmin_eq_none List.argmin_eq_none
+-/
end Preorder
@@ -184,14 +208,19 @@ section LinearOrder
variable [LinearOrder β] {f : α → β} {l : List α} {o : Option α} {a m : α}
+#print List.le_of_mem_argmax /-
theorem le_of_mem_argmax : a ∈ l → m ∈ argmax f l → f a ≤ f m := fun ha hm =>
le_of_not_lt <| not_lt_of_mem_argmax ha hm
#align list.le_of_mem_argmax List.le_of_mem_argmax
+-/
+#print List.le_of_mem_argmin /-
theorem le_of_mem_argmin : a ∈ l → m ∈ argmin f l → f m ≤ f a :=
@le_of_mem_argmax _ βᵒᵈ _ _ _ _ _
#align list.le_of_mem_argmin List.le_of_mem_argmin
+-/
+#print List.argmax_cons /-
theorem argmax_cons (f : α → β) (a : α) (l : List α) :
argmax f (a :: l) =
Option.casesOn (argmax f l) (some a) fun c => if f a < f c then some c else some a :=
@@ -207,15 +236,19 @@ theorem argmax_cons (f : α → β) (a : α) (l : List α) :
· exact absurd (lt_trans ‹f a < f m› ‹_›) ‹_›
· cases (‹f a < f tl›.lt_or_lt _).elim ‹_› ‹_›
#align list.argmax_cons List.argmax_cons
+-/
+#print List.argmin_cons /-
theorem argmin_cons (f : α → β) (a : α) (l : List α) :
argmin f (a :: l) =
Option.casesOn (argmin f l) (some a) fun c => if f c < f a then some c else some a :=
by convert @argmax_cons _ βᵒᵈ _ _ _ _
#align list.argmin_cons List.argmin_cons
+-/
variable [DecidableEq α]
+#print List.index_of_argmax /-
theorem index_of_argmax :
∀ {l : List α} {m : α}, m ∈ argmax f l → ∀ {a}, a ∈ l → f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a
| [], m, _, _, _, _ => by simp
@@ -236,13 +269,17 @@ theorem index_of_argmax :
· rw [if_pos rfl]
exact bot_le
#align list.index_of_argmax List.index_of_argmax
+-/
+#print List.index_of_argmin /-
theorem index_of_argmin :
∀ {l : List α} {m : α},
m ∈ argmin f l → ∀ {a}, a ∈ l → f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
@index_of_argmax _ βᵒᵈ _ _ _
#align list.index_of_argmin List.index_of_argmin
+-/
+#print List.mem_argmax_iff /-
theorem mem_argmax_iff :
m ∈ argmax f l ↔
m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a :=
@@ -256,24 +293,31 @@ theorem mem_argmax_iff :
(index_of_argmax harg hml (ham _ (argmax_mem harg)))
rw [(index_of_inj hml (argmax_mem harg)).1 this, Option.mem_def]⟩
#align list.mem_argmax_iff List.mem_argmax_iff
+-/
+#print List.argmax_eq_some_iff /-
theorem argmax_eq_some_iff :
argmax f l = some m ↔
m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a :=
mem_argmax_iff
#align list.argmax_eq_some_iff List.argmax_eq_some_iff
+-/
+#print List.mem_argmin_iff /-
theorem mem_argmin_iff :
m ∈ argmin f l ↔
m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
@mem_argmax_iff _ βᵒᵈ _ _ _ _ _
#align list.mem_argmin_iff List.mem_argmin_iff
+-/
+#print List.argmin_eq_some_iff /-
theorem argmin_eq_some_iff :
argmin f l = some m ↔
m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
mem_argmin_iff
#align list.argmin_eq_some_iff List.argmin_eq_some_iff
+-/
end LinearOrder
@@ -470,6 +514,7 @@ section OrderBot
variable [OrderBot α] {l : List α}
+#print List.foldr_max_of_ne_nil /-
@[simp]
theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
by
@@ -480,14 +525,18 @@ theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
· simp [h]
· simp [IH h]
#align list.foldr_max_of_ne_nil List.foldr_max_of_ne_nil
+-/
+#print List.max_le_of_forall_le /-
theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) : l.foldr max ⊥ ≤ a :=
by
induction' l with y l IH
· simp
· simpa [h y (mem_cons_self _ _)] using IH fun x hx => h x <| mem_cons_of_mem _ hx
#align list.max_le_of_forall_le List.max_le_of_forall_le
+-/
+#print List.le_max_of_le /-
theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a ≤ l.foldr max ⊥ :=
by
induction' l with y l IH
@@ -497,6 +546,7 @@ theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a
· exact le_max_of_le_left h
· exact le_max_of_le_right (IH hl)
#align list.le_max_of_le List.le_max_of_le
+-/
end OrderBot
@@ -504,18 +554,24 @@ section OrderTop
variable [OrderTop α] {l : List α}
+#print List.foldr_min_of_ne_nil /-
@[simp]
theorem foldr_min_of_ne_nil (h : l ≠ []) : ↑(l.foldr min ⊤) = l.minimum :=
@foldr_max_of_ne_nil αᵒᵈ _ _ _ h
#align list.foldr_min_of_ne_nil List.foldr_min_of_ne_nil
+-/
+#print List.le_min_of_forall_le /-
theorem le_min_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, a ≤ x) : a ≤ l.foldr min ⊤ :=
@max_le_of_forall_le αᵒᵈ _ _ _ _ h
#align list.le_min_of_forall_le List.le_min_of_forall_le
+-/
+#print List.min_le_of_le /-
theorem min_le_of_le (l : List α) (a : α) {x : α} (hx : x ∈ l) (h : x ≤ a) : l.foldr min ⊤ ≤ a :=
@le_max_of_le αᵒᵈ _ _ _ _ _ hx h
#align list.min_le_of_le List.min_le_of_le
+-/
end OrderTop
mathlib commit https://github.com/leanprover-community/mathlib/commit/5f25c089cb34db4db112556f23c50d12da81b297
@@ -88,7 +88,7 @@ theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
simp_all [hf.1, hf.2, hr₀ _]
rw [hf, Option.mem_def] at ho
dsimp only at ho
- split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
+ split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
· exact fun hba => ih h hf (hr₁ hba hac)
· simp_all [hr₀ _]
· exact ih h hf
@@ -211,7 +211,7 @@ theorem argmax_cons (f : α → β) (a : α) (l : List α) :
theorem argmin_cons (f : α → β) (a : α) (l : List α) :
argmin f (a :: l) =
Option.casesOn (argmin f l) (some a) fun c => if f c < f a then some c else some a :=
- by convert@argmax_cons _ βᵒᵈ _ _ _ _
+ by convert @argmax_cons _ βᵒᵈ _ _ _ _
#align list.argmin_cons List.argmin_cons
variable [DecidableEq α]
@@ -227,7 +227,7 @@ theorem index_of_argmax :
simp_all
rw [h] at hm
dsimp only at hm
- obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
+ obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
· cases not_le_of_lt ‹_› ‹_›
· rw [if_neg, if_neg]
exact Nat.succ_le_succ (index_of_argmax h ha ham)
mathlib commit https://github.com/leanprover-community/mathlib/commit/cca40788df1b8755d5baf17ab2f27dacc2e17acb
@@ -81,14 +81,14 @@ theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
induction' l using List.reverseRecOn with tl a ih
· exact fun _ _ _ h => absurd h <| not_mem_nil _
intro b m o hb ho
- rw [foldl_append, foldl_cons, foldl_nil, arg_aux] at ho
+ rw [foldl_append, foldl_cons, foldl_nil, arg_aux] at ho
cases' hf : foldl (arg_aux r) o tl with c
- · rw [hf] at ho
- rw [foldl_arg_aux_eq_none] at hf
+ · rw [hf] at ho
+ rw [foldl_arg_aux_eq_none] at hf
simp_all [hf.1, hf.2, hr₀ _]
- rw [hf, Option.mem_def] at ho
- dsimp only at ho
- split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
+ rw [hf, Option.mem_def] at ho
+ dsimp only at ho
+ split_ifs at ho with hac hac <;> cases' mem_append.1 hb with h h <;> subst ho
· exact fun hba => ih h hf (hr₁ hba hac)
· simp_all [hr₀ _]
· exact ih h hf
@@ -221,13 +221,13 @@ theorem index_of_argmax :
| [], m, _, _, _, _ => by simp
| hd :: tl, m, hm, a, ha, ham =>
by
- simp only [index_of_cons, argmax_cons, Option.mem_def] at hm⊢
+ simp only [index_of_cons, argmax_cons, Option.mem_def] at hm ⊢
cases h : argmax f tl
- · rw [h] at hm
+ · rw [h] at hm
simp_all
- rw [h] at hm
- dsimp only at hm
- obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
+ rw [h] at hm
+ dsimp only at hm
+ obtain rfl | ha := ha <;> split_ifs at hm <;> subst hm
· cases not_le_of_lt ‹_› ‹_›
· rw [if_neg, if_neg]
exact Nat.succ_le_succ (index_of_argmax h ha ham)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -102,19 +102,23 @@ section Preorder
variable [Preorder β] [@DecidableRel β (· < ·)] {f : α → β} {l : List α} {o : Option α} {a m : α}
+#print List.argmax /-
/-- `argmax f l` returns `some a`, where `f a` is maximal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f a < f b`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmax f []` = none`. -/
def argmax (f : α → β) (l : List α) : Option α :=
l.foldl (argAux fun b c => f c < f b) none
#align list.argmax List.argmax
+-/
+#print List.argmin /-
/-- `argmin f l` returns `some a`, where `f a` is minimal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f b < f a`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmin f []` = none`. -/
def argmin (f : α → β) (l : List α) :=
l.foldl (argAux fun b c => f b < f c) none
#align list.argmin List.argmin
+-/
@[simp]
theorem argmax_nil (f : α → β) : argmax f [] = none :=
@@ -279,74 +283,102 @@ section Preorder
variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
+#print List.maximum /-
/-- `maximum l` returns an `with_bot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
def maximum (l : List α) : WithBot α :=
argmax id l
#align list.maximum List.maximum
+-/
+#print List.minimum /-
/-- `minimum l` returns an `with_top α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
def minimum (l : List α) : WithTop α :=
argmin id l
#align list.minimum List.minimum
+-/
+#print List.maximum_nil /-
@[simp]
theorem maximum_nil : maximum ([] : List α) = ⊥ :=
rfl
#align list.maximum_nil List.maximum_nil
+-/
+#print List.minimum_nil /-
@[simp]
theorem minimum_nil : minimum ([] : List α) = ⊤ :=
rfl
#align list.minimum_nil List.minimum_nil
+-/
+#print List.maximum_singleton /-
@[simp]
theorem maximum_singleton (a : α) : maximum [a] = a :=
rfl
#align list.maximum_singleton List.maximum_singleton
+-/
+#print List.minimum_singleton /-
@[simp]
theorem minimum_singleton (a : α) : minimum [a] = a :=
rfl
#align list.minimum_singleton List.minimum_singleton
+-/
+#print List.maximum_mem /-
theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m ∈ l :=
argmax_mem
#align list.maximum_mem List.maximum_mem
+-/
+#print List.minimum_mem /-
theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m ∈ l :=
argmin_mem
#align list.minimum_mem List.minimum_mem
+-/
+#print List.maximum_eq_none /-
@[simp]
theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] :=
argmax_eq_none
#align list.maximum_eq_none List.maximum_eq_none
+-/
+#print List.minimum_eq_none /-
@[simp]
theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] :=
argmin_eq_none
#align list.minimum_eq_none List.minimum_eq_none
+-/
+#print List.not_lt_maximum_of_mem /-
theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m < a :=
not_lt_of_mem_argmax
#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_mem
+-/
+#print List.minimum_not_lt_of_mem /-
theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a < m :=
not_lt_of_mem_argmin
#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_mem
+-/
+#print List.not_lt_maximum_of_mem' /-
theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :=
by
cases h : l.maximum
· simp_all
· simp_rw [WithBot.some_eq_coe, WithBot.coe_lt_coe, not_lt_maximum_of_mem ha h, not_false_iff]
#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'
+-/
+#print List.not_lt_minimum_of_mem' /-
theorem not_lt_minimum_of_mem' (ha : a ∈ l) : ¬(a : WithTop α) < minimum l :=
@not_lt_maximum_of_mem' αᵒᵈ _ _ _ _ ha
#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'
+-/
end Preorder
@@ -376,13 +408,17 @@ theorem minimum_le_of_mem : a ∈ l → (minimum l : WithTop α) = m → m ≤ a
#align list.minimum_le_of_mem List.minimum_le_of_mem
-/
+#print List.le_maximum_of_mem' /-
theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l :=
le_of_not_lt <| not_lt_maximum_of_mem' ha
#align list.le_maximum_of_mem' List.le_maximum_of_mem'
+-/
+#print List.le_minimum_of_mem' /-
theorem le_minimum_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
@le_maximum_of_mem' αᵒᵈ _ _ _ ha
#align list.le_minimum_of_mem' List.le_minimum_of_mem'
+-/
#print List.minimum_concat /-
theorem minimum_concat (a : α) (l : List α) : minimum (l ++ [a]) = min (minimum l) a :=
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -102,12 +102,6 @@ section Preorder
variable [Preorder β] [@DecidableRel β (· < ·)] {f : α → β} {l : List α} {o : Option α} {a m : α}
-/- warning: list.argmax -> List.argmax is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.814 : β) (x._@.Mathlib.Data.List.MinMax._hyg.816 : β) => LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.814 x._@.Mathlib.Data.List.MinMax._hyg.816)], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.argmax List.argmaxₓ'. -/
/-- `argmax f l` returns `some a`, where `f a` is maximal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f a < f b`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmax f []` = none`. -/
@@ -115,12 +109,6 @@ def argmax (f : α → β) (l : List α) : Option α :=
l.foldl (argAux fun b c => f c < f b) none
#align list.argmax List.argmax
-/- warning: list.argmin -> List.argmin is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.871 : β) (x._@.Mathlib.Data.List.MinMax._hyg.873 : β) => LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.871 x._@.Mathlib.Data.List.MinMax._hyg.873)], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.argmin List.argminₓ'. -/
/-- `argmin f l` returns `some a`, where `f a` is minimal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f b < f a`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmin f []` = none`. -/
@@ -128,131 +116,59 @@ def argmin (f : α → β) (l : List α) :=
l.foldl (argAux fun b c => f b < f c) none
#align list.argmin List.argmin
-/- warning: list.argmax_nil -> List.argmax_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.927 : β) (x._@.Mathlib.Data.List.MinMax._hyg.929 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.927 x._@.Mathlib.Data.List.MinMax._hyg.929)] (f : α -> β), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u2} α)) (Option.none.{u2} α)
-Case conversion may be inaccurate. Consider using '#align list.argmax_nil List.argmax_nilₓ'. -/
@[simp]
theorem argmax_nil (f : α → β) : argmax f [] = none :=
rfl
#align list.argmax_nil List.argmax_nil
-/- warning: list.argmin_nil -> List.argmin_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.974 : β) (x._@.Mathlib.Data.List.MinMax._hyg.976 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.974 x._@.Mathlib.Data.List.MinMax._hyg.976)] (f : α -> β), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u2} α)) (Option.none.{u2} α)
-Case conversion may be inaccurate. Consider using '#align list.argmin_nil List.argmin_nilₓ'. -/
@[simp]
theorem argmin_nil (f : α → β) : argmin f [] = none :=
rfl
#align list.argmin_nil List.argmin_nil
-/- warning: list.argmax_singleton -> List.argmax_singleton is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1021 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1023 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1021 x._@.Mathlib.Data.List.MinMax._hyg.1023)] {f : α -> β} {a : α}, Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u2} α a (List.nil.{u2} α))) (Option.some.{u2} α a)
-Case conversion may be inaccurate. Consider using '#align list.argmax_singleton List.argmax_singletonₓ'. -/
@[simp]
theorem argmax_singleton {f : α → β} {a : α} : argmax f [a] = a :=
rfl
#align list.argmax_singleton List.argmax_singleton
-/- warning: list.argmin_singleton -> List.argmin_singleton is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1071 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1073 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1071 x._@.Mathlib.Data.List.MinMax._hyg.1073)] {f : α -> β} {a : α}, Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u2} α a (List.nil.{u2} α))) (Option.some.{u2} α a)
-Case conversion may be inaccurate. Consider using '#align list.argmin_singleton List.argmin_singletonₓ'. -/
@[simp]
theorem argmin_singleton {f : α → β} {a : α} : argmin f [a] = a :=
rfl
#align list.argmin_singleton List.argmin_singleton
-/- warning: list.not_lt_of_mem_argmax -> List.not_lt_of_mem_argmax is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f m) (f a)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1121 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1123 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1121 x._@.Mathlib.Data.List.MinMax._hyg.1123)] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f m) (f a)))
-Case conversion may be inaccurate. Consider using '#align list.not_lt_of_mem_argmax List.not_lt_of_mem_argmaxₓ'. -/
theorem not_lt_of_mem_argmax : a ∈ l → m ∈ argmax f l → ¬f m < f a :=
not_of_mem_foldl_argAux _ (fun _ => lt_irrefl _) fun _ _ _ => gt_trans
#align list.not_lt_of_mem_argmax List.not_lt_of_mem_argmax
-/- warning: list.not_lt_of_mem_argmin -> List.not_lt_of_mem_argmin is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f a) (f m)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1209 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1211 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1209 x._@.Mathlib.Data.List.MinMax._hyg.1211)] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f a) (f m)))
-Case conversion may be inaccurate. Consider using '#align list.not_lt_of_mem_argmin List.not_lt_of_mem_argminₓ'. -/
theorem not_lt_of_mem_argmin : a ∈ l → m ∈ argmin f l → ¬f a < f m :=
not_of_mem_foldl_argAux _ (fun _ => lt_irrefl _) fun _ _ _ => lt_trans
#align list.not_lt_of_mem_argmin List.not_lt_of_mem_argmin
-/- warning: list.argmax_concat -> List.argmax_concat is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f c) (f a)) (_inst_2 (f c) (f a)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1297 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1299 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1297 x._@.Mathlib.Data.List.MinMax._hyg.1299)] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (HAppend.hAppend.{u2, u2, u2} (List.{u2} α) (List.{u2} α) (List.{u2} α) (instHAppend.{u2} (List.{u2} α) (List.instAppendList.{u2} α)) l (List.cons.{u2} α a (List.nil.{u2} α)))) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f c) (f a)) (_inst_2 (f c) (f a)) (Option.some.{u2} α a) (Option.some.{u2} α c)))
-Case conversion may be inaccurate. Consider using '#align list.argmax_concat List.argmax_concatₓ'. -/
theorem argmax_concat (f : α → β) (a : α) (l : List α) :
argmax f (l ++ [a]) =
Option.casesOn (argmax f l) (some a) fun c => if f c < f a then some a else some c :=
by rw [argmax, argmax] <;> simp [arg_aux]
#align list.argmax_concat List.argmax_concat
-/- warning: list.argmin_concat -> List.argmin_concat is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f a) (f c)) (_inst_2 (f a) (f c)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1419 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1421 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1419 x._@.Mathlib.Data.List.MinMax._hyg.1421)] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (HAppend.hAppend.{u2, u2, u2} (List.{u2} α) (List.{u2} α) (List.{u2} α) (instHAppend.{u2} (List.{u2} α) (List.instAppendList.{u2} α)) l (List.cons.{u2} α a (List.nil.{u2} α)))) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f a) (f c)) (_inst_2 (f a) (f c)) (Option.some.{u2} α a) (Option.some.{u2} α c)))
-Case conversion may be inaccurate. Consider using '#align list.argmin_concat List.argmin_concatₓ'. -/
theorem argmin_concat (f : α → β) (a : α) (l : List α) :
argmin f (l ++ [a]) =
Option.casesOn (argmin f l) (some a) fun c => if f a < f c then some a else some c :=
@argmax_concat _ βᵒᵈ _ _ _ _ _
#align list.argmin_concat List.argmin_concat
-/- warning: list.argmax_mem -> List.argmax_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1516 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1518 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1516 x._@.Mathlib.Data.List.MinMax._hyg.1518)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
-Case conversion may be inaccurate. Consider using '#align list.argmax_mem List.argmax_memₓ'. -/
theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
| [], m => by simp
| hd :: tl, m => by simpa [argmax, arg_aux] using foldl_arg_aux_mem _ tl hd m
#align list.argmax_mem List.argmax_mem
-/- warning: list.argmin_mem -> List.argmin_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1630 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1632 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1630 x._@.Mathlib.Data.List.MinMax._hyg.1632)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
-Case conversion may be inaccurate. Consider using '#align list.argmin_mem List.argmin_memₓ'. -/
theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
@argmax_mem _ βᵒᵈ _ _ _
#align list.argmin_mem List.argmin_mem
-/- warning: list.argmax_eq_none -> List.argmax_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1689 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1691 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1689 x._@.Mathlib.Data.List.MinMax._hyg.1691)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
-Case conversion may be inaccurate. Consider using '#align list.argmax_eq_none List.argmax_eq_noneₓ'. -/
@[simp]
theorem argmax_eq_none : l.argmax f = none ↔ l = [] := by simp [argmax]
#align list.argmax_eq_none List.argmax_eq_none
-/- warning: list.argmin_eq_none -> List.argmin_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1742 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1744 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1742 x._@.Mathlib.Data.List.MinMax._hyg.1744)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
-Case conversion may be inaccurate. Consider using '#align list.argmin_eq_none List.argmin_eq_noneₓ'. -/
@[simp]
theorem argmin_eq_none : l.argmin f = none ↔ l = [] :=
@argmax_eq_none _ βᵒᵈ _ _ _ _
@@ -264,32 +180,14 @@ section LinearOrder
variable [LinearOrder β] {f : α → β} {l : List α} {o : Option α} {a m : α}
-/- warning: list.le_of_mem_argmax -> List.le_of_mem_argmax is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))
-Case conversion may be inaccurate. Consider using '#align list.le_of_mem_argmax List.le_of_mem_argmaxₓ'. -/
theorem le_of_mem_argmax : a ∈ l → m ∈ argmax f l → f a ≤ f m := fun ha hm =>
le_of_not_lt <| not_lt_of_mem_argmax ha hm
#align list.le_of_mem_argmax List.le_of_mem_argmax
-/- warning: list.le_of_mem_argmin -> List.le_of_mem_argmin is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))
-Case conversion may be inaccurate. Consider using '#align list.le_of_mem_argmin List.le_of_mem_argminₓ'. -/
theorem le_of_mem_argmin : a ∈ l → m ∈ argmin f l → f m ≤ f a :=
@le_of_mem_argmax _ βᵒᵈ _ _ _ _ _
#align list.le_of_mem_argmin List.le_of_mem_argmin
-/- warning: list.argmax_cons -> List.argmax_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f c)) (LT.lt.decidable.{u2} β _inst_1 (f a) (f c)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f (List.cons.{u2} α a l)) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f c)) (instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 (f a) (f c)) (Option.some.{u2} α c) (Option.some.{u2} α a)))
-Case conversion may be inaccurate. Consider using '#align list.argmax_cons List.argmax_consₓ'. -/
theorem argmax_cons (f : α → β) (a : α) (l : List α) :
argmax f (a :: l) =
Option.casesOn (argmax f l) (some a) fun c => if f a < f c then some c else some a :=
@@ -306,12 +204,6 @@ theorem argmax_cons (f : α → β) (a : α) (l : List α) :
· cases (‹f a < f tl›.lt_or_lt _).elim ‹_› ‹_›
#align list.argmax_cons List.argmax_cons
-/- warning: list.argmin_cons -> List.argmin_cons is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f c) (f a)) (LT.lt.decidable.{u2} β _inst_1 (f c) (f a)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f (List.cons.{u2} α a l)) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f c) (f a)) (instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 (f c) (f a)) (Option.some.{u2} α c) (Option.some.{u2} α a)))
-Case conversion may be inaccurate. Consider using '#align list.argmin_cons List.argmin_consₓ'. -/
theorem argmin_cons (f : α → β) (a : α) (l : List α) :
argmin f (a :: l) =
Option.casesOn (argmin f l) (some a) fun c => if f c < f a then some c else some a :=
@@ -320,12 +212,6 @@ theorem argmin_cons (f : α → β) (a : α) (l : List α) :
variable [DecidableEq α]
-/- warning: list.index_of_argmax -> List.index_of_argmax is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u2} α] {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))
-Case conversion may be inaccurate. Consider using '#align list.index_of_argmax List.index_of_argmaxₓ'. -/
theorem index_of_argmax :
∀ {l : List α} {m : α}, m ∈ argmax f l → ∀ {a}, a ∈ l → f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a
| [], m, _, _, _, _ => by simp
@@ -347,24 +233,12 @@ theorem index_of_argmax :
exact bot_le
#align list.index_of_argmax List.index_of_argmax
-/- warning: list.index_of_argmin -> List.index_of_argmin is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u2} α] {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))
-Case conversion may be inaccurate. Consider using '#align list.index_of_argmin List.index_of_argminₓ'. -/
theorem index_of_argmin :
∀ {l : List α} {m : α},
m ∈ argmin f l → ∀ {a}, a ∈ l → f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
@index_of_argmax _ βᵒᵈ _ _ _
#align list.index_of_argmin List.index_of_argmin
-/- warning: list.mem_argmax_iff -> List.mem_argmax_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
-Case conversion may be inaccurate. Consider using '#align list.mem_argmax_iff List.mem_argmax_iffₓ'. -/
theorem mem_argmax_iff :
m ∈ argmax f l ↔
m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a :=
@@ -379,36 +253,18 @@ theorem mem_argmax_iff :
rw [(index_of_inj hml (argmax_mem harg)).1 this, Option.mem_def]⟩
#align list.mem_argmax_iff List.mem_argmax_iff
-/- warning: list.argmax_eq_some_iff -> List.argmax_eq_some_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α m)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
-Case conversion may be inaccurate. Consider using '#align list.argmax_eq_some_iff List.argmax_eq_some_iffₓ'. -/
theorem argmax_eq_some_iff :
argmax f l = some m ↔
m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOfₓ m ≤ l.indexOfₓ a :=
mem_argmax_iff
#align list.argmax_eq_some_iff List.argmax_eq_some_iff
-/- warning: list.mem_argmin_iff -> List.mem_argmin_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
-Case conversion may be inaccurate. Consider using '#align list.mem_argmin_iff List.mem_argmin_iffₓ'. -/
theorem mem_argmin_iff :
m ∈ argmin f l ↔
m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
@mem_argmax_iff _ βᵒᵈ _ _ _ _ _
#align list.mem_argmin_iff List.mem_argmin_iff
-/- warning: list.argmin_eq_some_iff -> List.argmin_eq_some_iff is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
-but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α m)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
-Case conversion may be inaccurate. Consider using '#align list.argmin_eq_some_iff List.argmin_eq_some_iffₓ'. -/
theorem argmin_eq_some_iff :
argmin f l = some m ↔
m ∈ l ∧ (∀ a ∈ l, f m ≤ f a) ∧ ∀ a ∈ l, f a ≤ f m → l.indexOfₓ m ≤ l.indexOfₓ a :=
@@ -423,142 +279,64 @@ section Preorder
variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
-/- warning: list.maximum -> List.maximum is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithBot.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3469 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3471 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3469 x._@.Mathlib.Data.List.MinMax._hyg.3471)], (List.{u1} α) -> (WithBot.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.maximum List.maximumₓ'. -/
/-- `maximum l` returns an `with_bot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
def maximum (l : List α) : WithBot α :=
argmax id l
#align list.maximum List.maximum
-/- warning: list.minimum -> List.minimum is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithTop.{u1} α)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3505 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3507 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3505 x._@.Mathlib.Data.List.MinMax._hyg.3507)], (List.{u1} α) -> (WithTop.{u1} α)
-Case conversion may be inaccurate. Consider using '#align list.minimum List.minimumₓ'. -/
/-- `minimum l` returns an `with_top α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
def minimum (l : List α) : WithTop α :=
argmin id l
#align list.minimum List.minimum
-/- warning: list.maximum_nil -> List.maximum_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3541 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3543 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3541 x._@.Mathlib.Data.List.MinMax._hyg.3543)], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))
-Case conversion may be inaccurate. Consider using '#align list.maximum_nil List.maximum_nilₓ'. -/
@[simp]
theorem maximum_nil : maximum ([] : List α) = ⊥ :=
rfl
#align list.maximum_nil List.maximum_nil
-/- warning: list.minimum_nil -> List.minimum_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3584 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3586 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3584 x._@.Mathlib.Data.List.MinMax._hyg.3586)], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))
-Case conversion may be inaccurate. Consider using '#align list.minimum_nil List.minimum_nilₓ'. -/
@[simp]
theorem minimum_nil : minimum ([] : List α) = ⊤ :=
rfl
#align list.minimum_nil List.minimum_nil
-/- warning: list.maximum_singleton -> List.maximum_singleton is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3627 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3629 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3627 x._@.Mathlib.Data.List.MinMax._hyg.3629)] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithBot.some.{u1} α a)
-Case conversion may be inaccurate. Consider using '#align list.maximum_singleton List.maximum_singletonₓ'. -/
@[simp]
theorem maximum_singleton (a : α) : maximum [a] = a :=
rfl
#align list.maximum_singleton List.maximum_singleton
-/- warning: list.minimum_singleton -> List.minimum_singleton is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3668 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3670 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3668 x._@.Mathlib.Data.List.MinMax._hyg.3670)] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithTop.some.{u1} α a)
-Case conversion may be inaccurate. Consider using '#align list.minimum_singleton List.minimum_singletonₓ'. -/
@[simp]
theorem minimum_singleton (a : α) : minimum [a] = a :=
rfl
#align list.minimum_singleton List.minimum_singleton
-/- warning: list.maximum_mem -> List.maximum_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3709 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3711 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3709 x._@.Mathlib.Data.List.MinMax._hyg.3711)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
-Case conversion may be inaccurate. Consider using '#align list.maximum_mem List.maximum_memₓ'. -/
theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m ∈ l :=
argmax_mem
#align list.maximum_mem List.maximum_mem
-/- warning: list.minimum_mem -> List.minimum_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3759 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3761 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3759 x._@.Mathlib.Data.List.MinMax._hyg.3761)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
-Case conversion may be inaccurate. Consider using '#align list.minimum_mem List.minimum_memₓ'. -/
theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m ∈ l :=
argmin_mem
#align list.minimum_mem List.minimum_mem
-/- warning: list.maximum_eq_none -> List.maximum_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3809 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3811 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3809 x._@.Mathlib.Data.List.MinMax._hyg.3811)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-Case conversion may be inaccurate. Consider using '#align list.maximum_eq_none List.maximum_eq_noneₓ'. -/
@[simp]
theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] :=
argmax_eq_none
#align list.maximum_eq_none List.maximum_eq_none
-/- warning: list.minimum_eq_none -> List.minimum_eq_none is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3855 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3857 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3855 x._@.Mathlib.Data.List.MinMax._hyg.3857)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
-Case conversion may be inaccurate. Consider using '#align list.minimum_eq_none List.minimum_eq_noneₓ'. -/
@[simp]
theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] :=
argmin_eq_none
#align list.minimum_eq_none List.minimum_eq_none
-/- warning: list.not_lt_maximum_of_mem -> List.not_lt_maximum_of_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) m a))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3901 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3903 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3901 x._@.Mathlib.Data.List.MinMax._hyg.3903)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) m a))
-Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_memₓ'. -/
theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m < a :=
not_lt_of_mem_argmax
#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_mem
-/- warning: list.minimum_not_lt_of_mem -> List.minimum_not_lt_of_mem is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) a m))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3957 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3959 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3957 x._@.Mathlib.Data.List.MinMax._hyg.3959)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) a m))
-Case conversion may be inaccurate. Consider using '#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_memₓ'. -/
theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a < m :=
not_lt_of_mem_argmin
#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_mem
-/- warning: list.not_lt_maximum_of_mem' -> List.not_lt_maximum_of_mem' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toHasLt.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4013 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4015 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4013 x._@.Mathlib.Data.List.MinMax._hyg.4015)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α a)))
-Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'ₓ'. -/
theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :=
by
cases h : l.maximum
@@ -566,12 +344,6 @@ theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :
· simp_rw [WithBot.some_eq_coe, WithBot.coe_lt_coe, not_lt_maximum_of_mem ha h, not_false_iff]
#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'
-/- warning: list.not_lt_minimum_of_mem' -> List.not_lt_minimum_of_mem' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toHasLt.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4080 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4082 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4080 x._@.Mathlib.Data.List.MinMax._hyg.4082)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) (WithTop.some.{u1} α a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
-Case conversion may be inaccurate. Consider using '#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'ₓ'. -/
theorem not_lt_minimum_of_mem' (ha : a ∈ l) : ¬(a : WithTop α) < minimum l :=
@not_lt_maximum_of_mem' αᵒᵈ _ _ _ _ ha
#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'
@@ -604,22 +376,10 @@ theorem minimum_le_of_mem : a ∈ l → (minimum l : WithTop α) = m → m ≤ a
#align list.minimum_le_of_mem List.minimum_le_of_mem
-/
-/- warning: list.le_maximum_of_mem' -> List.le_maximum_of_mem' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u1} (WithBot.{u1} α) (Preorder.toHasLe.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (LE.le.{u1} (WithBot.{u1} α) (Preorder.toLE.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (WithBot.some.{u1} α a) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
-Case conversion may be inaccurate. Consider using '#align list.le_maximum_of_mem' List.le_maximum_of_mem'ₓ'. -/
theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l :=
le_of_not_lt <| not_lt_maximum_of_mem' ha
#align list.le_maximum_of_mem' List.le_maximum_of_mem'
-/- warning: list.le_minimum_of_mem' -> List.le_minimum_of_mem' is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u1} (WithTop.{u1} α) (Preorder.toHasLe.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (LE.le.{u1} (WithTop.{u1} α) (Preorder.toLE.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l) (WithTop.some.{u1} α a))
-Case conversion may be inaccurate. Consider using '#align list.le_minimum_of_mem' List.le_minimum_of_mem'ₓ'. -/
theorem le_minimum_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
@le_maximum_of_mem' αᵒᵈ _ _ _ ha
#align list.le_minimum_of_mem' List.le_minimum_of_mem'
@@ -674,12 +434,6 @@ section OrderBot
variable [OrderBot α] {l : List α}
-/- warning: list.foldr_max_of_ne_nil -> List.foldr_max_of_ne_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithBot.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithBot.{u1} α) (WithBot.some.{u1} α (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l)) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
-Case conversion may be inaccurate. Consider using '#align list.foldr_max_of_ne_nil List.foldr_max_of_ne_nilₓ'. -/
@[simp]
theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
by
@@ -691,12 +445,6 @@ theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
· simp [IH h]
#align list.foldr_max_of_ne_nil List.foldr_max_of_ne_nil
-/- warning: list.max_le_of_forall_le -> List.max_le_of_forall_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a)) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x a)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l) a)
-Case conversion may be inaccurate. Consider using '#align list.max_le_of_forall_le List.max_le_of_forall_leₓ'. -/
theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) : l.foldr max ⊥ ≤ a :=
by
induction' l with y l IH
@@ -704,12 +452,6 @@ theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) :
· simpa [h y (mem_cons_self _ _)] using IH fun x hx => h x <| mem_cons_of_mem _ hx
#align list.max_le_of_forall_le List.max_le_of_forall_le
-/- warning: list.le_max_of_le -> List.le_max_of_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α} {a : α} {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α} {a : α} {x : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a x) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l))
-Case conversion may be inaccurate. Consider using '#align list.le_max_of_le List.le_max_of_leₓ'. -/
theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a ≤ l.foldr max ⊥ :=
by
induction' l with y l IH
@@ -726,33 +468,15 @@ section OrderTop
variable [OrderTop α] {l : List α}
-/- warning: list.foldr_min_of_ne_nil -> List.foldr_min_of_ne_nil is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithTop.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithTop.{u1} α) (WithTop.some.{u1} α (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l)) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
-Case conversion may be inaccurate. Consider using '#align list.foldr_min_of_ne_nil List.foldr_min_of_ne_nilₓ'. -/
@[simp]
theorem foldr_min_of_ne_nil (h : l ≠ []) : ↑(l.foldr min ⊤) = l.minimum :=
@foldr_max_of_ne_nil αᵒᵈ _ _ _ h
#align list.foldr_min_of_ne_nil List.foldr_min_of_ne_nil
-/- warning: list.le_min_of_forall_le -> List.le_min_of_forall_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x)) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a x)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l))
-Case conversion may be inaccurate. Consider using '#align list.le_min_of_forall_le List.le_min_of_forall_leₓ'. -/
theorem le_min_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, a ≤ x) : a ≤ l.foldr min ⊤ :=
@max_le_of_forall_le αᵒᵈ _ _ _ _ h
#align list.le_min_of_forall_le List.le_min_of_forall_le
-/- warning: list.min_le_of_le -> List.min_le_of_le is a dubious translation:
-lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α) {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
-but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α) {x : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x a) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l) a)
-Case conversion may be inaccurate. Consider using '#align list.min_le_of_le List.min_le_of_leₓ'. -/
theorem min_le_of_le (l : List α) (a : α) {x : α} (hx : x ∈ l) (h : x ≤ a) : l.foldr min ⊤ ≤ a :=
@le_max_of_le αᵒᵈ _ _ _ _ _ hx h
#align list.min_le_of_le List.min_le_of_le
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -59,13 +59,11 @@ private theorem foldl_arg_aux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (so
simp only [foldl_append, foldl_cons, foldl_nil, arg_aux]
cases hf : foldl (arg_aux r) (some a) tl
· simp (config := { contextual := true })
- · dsimp only
- split_ifs
+ · dsimp only; split_ifs
· simp (config := { contextual := true })
· -- `finish [ih _ _ hf]` closes this goal
rcases ih _ _ hf with (rfl | H)
- · simp only [mem_cons_iff, mem_append, mem_singleton, Option.mem_def]
- tauto
+ · simp only [mem_cons_iff, mem_append, mem_singleton, Option.mem_def]; tauto
· apply fun hm => Or.inr (list.mem_append.mpr <| Or.inl _)
exact option.mem_some_iff.mp hm ▸ H)
mathlib commit https://github.com/leanprover-community/mathlib/commit/917c3c072e487b3cccdbfeff17e75b40e45f66cb
@@ -68,7 +68,6 @@ private theorem foldl_arg_aux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (so
tauto
· apply fun hm => Or.inr (list.mem_append.mpr <| Or.inl _)
exact option.mem_some_iff.mp hm ▸ H)
-#align list.foldl_arg_aux_mem list.foldl_arg_aux_mem
#print List.argAux_self /-
@[simp]
mathlib commit https://github.com/leanprover-community/mathlib/commit/95a87616d63b3cb49d3fe678d416fbe9c4217bf4
@@ -234,7 +234,7 @@ theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1629 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1631 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1629 x._@.Mathlib.Data.List.MinMax._hyg.1631)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
+ forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1630 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1632 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1630 x._@.Mathlib.Data.List.MinMax._hyg.1632)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
Case conversion may be inaccurate. Consider using '#align list.argmin_mem List.argmin_memₓ'. -/
theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
@argmax_mem _ βᵒᵈ _ _ _
@@ -244,7 +244,7 @@ theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1688 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1690 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1688 x._@.Mathlib.Data.List.MinMax._hyg.1690)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
+ forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1689 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1691 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1689 x._@.Mathlib.Data.List.MinMax._hyg.1691)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
Case conversion may be inaccurate. Consider using '#align list.argmax_eq_none List.argmax_eq_noneₓ'. -/
@[simp]
theorem argmax_eq_none : l.argmax f = none ↔ l = [] := by simp [argmax]
@@ -254,7 +254,7 @@ theorem argmax_eq_none : l.argmax f = none ↔ l = [] := by simp [argmax]
lean 3 declaration is
forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
- forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1741 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1743 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1741 x._@.Mathlib.Data.List.MinMax._hyg.1743)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
+ forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1742 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1744 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1742 x._@.Mathlib.Data.List.MinMax._hyg.1744)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
Case conversion may be inaccurate. Consider using '#align list.argmin_eq_none List.argmin_eq_noneₓ'. -/
@[simp]
theorem argmin_eq_none : l.argmin f = none ↔ l = [] :=
@@ -430,7 +430,7 @@ variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithBot.{u1} α)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3467 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3469 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3467 x._@.Mathlib.Data.List.MinMax._hyg.3469)], (List.{u1} α) -> (WithBot.{u1} α)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3469 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3471 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3469 x._@.Mathlib.Data.List.MinMax._hyg.3471)], (List.{u1} α) -> (WithBot.{u1} α)
Case conversion may be inaccurate. Consider using '#align list.maximum List.maximumₓ'. -/
/-- `maximum l` returns an `with_bot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
@@ -442,7 +442,7 @@ def maximum (l : List α) : WithBot α :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithTop.{u1} α)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3503 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3505 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3503 x._@.Mathlib.Data.List.MinMax._hyg.3505)], (List.{u1} α) -> (WithTop.{u1} α)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3505 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3507 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3505 x._@.Mathlib.Data.List.MinMax._hyg.3507)], (List.{u1} α) -> (WithTop.{u1} α)
Case conversion may be inaccurate. Consider using '#align list.minimum List.minimumₓ'. -/
/-- `minimum l` returns an `with_top α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
@@ -454,7 +454,7 @@ def minimum (l : List α) : WithTop α :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3539 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3541 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3539 x._@.Mathlib.Data.List.MinMax._hyg.3541)], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3541 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3543 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3541 x._@.Mathlib.Data.List.MinMax._hyg.3543)], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))
Case conversion may be inaccurate. Consider using '#align list.maximum_nil List.maximum_nilₓ'. -/
@[simp]
theorem maximum_nil : maximum ([] : List α) = ⊥ :=
@@ -465,7 +465,7 @@ theorem maximum_nil : maximum ([] : List α) = ⊥ :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3582 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3584 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3582 x._@.Mathlib.Data.List.MinMax._hyg.3584)], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3584 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3586 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3584 x._@.Mathlib.Data.List.MinMax._hyg.3586)], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))
Case conversion may be inaccurate. Consider using '#align list.minimum_nil List.minimum_nilₓ'. -/
@[simp]
theorem minimum_nil : minimum ([] : List α) = ⊤ :=
@@ -476,7 +476,7 @@ theorem minimum_nil : minimum ([] : List α) = ⊤ :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3625 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3627 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3625 x._@.Mathlib.Data.List.MinMax._hyg.3627)] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithBot.some.{u1} α a)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3627 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3629 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3627 x._@.Mathlib.Data.List.MinMax._hyg.3629)] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithBot.some.{u1} α a)
Case conversion may be inaccurate. Consider using '#align list.maximum_singleton List.maximum_singletonₓ'. -/
@[simp]
theorem maximum_singleton (a : α) : maximum [a] = a :=
@@ -487,7 +487,7 @@ theorem maximum_singleton (a : α) : maximum [a] = a :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3666 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3668 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3666 x._@.Mathlib.Data.List.MinMax._hyg.3668)] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithTop.some.{u1} α a)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3668 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3670 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3668 x._@.Mathlib.Data.List.MinMax._hyg.3670)] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithTop.some.{u1} α a)
Case conversion may be inaccurate. Consider using '#align list.minimum_singleton List.minimum_singletonₓ'. -/
@[simp]
theorem minimum_singleton (a : α) : minimum [a] = a :=
@@ -498,7 +498,7 @@ theorem minimum_singleton (a : α) : minimum [a] = a :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3707 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3709 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3707 x._@.Mathlib.Data.List.MinMax._hyg.3709)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3709 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3711 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3709 x._@.Mathlib.Data.List.MinMax._hyg.3711)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
Case conversion may be inaccurate. Consider using '#align list.maximum_mem List.maximum_memₓ'. -/
theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m ∈ l :=
argmax_mem
@@ -508,7 +508,7 @@ theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3757 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3759 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3757 x._@.Mathlib.Data.List.MinMax._hyg.3759)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3759 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3761 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3759 x._@.Mathlib.Data.List.MinMax._hyg.3761)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
Case conversion may be inaccurate. Consider using '#align list.minimum_mem List.minimum_memₓ'. -/
theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m ∈ l :=
argmin_mem
@@ -518,7 +518,7 @@ theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3807 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3809 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3807 x._@.Mathlib.Data.List.MinMax._hyg.3809)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3809 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3811 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3809 x._@.Mathlib.Data.List.MinMax._hyg.3811)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
Case conversion may be inaccurate. Consider using '#align list.maximum_eq_none List.maximum_eq_noneₓ'. -/
@[simp]
theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] :=
@@ -529,7 +529,7 @@ theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3853 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3855 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3853 x._@.Mathlib.Data.List.MinMax._hyg.3855)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3855 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3857 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3855 x._@.Mathlib.Data.List.MinMax._hyg.3857)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
Case conversion may be inaccurate. Consider using '#align list.minimum_eq_none List.minimum_eq_noneₓ'. -/
@[simp]
theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] :=
@@ -540,7 +540,7 @@ theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] :=
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) m a))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3899 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3901 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3899 x._@.Mathlib.Data.List.MinMax._hyg.3901)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) m a))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3901 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3903 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3901 x._@.Mathlib.Data.List.MinMax._hyg.3903)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) m a))
Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_memₓ'. -/
theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m < a :=
not_lt_of_mem_argmax
@@ -550,7 +550,7 @@ theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) a m))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3955 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3957 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3955 x._@.Mathlib.Data.List.MinMax._hyg.3957)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) a m))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3957 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3959 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3957 x._@.Mathlib.Data.List.MinMax._hyg.3959)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) a m))
Case conversion may be inaccurate. Consider using '#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_memₓ'. -/
theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a < m :=
not_lt_of_mem_argmin
@@ -560,7 +560,7 @@ theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toHasLt.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4011 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4013 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4011 x._@.Mathlib.Data.List.MinMax._hyg.4013)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α a)))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4013 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4015 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4013 x._@.Mathlib.Data.List.MinMax._hyg.4015)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α a)))
Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'ₓ'. -/
theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :=
by
@@ -573,7 +573,7 @@ theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :
lean 3 declaration is
forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toHasLt.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
but is expected to have type
- forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4078 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4080 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4078 x._@.Mathlib.Data.List.MinMax._hyg.4080)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) (WithTop.some.{u1} α a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4080 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4082 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4080 x._@.Mathlib.Data.List.MinMax._hyg.4082)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) (WithTop.some.{u1} α a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
Case conversion may be inaccurate. Consider using '#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'ₓ'. -/
theorem not_lt_minimum_of_mem' (ha : a ∈ l) : ¬(a : WithTop α) < minimum l :=
@not_lt_maximum_of_mem' αᵒᵈ _ _ _ _ ha
mathlib commit https://github.com/leanprover-community/mathlib/commit/0b9eaaa7686280fad8cce467f5c3c57ee6ce77f8
@@ -105,27 +105,35 @@ section Preorder
variable [Preorder β] [@DecidableRel β (· < ·)] {f : α → β} {l : List α} {o : Option α} {a m : α}
-#print List.argmax /-
+/- warning: list.argmax -> List.argmax is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.814 : β) (x._@.Mathlib.Data.List.MinMax._hyg.816 : β) => LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.814 x._@.Mathlib.Data.List.MinMax._hyg.816)], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
+Case conversion may be inaccurate. Consider using '#align list.argmax List.argmaxₓ'. -/
/-- `argmax f l` returns `some a`, where `f a` is maximal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f a < f b`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmax f []` = none`. -/
def argmax (f : α → β) (l : List α) : Option α :=
l.foldl (argAux fun b c => f c < f b) none
#align list.argmax List.argmax
--/
-#print List.argmin /-
+/- warning: list.argmin -> List.argmin is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
+but is expected to have type
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.871 : β) (x._@.Mathlib.Data.List.MinMax._hyg.873 : β) => LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.871 x._@.Mathlib.Data.List.MinMax._hyg.873)], (α -> β) -> (List.{u1} α) -> (Option.{u1} α)
+Case conversion may be inaccurate. Consider using '#align list.argmin List.argminₓ'. -/
/-- `argmin f l` returns `some a`, where `f a` is minimal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f b < f a`. If `a`, `b` are such that `f a = f b`, it returns
whichever of `a` or `b` comes first in the list. `argmin f []` = none`. -/
def argmin (f : α → β) (l : List α) :=
l.foldl (argAux fun b c => f b < f c) none
#align list.argmin List.argmin
--/
/- warning: list.argmax_nil -> List.argmax_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.927 : β) (x._@.Mathlib.Data.List.MinMax._hyg.929 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.927 x._@.Mathlib.Data.List.MinMax._hyg.929)] (f : α -> β), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u2} α)) (Option.none.{u2} α)
Case conversion may be inaccurate. Consider using '#align list.argmax_nil List.argmax_nilₓ'. -/
@@ -136,7 +144,7 @@ theorem argmax_nil (f : α → β) : argmax f [] = none :=
/- warning: list.argmin_nil -> List.argmin_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u1} α)) (Option.none.{u1} α)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.974 : β) (x._@.Mathlib.Data.List.MinMax._hyg.976 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.974 x._@.Mathlib.Data.List.MinMax._hyg.976)] (f : α -> β), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.nil.{u2} α)) (Option.none.{u2} α)
Case conversion may be inaccurate. Consider using '#align list.argmin_nil List.argmin_nilₓ'. -/
@@ -147,7 +155,7 @@ theorem argmin_nil (f : α → β) : argmin f [] = none :=
/- warning: list.argmax_singleton -> List.argmax_singleton is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1021 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1023 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1021 x._@.Mathlib.Data.List.MinMax._hyg.1023)] {f : α -> β} {a : α}, Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u2} α a (List.nil.{u2} α))) (Option.some.{u2} α a)
Case conversion may be inaccurate. Consider using '#align list.argmax_singleton List.argmax_singletonₓ'. -/
@@ -158,7 +166,7 @@ theorem argmax_singleton {f : α → β} {a : α} : argmax f [a] = a :=
/- warning: list.argmin_singleton -> List.argmin_singleton is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {a : α}, Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (Option.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (Option.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (Option.{u1} α) (coeOption.{u1} α))) a)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1071 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1073 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1071 x._@.Mathlib.Data.List.MinMax._hyg.1073)] {f : α -> β} {a : α}, Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (List.cons.{u2} α a (List.nil.{u2} α))) (Option.some.{u2} α a)
Case conversion may be inaccurate. Consider using '#align list.argmin_singleton List.argmin_singletonₓ'. -/
@@ -169,7 +177,7 @@ theorem argmin_singleton {f : α → β} {a : α} : argmin f [a] = a :=
/- warning: list.not_lt_of_mem_argmax -> List.not_lt_of_mem_argmax is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) (f m) (f a)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f m) (f a)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1121 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1123 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1121 x._@.Mathlib.Data.List.MinMax._hyg.1123)] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f m) (f a)))
Case conversion may be inaccurate. Consider using '#align list.not_lt_of_mem_argmax List.not_lt_of_mem_argmaxₓ'. -/
@@ -179,7 +187,7 @@ theorem not_lt_of_mem_argmax : a ∈ l → m ∈ argmax f l → ¬f m < f a :=
/- warning: list.not_lt_of_mem_argmin -> List.not_lt_of_mem_argmin is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) (f a) (f m)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f a) (f m)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1209 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1211 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1209 x._@.Mathlib.Data.List.MinMax._hyg.1211)] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Not (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f a) (f m)))
Case conversion may be inaccurate. Consider using '#align list.not_lt_of_mem_argmin List.not_lt_of_mem_argminₓ'. -/
@@ -189,7 +197,7 @@ theorem not_lt_of_mem_argmin : a ∈ l → m ∈ argmin f l → ¬f a < f m :=
/- warning: list.argmax_concat -> List.argmax_concat is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) (f c) (f a)) (_inst_2 (f c) (f a)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f c) (f a)) (_inst_2 (f c) (f a)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1297 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1299 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1297 x._@.Mathlib.Data.List.MinMax._hyg.1299)] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (HAppend.hAppend.{u2, u2, u2} (List.{u2} α) (List.{u2} α) (List.{u2} α) (instHAppend.{u2} (List.{u2} α) (List.instAppendList.{u2} α)) l (List.cons.{u2} α a (List.nil.{u2} α)))) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f c) (f a)) (_inst_2 (f c) (f a)) (Option.some.{u2} α a) (Option.some.{u2} α c)))
Case conversion may be inaccurate. Consider using '#align list.argmax_concat List.argmax_concatₓ'. -/
@@ -201,7 +209,7 @@ theorem argmax_concat (f : α → β) (a : α) (l : List α) :
/- warning: list.argmin_concat -> List.argmin_concat is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1) (f a) (f c)) (_inst_2 (f a) (f c)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (Append.append.{u1} (List.{u1} α) (List.hasAppend.{u1} α) l (List.cons.{u1} α a (List.nil.{u1} α)))) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1) (f a) (f c)) (_inst_2 (f a) (f c)) (Option.some.{u1} α a) (Option.some.{u1} α c)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1419 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1421 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1419 x._@.Mathlib.Data.List.MinMax._hyg.1421)] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f (HAppend.hAppend.{u2, u2, u2} (List.{u2} α) (List.{u2} α) (List.{u2} α) (instHAppend.{u2} (List.{u2} α) (List.instAppendList.{u2} α)) l (List.cons.{u2} α a (List.nil.{u2} α)))) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) (f a) (f c)) (_inst_2 (f a) (f c)) (Option.some.{u2} α a) (Option.some.{u2} α c)))
Case conversion may be inaccurate. Consider using '#align list.argmin_concat List.argmin_concatₓ'. -/
@@ -213,7 +221,7 @@ theorem argmin_concat (f : α → β) (a : α) (l : List α) :
/- warning: list.argmax_mem -> List.argmax_mem is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1516 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1518 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1516 x._@.Mathlib.Data.List.MinMax._hyg.1518)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
Case conversion may be inaccurate. Consider using '#align list.argmax_mem List.argmax_memₓ'. -/
@@ -224,7 +232,7 @@ theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
/- warning: list.argmin_mem -> List.argmin_mem is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1629 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1631 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1629 x._@.Mathlib.Data.List.MinMax._hyg.1631)] {f : α -> β} {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l)) -> (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l)
Case conversion may be inaccurate. Consider using '#align list.argmin_mem List.argmin_memₓ'. -/
@@ -234,7 +242,7 @@ theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
/- warning: list.argmax_eq_none -> List.argmax_eq_none is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1688 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1690 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1688 x._@.Mathlib.Data.List.MinMax._hyg.1690)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
Case conversion may be inaccurate. Consider using '#align list.argmax_eq_none List.argmax_eq_noneₓ'. -/
@@ -244,7 +252,7 @@ theorem argmax_eq_none : l.argmax f = none ↔ l = [] := by simp [argmax]
/- warning: list.argmin_eq_none -> List.argmin_eq_none is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toLT.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : Preorder.{u2} β] [_inst_2 : DecidableRel.{succ u2} β (LT.lt.{u2} β (Preorder.toHasLt.{u2} β _inst_1))] {f : α -> β} {l : List.{u1} α}, Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : Preorder.{u1} β] [_inst_2 : DecidableRel.{succ u1} β (fun (x._@.Mathlib.Data.List.MinMax._hyg.1741 : β) (x._@.Mathlib.Data.List.MinMax._hyg.1743 : β) => LT.lt.{u1} β (Preorder.toLT.{u1} β _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.1741 x._@.Mathlib.Data.List.MinMax._hyg.1743)] {f : α -> β} {l : List.{u2} α}, Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β _inst_1 (fun (a : β) (b : β) => _inst_2 a b) f l) (Option.none.{u2} α)) (Eq.{succ u2} (List.{u2} α) l (List.nil.{u2} α))
Case conversion may be inaccurate. Consider using '#align list.argmin_eq_none List.argmin_eq_noneₓ'. -/
@@ -261,7 +269,7 @@ variable [LinearOrder β] {f : α → β} {l : List α} {o : Option α} {a m :
/- warning: list.le_of_mem_argmax -> List.le_of_mem_argmax is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))
Case conversion may be inaccurate. Consider using '#align list.le_of_mem_argmax List.le_of_mem_argmaxₓ'. -/
@@ -271,7 +279,7 @@ theorem le_of_mem_argmax : a ∈ l → m ∈ argmax f l → f a ≤ f m := fun h
/- warning: list.le_of_mem_argmin -> List.le_of_mem_argmin is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {a : α} {m : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))
Case conversion may be inaccurate. Consider using '#align list.le_of_mem_argmin List.le_of_mem_argminₓ'. -/
@@ -281,7 +289,7 @@ theorem le_of_mem_argmin : a ∈ l → m ∈ argmin f l → f m ≤ f a :=
/- warning: list.argmax_cons -> List.argmax_cons is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f c)) (LT.lt.decidable.{u2} β _inst_1 (f a) (f c)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f c)) (LT.lt.decidable.{u2} β _inst_1 (f a) (f c)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f (List.cons.{u2} α a l)) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f c)) (instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 (f a) (f c)) (Option.some.{u2} α c) (Option.some.{u2} α a)))
Case conversion may be inaccurate. Consider using '#align list.argmax_cons List.argmax_consₓ'. -/
@@ -303,7 +311,7 @@ theorem argmax_cons (f : α → β) (a : α) (l : List α) :
/- warning: list.argmin_cons -> List.argmin_cons is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toLT.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f c) (f a)) (LT.lt.decidable.{u2} β _inst_1 (f c) (f a)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] (f : α -> β) (a : α) (l : List.{u1} α), Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f (List.cons.{u1} α a l)) (Option.casesOn.{succ u1, u1} α (fun (_x : Option.{u1} α) => Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α a) (fun (c : α) => ite.{succ u1} (Option.{u1} α) (LT.lt.{u2} β (Preorder.toHasLt.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f c) (f a)) (LT.lt.decidable.{u2} β _inst_1 (f c) (f a)) (Option.some.{u1} α c) (Option.some.{u1} α a)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] (f : α -> β) (a : α) (l : List.{u2} α), Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f (List.cons.{u2} α a l)) (Option.casesOn.{succ u2, u2} α (fun (_x : Option.{u2} α) => Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α a) (fun (c : α) => ite.{succ u2} (Option.{u2} α) (LT.lt.{u1} β (Preorder.toLT.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f c) (f a)) (instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 (f c) (f a)) (Option.some.{u2} α c) (Option.some.{u2} α a)))
Case conversion may be inaccurate. Consider using '#align list.argmin_cons List.argmin_consₓ'. -/
@@ -317,7 +325,7 @@ variable [DecidableEq α]
/- warning: list.index_of_argmax -> List.index_of_argmax is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u2} α] {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))
Case conversion may be inaccurate. Consider using '#align list.index_of_argmax List.index_of_argmaxₓ'. -/
@@ -344,7 +352,7 @@ theorem index_of_argmax :
/- warning: list.index_of_argmin -> List.index_of_argmin is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u1} α] {l : List.{u1} α} {m : α}, (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} [_inst_2 : DecidableEq.{succ u2} α] {l : List.{u2} α} {m : α}, (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) -> (forall {a : α}, (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))
Case conversion may be inaccurate. Consider using '#align list.index_of_argmin List.index_of_argminₓ'. -/
@@ -356,7 +364,7 @@ theorem index_of_argmin :
/- warning: list.mem_argmax_iff -> List.mem_argmax_iff is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
Case conversion may be inaccurate. Consider using '#align list.mem_argmax_iff List.mem_argmax_iffₓ'. -/
@@ -376,7 +384,7 @@ theorem mem_argmax_iff :
/- warning: list.argmax_eq_some_iff -> List.argmax_eq_some_iff is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmax.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Eq.{succ u2} (Option.{u2} α) (List.argmax.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α m)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
Case conversion may be inaccurate. Consider using '#align list.argmax_eq_some_iff List.argmax_eq_some_iffₓ'. -/
@@ -388,7 +396,7 @@ theorem argmax_eq_some_iff :
/- warning: list.mem_argmin_iff -> List.mem_argmin_iff is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Membership.Mem.{u1, u1} α (Option.{u1} α) (Option.hasMem.{u1} α) m (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Membership.mem.{u2, u2} α (Option.{u2} α) (Option.instMembershipOption.{u2} α) m (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
Case conversion may be inaccurate. Consider using '#align list.mem_argmin_iff List.mem_argmin_iffₓ'. -/
@@ -400,7 +408,7 @@ theorem mem_argmin_iff :
/- warning: list.argmin_eq_some_iff -> List.argmin_eq_some_iff is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toLE.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
+ forall {α : Type.{u1}} {β : Type.{u2}} [_inst_1 : LinearOrder.{u2} β] {f : α -> β} {l : List.{u1} α} {m : α} [_inst_2 : DecidableEq.{succ u1} α], Iff (Eq.{succ u1} (Option.{u1} α) (List.argmin.{u1, u2} α β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1)))) (fun (a : β) (b : β) => LT.lt.decidable.{u2} β _inst_1 a b) f l) (Option.some.{u1} α m)) (And (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l) (And (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f m) (f a))) (forall (a : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u2} β (Preorder.toHasLe.{u2} β (PartialOrder.toPreorder.{u2} β (SemilatticeInf.toPartialOrder.{u2} β (Lattice.toSemilatticeInf.{u2} β (LinearOrder.toLattice.{u2} β _inst_1))))) (f a) (f m)) -> (LE.le.{0} Nat Nat.hasLe (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) m l) (List.indexOfₓ.{u1} α (fun (a : α) (b : α) => _inst_2 a b) a l)))))
but is expected to have type
forall {α : Type.{u2}} {β : Type.{u1}} [_inst_1 : LinearOrder.{u1} β] {f : α -> β} {l : List.{u2} α} {m : α} [_inst_2 : DecidableEq.{succ u2} α], Iff (Eq.{succ u2} (Option.{u2} α) (List.argmin.{u2, u1} α β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1))))) (fun (a : β) (b : β) => instDecidableLtToLTToPreorderToPartialOrder.{u1} β _inst_1 a b) f l) (Option.some.{u2} α m)) (And (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) m l) (And (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f m) (f a))) (forall (a : α), (Membership.mem.{u2, u2} α (List.{u2} α) (List.instMembershipList.{u2} α) a l) -> (LE.le.{u1} β (Preorder.toLE.{u1} β (PartialOrder.toPreorder.{u1} β (SemilatticeInf.toPartialOrder.{u1} β (Lattice.toSemilatticeInf.{u1} β (DistribLattice.toLattice.{u1} β (instDistribLattice.{u1} β _inst_1)))))) (f a) (f m)) -> (LE.le.{0} Nat instLENat (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) m l) (List.indexOf.{u2} α (instBEq.{u2} α (fun (a : α) (b : α) => _inst_2 a b)) a l)))))
Case conversion may be inaccurate. Consider using '#align list.argmin_eq_some_iff List.argmin_eq_some_iffₓ'. -/
@@ -418,102 +426,158 @@ section Preorder
variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
-#print List.maximum /-
+/- warning: list.maximum -> List.maximum is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithBot.{u1} α)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3467 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3469 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3467 x._@.Mathlib.Data.List.MinMax._hyg.3469)], (List.{u1} α) -> (WithBot.{u1} α)
+Case conversion may be inaccurate. Consider using '#align list.maximum List.maximumₓ'. -/
/-- `maximum l` returns an `with_bot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
def maximum (l : List α) : WithBot α :=
argmax id l
#align list.maximum List.maximum
--/
-#print List.minimum /-
+/- warning: list.minimum -> List.minimum is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], (List.{u1} α) -> (WithTop.{u1} α)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3503 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3505 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3503 x._@.Mathlib.Data.List.MinMax._hyg.3505)], (List.{u1} α) -> (WithTop.{u1} α)
+Case conversion may be inaccurate. Consider using '#align list.minimum List.minimumₓ'. -/
/-- `minimum l` returns an `with_top α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
def minimum (l : List α) : WithTop α :=
argmin id l
#align list.minimum List.minimum
--/
-#print List.maximum_nil /-
+/- warning: list.maximum_nil -> List.maximum_nil is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.hasBot.{u1} α))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3539 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3541 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3539 x._@.Mathlib.Data.List.MinMax._hyg.3541)], Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Bot.bot.{u1} (WithBot.{u1} α) (WithBot.bot.{u1} α))
+Case conversion may be inaccurate. Consider using '#align list.maximum_nil List.maximum_nilₓ'. -/
@[simp]
theorem maximum_nil : maximum ([] : List α) = ⊥ :=
rfl
#align list.maximum_nil List.maximum_nil
--/
-#print List.minimum_nil /-
+/- warning: list.minimum_nil -> List.minimum_nil is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.hasTop.{u1} α))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3582 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3584 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3582 x._@.Mathlib.Data.List.MinMax._hyg.3584)], Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.nil.{u1} α)) (Top.top.{u1} (WithTop.{u1} α) (WithTop.top.{u1} α))
+Case conversion may be inaccurate. Consider using '#align list.minimum_nil List.minimum_nilₓ'. -/
@[simp]
theorem minimum_nil : minimum ([] : List α) = ⊤ :=
rfl
#align list.minimum_nil List.minimum_nil
--/
-#print List.maximum_singleton /-
+/- warning: list.maximum_singleton -> List.maximum_singleton is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3625 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3627 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3625 x._@.Mathlib.Data.List.MinMax._hyg.3627)] (a : α), Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithBot.some.{u1} α a)
+Case conversion may be inaccurate. Consider using '#align list.maximum_singleton List.maximum_singletonₓ'. -/
@[simp]
theorem maximum_singleton (a : α) : maximum [a] = a :=
rfl
#align list.maximum_singleton List.maximum_singleton
--/
-#print List.minimum_singleton /-
+/- warning: list.minimum_singleton -> List.minimum_singleton is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3666 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3668 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3666 x._@.Mathlib.Data.List.MinMax._hyg.3668)] (a : α), Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) (List.cons.{u1} α a (List.nil.{u1} α))) (WithTop.some.{u1} α a)
+Case conversion may be inaccurate. Consider using '#align list.minimum_singleton List.minimum_singletonₓ'. -/
@[simp]
theorem minimum_singleton (a : α) : minimum [a] = a :=
rfl
#align list.minimum_singleton List.minimum_singleton
--/
-#print List.maximum_mem /-
+/- warning: list.maximum_mem -> List.maximum_mem is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3707 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3709 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3707 x._@.Mathlib.Data.List.MinMax._hyg.3709)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
+Case conversion may be inaccurate. Consider using '#align list.maximum_mem List.maximum_memₓ'. -/
theorem maximum_mem {l : List α} {m : α} : (maximum l : WithTop α) = m → m ∈ l :=
argmax_mem
#align list.maximum_mem List.maximum_mem
--/
-#print List.minimum_mem /-
+/- warning: list.minimum_mem -> List.minimum_mem is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) m l)
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3757 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3759 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3757 x._@.Mathlib.Data.List.MinMax._hyg.3759)] {l : List.{u1} α} {m : α}, (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) m l)
+Case conversion may be inaccurate. Consider using '#align list.minimum_mem List.minimum_memₓ'. -/
theorem minimum_mem {l : List α} {m : α} : (minimum l : WithBot α) = m → m ∈ l :=
argmin_mem
#align list.minimum_mem List.minimum_mem
--/
-#print List.maximum_eq_none /-
+/- warning: list.maximum_eq_none -> List.maximum_eq_none is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3807 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3809 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3807 x._@.Mathlib.Data.List.MinMax._hyg.3809)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+Case conversion may be inaccurate. Consider using '#align list.maximum_eq_none List.maximum_eq_noneₓ'. -/
@[simp]
theorem maximum_eq_none {l : List α} : l.maximum = none ↔ l = [] :=
argmax_eq_none
#align list.maximum_eq_none List.maximum_eq_none
--/
-#print List.minimum_eq_none /-
+/- warning: list.minimum_eq_none -> List.minimum_eq_none is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3853 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3855 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3853 x._@.Mathlib.Data.List.MinMax._hyg.3855)] {l : List.{u1} α}, Iff (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (Option.none.{u1} α)) (Eq.{succ u1} (List.{u1} α) l (List.nil.{u1} α))
+Case conversion may be inaccurate. Consider using '#align list.minimum_eq_none List.minimum_eq_noneₓ'. -/
@[simp]
theorem minimum_eq_none {l : List α} : l.minimum = none ↔ l = [] :=
argmin_eq_none
#align list.minimum_eq_none List.minimum_eq_none
--/
-#print List.not_lt_maximum_of_mem /-
+/- warning: list.not_lt_maximum_of_mem -> List.not_lt_maximum_of_mem is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) m a))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3899 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3901 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3899 x._@.Mathlib.Data.List.MinMax._hyg.3901)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithBot.{u1} α) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) m a))
+Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_memₓ'. -/
theorem not_lt_maximum_of_mem : a ∈ l → (maximum l : WithBot α) = m → ¬m < a :=
not_lt_of_mem_argmax
#align list.not_lt_maximum_of_mem List.not_lt_maximum_of_mem
--/
-#print List.minimum_not_lt_of_mem /-
+/- warning: list.minimum_not_lt_of_mem -> List.minimum_not_lt_of_mem is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α} {m : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) m)) -> (Not (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1) a m))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.3955 : α) (x._@.Mathlib.Data.List.MinMax._hyg.3957 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.3955 x._@.Mathlib.Data.List.MinMax._hyg.3957)] {l : List.{u1} α} {a : α} {m : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Eq.{succ u1} (WithTop.{u1} α) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithTop.some.{u1} α m)) -> (Not (LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) a m))
+Case conversion may be inaccurate. Consider using '#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_memₓ'. -/
theorem minimum_not_lt_of_mem : a ∈ l → (minimum l : WithTop α) = m → ¬a < m :=
not_lt_of_mem_argmin
#align list.minimum_not_lt_of_mem List.minimum_not_lt_of_mem
--/
-#print List.not_lt_maximum_of_mem' /-
+/- warning: list.not_lt_maximum_of_mem' -> List.not_lt_maximum_of_mem' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toHasLt.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4011 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4013 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4011 x._@.Mathlib.Data.List.MinMax._hyg.4013)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithBot.{u1} α) (Preorder.toLT.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α _inst_1)) (List.maximum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l) (WithBot.some.{u1} α a)))
+Case conversion may be inaccurate. Consider using '#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'ₓ'. -/
theorem not_lt_maximum_of_mem' (ha : a ∈ l) : ¬maximum l < (a : WithBot α) :=
by
cases h : l.maximum
· simp_all
· simp_rw [WithBot.some_eq_coe, WithBot.coe_lt_coe, not_lt_maximum_of_mem ha h, not_false_iff]
#align list.not_lt_maximum_of_mem' List.not_lt_maximum_of_mem'
--/
-#print List.not_lt_minimum_of_mem' /-
+/- warning: list.not_lt_minimum_of_mem' -> List.not_lt_minimum_of_mem' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (LT.lt.{u1} α (Preorder.toHasLt.{u1} α _inst_1))] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toHasLt.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : Preorder.{u1} α] [_inst_2 : DecidableRel.{succ u1} α (fun (x._@.Mathlib.Data.List.MinMax._hyg.4078 : α) (x._@.Mathlib.Data.List.MinMax._hyg.4080 : α) => LT.lt.{u1} α (Preorder.toLT.{u1} α _inst_1) x._@.Mathlib.Data.List.MinMax._hyg.4078 x._@.Mathlib.Data.List.MinMax._hyg.4080)] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (Not (LT.lt.{u1} (WithTop.{u1} α) (Preorder.toLT.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α _inst_1)) (WithTop.some.{u1} α a) (List.minimum.{u1} α _inst_1 (fun (a : α) (b : α) => _inst_2 a b) l)))
+Case conversion may be inaccurate. Consider using '#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'ₓ'. -/
theorem not_lt_minimum_of_mem' (ha : a ∈ l) : ¬(a : WithTop α) < minimum l :=
@not_lt_maximum_of_mem' αᵒᵈ _ _ _ _ ha
#align list.not_lt_minimum_of_mem' List.not_lt_minimum_of_mem'
--/
end Preorder
@@ -543,17 +607,25 @@ theorem minimum_le_of_mem : a ∈ l → (minimum l : WithTop α) = m → m ≤ a
#align list.minimum_le_of_mem List.minimum_le_of_mem
-/
-#print List.le_maximum_of_mem' /-
+/- warning: list.le_maximum_of_mem' -> List.le_maximum_of_mem' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u1} (WithBot.{u1} α) (Preorder.toHasLe.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) a) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (LE.le.{u1} (WithBot.{u1} α) (Preorder.toLE.{u1} (WithBot.{u1} α) (WithBot.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (WithBot.some.{u1} α a) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
+Case conversion may be inaccurate. Consider using '#align list.le_maximum_of_mem' List.le_maximum_of_mem'ₓ'. -/
theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l :=
le_of_not_lt <| not_lt_maximum_of_mem' ha
#align list.le_maximum_of_mem' List.le_maximum_of_mem'
--/
-#print List.le_minimum_of_mem' /-
+/- warning: list.le_minimum_of_mem' -> List.le_minimum_of_mem' is a dubious translation:
+lean 3 declaration is
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) a l) -> (LE.le.{u1} (WithTop.{u1} α) (Preorder.toHasLe.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) a))
+but is expected to have type
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] {l : List.{u1} α} {a : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) a l) -> (LE.le.{u1} (WithTop.{u1} α) (Preorder.toLE.{u1} (WithTop.{u1} α) (WithTop.preorder.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l) (WithTop.some.{u1} α a))
+Case conversion may be inaccurate. Consider using '#align list.le_minimum_of_mem' List.le_minimum_of_mem'ₓ'. -/
theorem le_minimum_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
@le_maximum_of_mem' αᵒᵈ _ _ _ ha
#align list.le_minimum_of_mem' List.le_minimum_of_mem'
--/
#print List.minimum_concat /-
theorem minimum_concat (a : α) (l : List α) : minimum (l ++ [a]) = min (minimum l) a :=
@@ -607,7 +679,7 @@ variable [OrderBot α] {l : List α}
/- warning: list.foldr_max_of_ne_nil -> List.foldr_max_of_ne_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithBot.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithBot.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithBot.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithBot.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithBot.{u1} α) (WithBot.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithBot.{u1} α) (WithBot.some.{u1} α (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l)) (List.maximum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
Case conversion may be inaccurate. Consider using '#align list.foldr_max_of_ne_nil List.foldr_max_of_ne_nilₓ'. -/
@@ -624,7 +696,7 @@ theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
/- warning: list.max_le_of_forall_le -> List.max_le_of_forall_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a)) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x a)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l) a)
Case conversion may be inaccurate. Consider using '#align list.max_le_of_forall_le List.max_le_of_forall_leₓ'. -/
@@ -637,7 +709,7 @@ theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) :
/- warning: list.le_max_of_le -> List.le_max_of_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α} {a : α} {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α} {a : α} {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.max.{u1} α _inst_1) (Bot.bot.{u1} α (OrderBot.toHasBot.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α} {a : α} {x : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a x) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a (List.foldr.{u1, u1} α α (Max.max.{u1} α (LinearOrder.toMax.{u1} α _inst_1)) (Bot.bot.{u1} α (OrderBot.toBot.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l))
Case conversion may be inaccurate. Consider using '#align list.le_max_of_le List.le_max_of_leₓ'. -/
@@ -659,7 +731,7 @@ variable [OrderTop α] {l : List α}
/- warning: list.foldr_min_of_ne_nil -> List.foldr_min_of_ne_nil is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithTop.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithTop.{u1} α) ((fun (a : Type.{u1}) (b : Type.{u1}) [self : HasLiftT.{succ u1, succ u1} a b] => self.0) α (WithTop.{u1} α) (HasLiftT.mk.{succ u1, succ u1} α (WithTop.{u1} α) (CoeTCₓ.coe.{succ u1, succ u1} α (WithTop.{u1} α) (WithTop.hasCoeT.{u1} α))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l)) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))) (fun (a : α) (b : α) => LT.lt.decidable.{u1} α _inst_1 a b) l))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] {l : List.{u1} α}, (Ne.{succ u1} (List.{u1} α) l (List.nil.{u1} α)) -> (Eq.{succ u1} (WithTop.{u1} α) (WithTop.some.{u1} α (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l)) (List.minimum.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))) (fun (a : α) (b : α) => instDecidableLtToLTToPreorderToPartialOrder.{u1} α _inst_1 a b) l))
Case conversion may be inaccurate. Consider using '#align list.foldr_min_of_ne_nil List.foldr_min_of_ne_nilₓ'. -/
@@ -670,7 +742,7 @@ theorem foldr_min_of_ne_nil (h : l ≠ []) : ↑(l.foldr min ⊤) = l.minimum :=
/- warning: list.le_min_of_forall_le -> List.le_min_of_forall_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a x)) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) a (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l))
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α), (forall (x : α), (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a x)) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) a (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l))
Case conversion may be inaccurate. Consider using '#align list.le_min_of_forall_le List.le_min_of_forall_leₓ'. -/
@@ -680,7 +752,7 @@ theorem le_min_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, a ≤ x) :
/- warning: list.min_le_of_le -> List.min_le_of_le is a dubious translation:
lean 3 declaration is
- forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α) {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
+ forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1)))))] (l : List.{u1} α) (a : α) {x : α}, (Membership.Mem.{u1, u1} α (List.{u1} α) (List.hasMem.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) x a) -> (LE.le.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) (List.foldr.{u1, u1} α α (LinearOrder.min.{u1} α _inst_1) (Top.top.{u1} α (OrderTop.toHasTop.{u1} α (Preorder.toHasLe.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (LinearOrder.toLattice.{u1} α _inst_1))))) _inst_2)) l) a)
but is expected to have type
forall {α : Type.{u1}} [_inst_1 : LinearOrder.{u1} α] [_inst_2 : OrderTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1))))))] (l : List.{u1} α) (a : α) {x : α}, (Membership.mem.{u1, u1} α (List.{u1} α) (List.instMembershipList.{u1} α) x l) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) x a) -> (LE.le.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) (List.foldr.{u1, u1} α α (Min.min.{u1} α (LinearOrder.toMin.{u1} α _inst_1)) (Top.top.{u1} α (OrderTop.toTop.{u1} α (Preorder.toLE.{u1} α (PartialOrder.toPreorder.{u1} α (SemilatticeInf.toPartialOrder.{u1} α (Lattice.toSemilatticeInf.{u1} α (DistribLattice.toLattice.{u1} α (instDistribLattice.{u1} α _inst_1)))))) _inst_2)) l) a)
Case conversion may be inaccurate. Consider using '#align list.min_le_of_le List.min_le_of_leₓ'. -/
mathlib commit https://github.com/leanprover-community/mathlib/commit/ce7e9d53d4bbc38065db3b595cd5bd73c323bc1d
@@ -310,7 +310,7 @@ Case conversion may be inaccurate. Consider using '#align list.argmin_cons List.
theorem argmin_cons (f : α → β) (a : α) (l : List α) :
argmin f (a :: l) =
Option.casesOn (argmin f l) (some a) fun c => if f c < f a then some c else some a :=
- by convert @argmax_cons _ βᵒᵈ _ _ _ _
+ by convert@argmax_cons _ βᵒᵈ _ _ _ _
#align list.argmin_cons List.argmin_cons
variable [DecidableEq α]
mathlib commit https://github.com/leanprover-community/mathlib/commit/bd9851ca476957ea4549eb19b40e7b5ade9428cc
@@ -218,7 +218,7 @@ theorem index_of_argmax :
· cases not_le_of_lt ‹_› ‹_›
· rw [if_pos rfl]
· rw [if_neg, if_neg]
- exact Nat.succ_le_succ (index_of_argmax h (by assumption) ham)
+ · exact Nat.succ_le_succ (index_of_argmax h (by assumption) ham)
· exact ne_of_apply_ne f (lt_of_lt_of_le ‹_› ‹_›).ne
· exact ne_of_apply_ne _ ‹f hd < f _›.ne
· rw [if_pos rfl]
@@ -509,8 +509,8 @@ theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a
induction' l with y l IH
· exact absurd hx (not_mem_nil _)
· obtain hl | hl := hx
- simp only [foldr, foldr_cons]
- · exact le_max_of_le_left h
+ · simp only [foldr, foldr_cons]
+ exact le_max_of_le_left h
· exact le_max_of_le_right (IH (by assumption))
#align list.le_max_of_le List.le_max_of_le
@@ -24,9 +24,6 @@ The main definitions are `argmax`, `argmin`, `minimum` and `maximum` for lists.
`[]`
-/
-set_option autoImplicit true
-
-
namespace List
variable {α β : Type*}
@@ -444,12 +441,12 @@ lemma coe_minimum_of_length_pos (h : 0 < l.length) :
WithTop.coe_untop _ _
@[simp]
-theorem le_maximum_of_length_pos_iff (h : 0 < l.length) :
+theorem le_maximum_of_length_pos_iff {b : α} (h : 0 < l.length) :
b ≤ maximum_of_length_pos h ↔ b ≤ l.maximum :=
WithBot.le_unbot_iff _
@[simp]
-theorem minimum_of_length_pos_le_iff (h : 0 < l.length) :
+theorem minimum_of_length_pos_le_iff {b : α} (h : 0 < l.length) :
minimum_of_length_pos h ≤ b ↔ l.minimum ≤ b :=
le_maximum_of_length_pos_iff (α := αᵒᵈ) h
@@ -471,12 +468,12 @@ theorem minimum_of_length_pos_le_of_mem (h : a ∈ l) (w : 0 < l.length) :
l.minimum_of_length_pos w ≤ a :=
le_maximum_of_length_pos_of_mem (α := αᵒᵈ) h w
-theorem getElem_le_maximum_of_length_pos (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
+theorem getElem_le_maximum_of_length_pos {i : ℕ} (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
l[i] ≤ l.maximum_of_length_pos h := by
apply le_maximum_of_length_pos_of_mem
exact get_mem l i w
-theorem minimum_of_length_pos_le_getElem (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
+theorem minimum_of_length_pos_le_getElem {i : ℕ} (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
l.minimum_of_length_pos h ≤ l[i] :=
getElem_le_maximum_of_length_pos (α := αᵒᵈ) w
Use Nat
specialized theorems, and omega
, where necessary to avoid needing to import the abstract ordered algebra hierarchy for basic results about List
.
Import graph between Mathlib.Order.Basic
and Mathlib.Data.List.Basic
:
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -4,6 +4,8 @@ Released under Apache 2.0 license as described in the file LICENSE.
Authors: Minchao Wu, Chris Hughes, Mantas Bakšys
-/
import Mathlib.Data.List.Basic
+import Mathlib.Order.MinMax
+import Mathlib.Order.WithBot
#align_import data.list.min_max from "leanprover-community/mathlib"@"6d0adfa76594f304b4650d098273d4366edeb61b"
@@ -41,7 +41,8 @@ def argAux (a : Option α) (b : α) : Option α :=
@[simp]
theorem foldl_argAux_eq_none : l.foldl (argAux r) o = none ↔ l = [] ∧ o = none :=
List.reverseRecOn l (by simp) fun tl hd => by
- simp [argAux]; cases foldl (argAux r) o tl <;> simp; try split_ifs <;> simp
+ simp only [foldl_append, foldl_cons, argAux, foldl_nil, append_eq_nil, and_false, false_and,
+ iff_false]; cases foldl (argAux r) o tl <;> simp; try split_ifs <;> simp
#align list.foldl_arg_aux_eq_none List.foldl_argAux_eq_none
private theorem foldl_argAux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l :=
@@ -346,7 +346,7 @@ variable [LinearOrder α] {l : List α} {a m : α}
theorem maximum_concat (a : α) (l : List α) : maximum (l ++ [a]) = max (maximum l) a := by
simp only [maximum, argmax_concat, id]
- cases h : argmax id l
+ cases argmax id l
· exact (max_eq_right bot_le).symm
· simp [WithBot.some_eq_coe, max_def_lt, WithBot.coe_lt_coe]
#align list.maximum_concat List.maximum_concat
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -213,6 +213,7 @@ theorem index_of_argmax :
simp_all
rw [h] at hm
dsimp only at hm
+ simp only [cond_eq_if, beq_iff_eq]
obtain ha | ha := ha <;> split_ifs at hm <;> injection hm with hm <;> subst hm
· cases not_le_of_lt ‹_› ‹_›
· rw [if_pos rfl]
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Mario Carneiro <di.gama@gmail.com>
@@ -218,8 +218,8 @@ theorem index_of_argmax :
· rw [if_pos rfl]
· rw [if_neg, if_neg]
exact Nat.succ_le_succ (index_of_argmax h (by assumption) ham)
- · exact ne_of_apply_ne f (lt_of_lt_of_le ‹_› ‹_›).ne'
- · exact ne_of_apply_ne _ ‹f hd < f _›.ne'
+ · exact ne_of_apply_ne f (lt_of_lt_of_le ‹_› ‹_›).ne
+ · exact ne_of_apply_ne _ ‹f hd < f _›.ne
· rw [if_pos rfl]
exact Nat.zero_le _
#align list.index_of_argmax List.index_of_argmax
@@ -387,7 +387,7 @@ theorem maximum_le_of_forall_le {b : WithBot α} (h : ∀ a ∈ l, a ≤ b) : l.
exact ⟨h a (by simp), ih fun a w => h a (mem_cons.mpr (Or.inr w))⟩
theorem le_minimum_of_forall_le {b : WithTop α} (h : ∀ a ∈ l, b ≤ a) : b ≤ l.minimum :=
- maximum_le_of_forall_le (α:= αᵒᵈ) h
+ maximum_le_of_forall_le (α := αᵒᵈ) h
theorem maximum_eq_coe_iff : maximum l = m ↔ m ∈ l ∧ ∀ a ∈ l, a ≤ m := by
rw [maximum, ← WithBot.some_eq_coe, argmax_eq_some_iff]
@@ -449,6 +449,15 @@ theorem minimum_of_length_pos_le_iff (h : 0 < l.length) :
minimum_of_length_pos h ≤ b ↔ l.minimum ≤ b :=
le_maximum_of_length_pos_iff (α := αᵒᵈ) h
+theorem maximum_of_length_pos_mem (h : 0 < l.length) :
+ maximum_of_length_pos h ∈ l := by
+ apply maximum_mem
+ simp only [coe_maximum_of_length_pos]
+
+theorem minimum_of_length_pos_mem (h : 0 < l.length) :
+ minimum_of_length_pos h ∈ l :=
+ maximum_of_length_pos_mem (α := αᵒᵈ) h
+
theorem le_maximum_of_length_pos_of_mem (h : a ∈ l) (w : 0 < l.length) :
a ≤ l.maximum_of_length_pos w := by
simp only [le_maximum_of_length_pos_iff]
Removes nonterminal simps on lines looking like simp [...]
@@ -451,7 +451,7 @@ theorem minimum_of_length_pos_le_iff (h : 0 < l.length) :
theorem le_maximum_of_length_pos_of_mem (h : a ∈ l) (w : 0 < l.length) :
a ≤ l.maximum_of_length_pos w := by
- simp [le_maximum_of_length_pos_iff]
+ simp only [le_maximum_of_length_pos_iff]
exact le_maximum_of_mem' h
theorem minimum_of_length_pos_le_of_mem (h : a ∈ l) (w : 0 < l.length) :
@@ -450,12 +450,12 @@ theorem minimum_of_length_pos_le_iff (h : 0 < l.length) :
le_maximum_of_length_pos_iff (α := αᵒᵈ) h
theorem le_maximum_of_length_pos_of_mem (h : a ∈ l) (w : 0 < l.length) :
- a ≤ l.maximum_of_length_pos w := by
+ a ≤ l.maximum_of_length_pos w := by
simp [le_maximum_of_length_pos_iff]
exact le_maximum_of_mem' h
theorem minimum_of_length_pos_le_of_mem (h : a ∈ l) (w : 0 < l.length) :
- l.minimum_of_length_pos w ≤ a :=
+ l.minimum_of_length_pos w ≤ a :=
le_maximum_of_length_pos_of_mem (α := αᵒᵈ) h w
theorem getElem_le_maximum_of_length_pos (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
Co-authored-by: Scott Morrison <scott.morrison@gmail.com> Co-authored-by: Eric Wieser <wieser.eric@gmail.com> Co-authored-by: Thomas Browning <tb65536@uw.edu> Co-authored-by: Chris Hughes <chrishughes24@gmail.com> Co-authored-by: Oliver Nash <github@olivernash.org> Co-authored-by: sgouezel <sebastien.gouezel@univ-rennes1.fr> Co-authored-by: Alex J Best <alex.j.best@gmail.com> Co-authored-by: Xavier Roblot <46200072+xroblot@users.noreply.github.com> Co-authored-by: michaellee94 <michael_lee1@brown.edu>
@@ -362,9 +362,9 @@ theorem le_maximum_of_mem' (ha : a ∈ l) : (a : WithBot α) ≤ maximum l :=
le_of_not_lt <| not_lt_maximum_of_mem' ha
#align list.le_maximum_of_mem' List.le_maximum_of_mem'
-theorem le_minimum_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
+theorem minimum_le_of_mem' (ha : a ∈ l) : minimum l ≤ (a : WithTop α) :=
@le_maximum_of_mem' αᵒᵈ _ _ _ ha
-#align list.le_minimum_of_mem' List.le_minimum_of_mem'
+#align list.le_minimum_of_mem' List.minimum_le_of_mem'
theorem minimum_concat (a : α) (l : List α) : minimum (l ++ [a]) = min (minimum l) a :=
@maximum_concat αᵒᵈ _ _ _
@@ -379,6 +379,16 @@ theorem minimum_cons (a : α) (l : List α) : minimum (a :: l) = min ↑a (minim
@maximum_cons αᵒᵈ _ _ _
#align list.minimum_cons List.minimum_cons
+theorem maximum_le_of_forall_le {b : WithBot α} (h : ∀ a ∈ l, a ≤ b) : l.maximum ≤ b := by
+ induction l with
+ | nil => simp
+ | cons a l ih =>
+ simp only [maximum_cons, ge_iff_le, max_le_iff, WithBot.coe_le_coe]
+ exact ⟨h a (by simp), ih fun a w => h a (mem_cons.mpr (Or.inr w))⟩
+
+theorem le_minimum_of_forall_le {b : WithTop α} (h : ∀ a ∈ l, b ≤ a) : b ≤ l.minimum :=
+ maximum_le_of_forall_le (α:= αᵒᵈ) h
+
theorem maximum_eq_coe_iff : maximum l = m ↔ m ∈ l ∧ ∀ a ∈ l, a ≤ m := by
rw [maximum, ← WithBot.some_eq_coe, argmax_eq_some_iff]
simp only [id_eq, and_congr_right_iff, and_iff_left_iff_imp]
Autoimplicits are highly controversial and also defeat the performance-improving work in #6474.
The intent of this PR is to make autoImplicit
opt-in on a per-file basis, by disabling it in the lakefile and enabling it again with set_option autoImplicit true
in the few files that rely on it.
That also keeps this PR small, as opposed to attempting to "fix" files to not need it any more.
I claim that many of the uses of autoImplicit
in these files are accidental; situations such as:
variables
are in scope, but pasting the lemma in the wrong sectionHaving set_option autoImplicit false
as the default prevents these types of mistake being made in the 90% of files where autoImplicit
s are not used at all, and causes them to be caught by CI during review.
I think there were various points during the port where we encouraged porters to delete the universes u v
lines; I think having autoparams for universe variables only would cover a lot of the cases we actually use them, while avoiding any real shortcomings.
A Zulip poll (after combining overlapping votes accordingly) was in favor of this change with 5:5:18
as the no:dontcare:yes
vote ratio.
While this PR was being reviewed, a handful of files gained some more likely-accidental autoImplicits. In these places, set_option autoImplicit true
has been placed locally within a section, rather than at the top of the file.
@@ -22,6 +22,8 @@ The main definitions are `argmax`, `argmin`, `minimum` and `maximum` for lists.
`[]`
-/
+set_option autoImplicit true
+
namespace List
Type _
and Sort _
(#6499)
We remove all possible occurences of Type _
and Sort _
in favor of Type*
and Sort*
.
This has nice performance benefits.
@@ -25,7 +25,7 @@ The main definitions are `argmax`, `argmin`, `minimum` and `maximum` for lists.
namespace List
-variable {α β : Type _}
+variable {α β : Type*}
section ArgAux
@@ -392,25 +392,68 @@ theorem coe_le_maximum_iff : a ≤ l.maximum ↔ ∃ b, b ∈ l ∧ a ≤ b := b
induction l with
| nil => simp
| cons h t ih =>
- simp [List.maximum_cons, ih]
+ simp [maximum_cons, ih]
-theorem minimum_le_coe_iff : l.minimum ≤ a ↔ ∃ b, b ∈ l ∧ b ≤ a := by
- induction l with
- | nil => simp
- | cons h t ih =>
- simp [List.minimum_cons, ih]
+theorem minimum_le_coe_iff : l.minimum ≤ a ↔ ∃ b, b ∈ l ∧ b ≤ a :=
+ coe_le_maximum_iff (α := αᵒᵈ)
+
+theorem maximum_ne_bot_of_ne_nil (h : l ≠ []) : l.maximum ≠ ⊥ :=
+ match l, h with | _ :: _, _ => by simp [maximum_cons]
-theorem maximum_ne_bot_of_ne_nil {l : List α} (h : l ≠ []) : l.maximum ≠ ⊥ :=
- match l, h with | _ :: _, _ => by simp [List.maximum_cons]
+theorem minimum_ne_top_of_ne_nil (h : l ≠ []) : l.minimum ≠ ⊤ :=
+ @maximum_ne_bot_of_ne_nil αᵒᵈ _ _ h
-theorem minimum_ne_top_of_ne_nil {l : List α} (h : l ≠ []) : l.minimum ≠ ⊤ :=
- @List.maximum_ne_bot_of_ne_nil αᵒᵈ _ _ h
+theorem maximum_ne_bot_of_length_pos (h : 0 < l.length) : l.maximum ≠ ⊥ :=
+ match l, h with | _ :: _, _ => by simp [maximum_cons]
-theorem maximum_ne_bot_of_length_pos {l : List α} (h : 0 < l.length) : l.maximum ≠ ⊥ :=
- match l, h with | _ :: _, _ => by simp [List.maximum_cons]
+theorem minimum_ne_top_of_length_pos (h : 0 < l.length) : l.minimum ≠ ⊤ :=
+ maximum_ne_bot_of_length_pos (α := αᵒᵈ) h
-theorem minimum_ne_top_of_length_pos {l : List α} (h : 0 < l.length) : l.minimum ≠ ⊤ :=
- @List.maximum_ne_bot_of_length_pos αᵒᵈ _ _ h
+/-- The maximum value in a non-empty `List`. -/
+def maximum_of_length_pos (h : 0 < l.length) : α :=
+ WithBot.unbot l.maximum (maximum_ne_bot_of_length_pos h)
+
+/-- The minimum value in a non-empty `List`. -/
+def minimum_of_length_pos (h : 0 < l.length) : α :=
+ maximum_of_length_pos (α := αᵒᵈ) h
+
+@[simp]
+lemma coe_maximum_of_length_pos (h : 0 < l.length) :
+ (l.maximum_of_length_pos h : α) = l.maximum :=
+ WithBot.coe_unbot _ _
+
+@[simp]
+lemma coe_minimum_of_length_pos (h : 0 < l.length) :
+ (l.minimum_of_length_pos h : α) = l.minimum :=
+ WithTop.coe_untop _ _
+
+@[simp]
+theorem le_maximum_of_length_pos_iff (h : 0 < l.length) :
+ b ≤ maximum_of_length_pos h ↔ b ≤ l.maximum :=
+ WithBot.le_unbot_iff _
+
+@[simp]
+theorem minimum_of_length_pos_le_iff (h : 0 < l.length) :
+ minimum_of_length_pos h ≤ b ↔ l.minimum ≤ b :=
+ le_maximum_of_length_pos_iff (α := αᵒᵈ) h
+
+theorem le_maximum_of_length_pos_of_mem (h : a ∈ l) (w : 0 < l.length) :
+ a ≤ l.maximum_of_length_pos w := by
+ simp [le_maximum_of_length_pos_iff]
+ exact le_maximum_of_mem' h
+
+theorem minimum_of_length_pos_le_of_mem (h : a ∈ l) (w : 0 < l.length) :
+ l.minimum_of_length_pos w ≤ a :=
+ le_maximum_of_length_pos_of_mem (α := αᵒᵈ) h w
+
+theorem getElem_le_maximum_of_length_pos (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
+ l[i] ≤ l.maximum_of_length_pos h := by
+ apply le_maximum_of_length_pos_of_mem
+ exact get_mem l i w
+
+theorem minimum_of_length_pos_le_getElem (w : i < l.length) (h := (Nat.zero_lt_of_lt w)) :
+ l.minimum_of_length_pos h ≤ l[i] :=
+ getElem_le_maximum_of_length_pos (α := αᵒᵈ) w
end LinearOrder
No particular objection if we only want one out of the _ne_nil
and _length_pos
pairs, but I like wall-to-wall coverage so exact?
always works. :-)
(For context, the place I needed these more naturally wanted the _length_pos
lemmas.)
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
@@ -400,6 +400,18 @@ theorem minimum_le_coe_iff : l.minimum ≤ a ↔ ∃ b, b ∈ l ∧ b ≤ a := b
| cons h t ih =>
simp [List.minimum_cons, ih]
+theorem maximum_ne_bot_of_ne_nil {l : List α} (h : l ≠ []) : l.maximum ≠ ⊥ :=
+ match l, h with | _ :: _, _ => by simp [List.maximum_cons]
+
+theorem minimum_ne_top_of_ne_nil {l : List α} (h : l ≠ []) : l.minimum ≠ ⊤ :=
+ @List.maximum_ne_bot_of_ne_nil αᵒᵈ _ _ h
+
+theorem maximum_ne_bot_of_length_pos {l : List α} (h : 0 < l.length) : l.maximum ≠ ⊥ :=
+ match l, h with | _ :: _, _ => by simp [List.maximum_cons]
+
+theorem minimum_ne_top_of_length_pos {l : List α} (h : 0 < l.length) : l.minimum ≠ ⊤ :=
+ @List.maximum_ne_bot_of_length_pos αᵒᵈ _ _ h
+
end LinearOrder
end MaximumMinimum
@@ -2,14 +2,11 @@
Copyright (c) 2019 Minchao Wu. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Minchao Wu, Chris Hughes, Mantas Bakšys
-
-! This file was ported from Lean 3 source module data.list.min_max
-! leanprover-community/mathlib commit 6d0adfa76594f304b4650d098273d4366edeb61b
-! Please do not edit these lines, except to modify the commit id
-! if you have ported upstream changes.
-/
import Mathlib.Data.List.Basic
+#align_import data.list.min_max from "leanprover-community/mathlib"@"6d0adfa76594f304b4650d098273d4366edeb61b"
+
/-!
# Minimum and maximum of lists
@@ -391,6 +391,18 @@ theorem minimum_eq_coe_iff : minimum l = m ↔ m ∈ l ∧ ∀ a ∈ l, m ≤ a
@maximum_eq_coe_iff αᵒᵈ _ _ _
#align list.minimum_eq_coe_iff List.minimum_eq_coe_iff
+theorem coe_le_maximum_iff : a ≤ l.maximum ↔ ∃ b, b ∈ l ∧ a ≤ b := by
+ induction l with
+ | nil => simp
+ | cons h t ih =>
+ simp [List.maximum_cons, ih]
+
+theorem minimum_le_coe_iff : l.minimum ≤ a ↔ ∃ b, b ∈ l ∧ b ≤ a := by
+ induction l with
+ | nil => simp
+ | cons h t ih =>
+ simp [List.minimum_cons, ih]
+
end LinearOrder
end MaximumMinimum
This PR is the result of running
find . -type f -name "*.lean" -exec sed -i -E 's/^( +)\. /\1· /' {} \;
find . -type f -name "*.lean" -exec sed -i -E 'N;s/^( +·)\n +(.*)$/\1 \2/;P;D' {} \;
which firstly replaces .
focusing dots with ·
and secondly removes isolated instances of such dots, unifying them with the following line. A new rule is placed in the style linter to verify this.
@@ -217,11 +217,11 @@ theorem index_of_argmax :
obtain ha | ha := ha <;> split_ifs at hm <;> injection hm with hm <;> subst hm
· cases not_le_of_lt ‹_› ‹_›
· rw [if_pos rfl]
- . rw [if_neg, if_neg]
+ · rw [if_neg, if_neg]
exact Nat.succ_le_succ (index_of_argmax h (by assumption) ham)
· exact ne_of_apply_ne f (lt_of_lt_of_le ‹_› ‹_›).ne'
· exact ne_of_apply_ne _ ‹f hd < f _›.ne'
- . rw [if_pos rfl]
+ · rw [if_pos rfl]
exact Nat.zero_le _
#align list.index_of_argmax List.index_of_argmax
at
and goals (#5387)
Changes are of the form
some_tactic at h⊢
-> some_tactic at h ⊢
some_tactic at h
-> some_tactic at h
@@ -208,7 +208,7 @@ theorem index_of_argmax :
∀ {l : List α} {m : α}, m ∈ argmax f l → ∀ {a}, a ∈ l → f m ≤ f a → l.indexOf m ≤ l.indexOf a
| [], m, _, _, _, _ => by simp
| hd :: tl, m, hm, a, ha, ham => by
- simp only [indexOf_cons, argmax_cons, Option.mem_def] at hm⊢
+ simp only [indexOf_cons, argmax_cons, Option.mem_def] at hm ⊢
cases h : argmax f tl
· rw [h] at hm
simp_all
I wrote a script to find lines that contain an odd number of backticks
@@ -19,7 +19,7 @@ The main definitions are `argmax`, `argmin`, `minimum` and `maximum` for lists.
`argmax f l` returns `some a`, where `a` of `l` that maximises `f a`. If there are `a b` such that
`f a = f b`, it returns whichever of `a` or `b` comes first in the list.
- `argmax f []` = none`
+ `argmax f [] = none`
`minimum l` returns a `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]`
@@ -95,14 +95,14 @@ variable [Preorder β] [@DecidableRel β (· < ·)] {f : α → β} {l : List α
/-- `argmax f l` returns `some a`, where `f a` is maximal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f a < f b`. If `a`, `b` are such that `f a = f b`, it returns
-whichever of `a` or `b` comes first in the list. `argmax f []` = none`. -/
+whichever of `a` or `b` comes first in the list. `argmax f [] = none`. -/
def argmax (f : α → β) (l : List α) : Option α :=
l.foldl (argAux fun b c => f c < f b) none
#align list.argmax List.argmax
/-- `argmin f l` returns `some a`, where `f a` is minimal among the elements of `l`, in the sense
that there is no `b ∈ l` with `f b < f a`. If `a`, `b` are such that `f a = f b`, it returns
-whichever of `a` or `b` comes first in the list. `argmin f []` = none`. -/
+whichever of `a` or `b` comes first in the list. `argmin f [] = none`. -/
def argmin (f : α → β) (l : List α) :=
l.foldl (argAux fun b c => f b < f c) none
#align list.argmin List.argmin
@@ -21,7 +21,7 @@ The main definitions are `argmax`, `argmin`, `minimum` and `maximum` for lists.
`f a = f b`, it returns whichever of `a` or `b` comes first in the list.
`argmax f []` = none`
-`minimum l` returns an `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
+`minimum l` returns a `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]`
-/
@@ -270,13 +270,13 @@ section Preorder
variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
-/-- `maximum l` returns an `WithBot α`, the largest element of `l` for nonempty lists, and `⊥` for
+/-- `maximum l` returns a `WithBot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
def maximum (l : List α) : WithBot α :=
argmax id l
#align list.maximum List.maximum
-/-- `minimum l` returns an `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
+/-- `minimum l` returns a `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
def minimum (l : List α) : WithTop α :=
argmin id l
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".
@@ -235,13 +235,13 @@ theorem mem_argmax_iff :
m ∈ l ∧ (∀ a ∈ l, f a ≤ f m) ∧ ∀ a ∈ l, f m ≤ f a → l.indexOf m ≤ l.indexOf a :=
⟨fun hm => ⟨argmax_mem hm, fun a ha => le_of_mem_argmax ha hm, fun _ => index_of_argmax hm⟩,
by
- rintro ⟨hml, ham, hma⟩
- cases' harg : argmax f l with n
- · simp_all
- · have :=
- _root_.le_antisymm (hma n (argmax_mem harg) (le_of_mem_argmax hml harg))
- (index_of_argmax harg hml (ham _ (argmax_mem harg)))
- rw [(indexOf_inj hml (argmax_mem harg)).1 this, Option.mem_def]⟩
+ rintro ⟨hml, ham, hma⟩
+ cases' harg : argmax f l with n
+ · simp_all
+ · have :=
+ _root_.le_antisymm (hma n (argmax_mem harg) (le_of_mem_argmax hml harg))
+ (index_of_argmax harg hml (ham _ (argmax_mem harg)))
+ rw [(indexOf_inj hml (argmax_mem harg)).1 this, Option.mem_def]⟩
#align list.mem_argmax_iff List.mem_argmax_iff
theorem argmax_eq_some_iff :
@@ -45,7 +45,7 @@ theorem foldl_argAux_eq_none : l.foldl (argAux r) o = none ↔ l = [] ∧ o = no
simp [argAux]; cases foldl (argAux r) o tl <;> simp; try split_ifs <;> simp
#align list.foldl_arg_aux_eq_none List.foldl_argAux_eq_none
-private theorem foldl_arg_aux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l :=
+private theorem foldl_argAux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (some a) l → m ∈ a :: l :=
List.reverseRecOn l (by simp [eq_comm])
(by
intro tl hd ih a m
@@ -63,9 +63,9 @@ private theorem foldl_arg_aux_mem (l) : ∀ a m : α, m ∈ foldl (argAux r) (so
· simp (config := { contextual := true }) [@eq_comm _ _ m, H])
@[simp]
-theorem arg_aux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a :=
+theorem argAux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a :=
if_neg <| hr₀ _
-#align list.arg_aux_self List.arg_aux_self
+#align list.arg_aux_self List.argAux_self
theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m := by
@@ -151,7 +151,7 @@ theorem argmin_concat (f : α → β) (a : α) (l : List α) :
theorem argmax_mem : ∀ {l : List α} {m : α}, m ∈ argmax f l → m ∈ l
| [], m => by simp
- | hd :: tl, m => by simpa [argmax, argAux] using foldl_arg_aux_mem _ tl hd m
+ | hd :: tl, m => by simpa [argmax, argAux] using foldl_argAux_mem _ tl hd m
#align list.argmax_mem List.argmax_mem
theorem argmin_mem : ∀ {l : List α} {m : α}, m ∈ argmin f l → m ∈ l :=
@@ -184,8 +184,7 @@ theorem le_of_mem_argmin : a ∈ l → m ∈ argmin f l → f m ≤ f a :=
theorem argmax_cons (f : α → β) (a : α) (l : List α) :
argmax f (a :: l) =
Option.casesOn (argmax f l) (some a) fun c => if f a < f c then some c else some a :=
- List.reverseRecOn l rfl fun hd tl ih =>
- by
+ List.reverseRecOn l rfl fun hd tl ih => by
rw [← cons_append, argmax_concat, ih, argmax_concat]
cases' h : argmax f hd with m
· simp [h]
@@ -271,13 +271,13 @@ section Preorder
variable [Preorder α] [@DecidableRel α (· < ·)] {l : List α} {a m : α}
-/-- `maximum l` returns an `with_bot α`, the largest element of `l` for nonempty lists, and `⊥` for
+/-- `maximum l` returns an `WithBot α`, the largest element of `l` for nonempty lists, and `⊥` for
`[]` -/
def maximum (l : List α) : WithBot α :=
argmax id l
#align list.maximum List.maximum
-/-- `minimum l` returns an `with_top α`, the smallest element of `l` for nonempty lists, and `⊤` for
+/-- `minimum l` returns an `WithTop α`, the smallest element of `l` for nonempty lists, and `⊤` for
`[]` -/
def minimum (l : List α) : WithTop α :=
argmin id l
by
line breaks (#1523)
During porting, I usually fix the desired format we seem to want for the line breaks around by
with
awk '{do {{if (match($0, "^ by$") && length(p) < 98) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}' Mathlib/File/Im/Working/On.lean
I noticed there are some more files that slipped through.
This pull request is the result of running this command:
grep -lr "^ by\$" Mathlib | xargs -n 1 awk -i inplace '{do {{if (match($0, "^ by$") && length(p) < 98 && not (match(p, "^[ \t]*--"))) {p=p " by";} else {if (NR!=1) {print p}; p=$0}}} while (getline == 1) if (getline==0) print p}'
Co-authored-by: Moritz Firsching <firsching@google.com>
@@ -68,8 +68,7 @@ theorem arg_aux_self (hr₀ : Irreflexive r) (a : α) : argAux r (some a) a = a
#align list.arg_aux_self List.arg_aux_self
theorem not_of_mem_foldl_argAux (hr₀ : Irreflexive r) (hr₁ : Transitive r) :
- ∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m :=
- by
+ ∀ {a m : α} {o : Option α}, a ∈ l → m ∈ foldl (argAux r) o l → ¬r a m := by
induction' l using List.reverseRecOn with tl a ih
· simp
intro b m o hb ho
@@ -346,8 +345,7 @@ section LinearOrder
variable [LinearOrder α] {l : List α} {a m : α}
-theorem maximum_concat (a : α) (l : List α) : maximum (l ++ [a]) = max (maximum l) a :=
- by
+theorem maximum_concat (a : α) (l : List α) : maximum (l ++ [a]) = max (maximum l) a := by
simp only [maximum, argmax_concat, id]
cases h : argmax id l
· exact (max_eq_right bot_le).symm
@@ -407,8 +405,7 @@ section OrderBot
variable [OrderBot α] {l : List α}
@[simp]
-theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
- by
+theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum := by
induction' l with hd tl IH
· contradiction
· rw [maximum_cons, foldr, WithBot.coe_max]
@@ -417,15 +414,13 @@ theorem foldr_max_of_ne_nil (h : l ≠ []) : ↑(l.foldr max ⊥) = l.maximum :=
· simp [IH h]
#align list.foldr_max_of_ne_nil List.foldr_max_of_ne_nil
-theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) : l.foldr max ⊥ ≤ a :=
- by
+theorem max_le_of_forall_le (l : List α) (a : α) (h : ∀ x ∈ l, x ≤ a) : l.foldr max ⊥ ≤ a := by
induction' l with y l IH
· simp
· simpa [h y (mem_cons_self _ _)] using IH fun x hx => h x <| mem_cons_of_mem _ hx
#align list.max_le_of_forall_le List.max_le_of_forall_le
-theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a ≤ l.foldr max ⊥ :=
- by
+theorem le_max_of_le {l : List α} {a x : α} (hx : x ∈ l) (h : a ≤ x) : a ≤ l.foldr max ⊥ := by
induction' l with y l IH
· exact absurd hx (not_mem_nil _)
· obtain hl | hl := hx