l3lab/ntp-mathlib huggingface dataset:
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : f a < f m
h✝¹ : f m < f tl
h✝ : f a < f tl
⊢ some tl = some tl

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : f a < f m
h✝¹ : f m < f tl
h✝ : f a < f tl
⊢ some tl = some tl

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : f a < f m
h✝¹ : f m < f tl
h✝ : ¬f a < f tl
⊢ some tl = some a

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : f a < f m
h✝¹ : f m < f tl
h✝ : ¬f a < f tl
⊢ some tl = some a

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝¹ : f a < f m
h✝ : ¬f m < f tl
⊢ some m = some m

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝¹ : f a < f m
h✝ : ¬f m < f tl
⊢ some m = some m

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : f a < f tl
h✝ : f m < f tl
⊢ some tl = some tl

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : f a < f tl
h✝ : f m < f tl
⊢ some tl = some tl

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : f a < f tl
h✝ : ¬f m < f tl
⊢ some tl = some a

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : f a < f tl
h✝ : ¬f m < f tl
⊢ some tl = some a

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : ¬f a < f tl
h✝ : f m < f tl
⊢ some a = some a

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : ¬f a < f tl
h✝ : f m < f tl
⊢ some a = some a

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : ¬f a < f tl
h✝ : ¬f m < f tl
⊢ some a = some a

Next tactic:
try rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : ¬f a < f tl
h✝ : ¬f m < f tl
⊢ some a = some a

Next tactic:
rfl
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try rfl
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : f a < f m
h✝¹ : f m < f tl
h✝ : ¬f a < f tl
⊢ some tl = some a

Next tactic:
exact absurd (lt_trans ‹f a < f m› ‹_›) ‹_›
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
    rw [← cons_append, argmax_concat, ih, argmax_concat]
    cases' h : argmax f hd with m
    · simp [h]
    dsimp
    rw [← apply_ite, ← apply_ite]
    dsimp
    split_ifs <;> try rfl
    · exact absurd (lt_trans ‹f a < f m› ‹_›) ‹_›
    · 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝ : LinearOrder β
f✝ : α → β
l✝ : List α
o : Option α
a✝ m✝ : α
f : α → β
a : α
l hd : List α
tl : α
ih : argmax f (a :: hd) = Option.casesOn (argmax f hd) (some a) fun c => if f a < f c then some c else some a
m : α
h : argmax f hd = some m
h✝² : ¬f a < f m
h✝¹ : f a < f tl
h✝ : ¬f m < f tl
⊢ some tl = some a

Next tactic:
cases (‹f a < f tl›.lt_or_lt _).elim ‹_› ‹_›
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 

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a m✝ : α
inst✝ : DecidableEq α
m : α
x✝³ : m ∈ argmax f []
x✝² : α
x✝¹ : x✝² ∈ []
x✝ : f m ≤ f x✝²
⊢ indexOf m [] ≤ indexOf x✝² []

Next tactic:
simp
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
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m : α
hm : m ∈ argmax f (hd :: tl)
a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
⊢ indexOf m (hd :: tl) ≤ indexOf a (hd :: tl)

Next tactic:
simp only [indexOf_cons, argmax_cons, Option.mem_def] at hm ⊢
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 ⊢
    

Proof state:
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
hm : Option.rec (some hd) (fun val => if f hd < f val then some val else some hd) (argmax f tl) = some m
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
cases h : argmax f tl
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 ⊢
    cases h : argmax f tl
    · 

Proof state:
case none
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
hm : Option.rec (some hd) (fun val => if f hd < f val then some val else some hd) (argmax f tl) = some m
h : argmax f tl = none
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
rw [h] at hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      

Proof state:
case none
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
hm : Option.rec (some hd) (fun val => if f hd < f val then some val else some hd) none = some m
h : argmax f tl = none
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
simp_all
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
hm : Option.rec (some hd) (fun val => if f hd < f val then some val else some hd) (argmax f tl) = some m
val✝ : α
h : argmax f tl = some val✝
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
rw [h] at hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    rw [h] at hm
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
val✝ : α
hm : Option.rec (some hd) (fun val => if f hd < f val then some val else some hd) (some val✝) = some m
h : argmax f tl = some val✝
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
dsimp only at hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    rw [h] at hm
    dsimp only at hm
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
val✝ : α
hm : (if f hd < f val✝ then some val✝ else some hd) = some m
h : argmax f tl = some val✝
⊢ (bif hd == m then 0 else indexOf m tl + 1) ≤ bif hd == a then 0 else indexOf a tl + 1

Next tactic:
simp only [cond_eq_if, beq_iff_eq]
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    rw [h] at hm
    dsimp only at hm
    simp only [cond_eq_if, beq_iff_eq]
    

Proof state:
case some
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ha : a ∈ hd :: tl
ham : f m ≤ f a
val✝ : α
hm : (if f hd < f val✝ then some val✝ else some hd) = some m
h : argmax f tl = some val✝
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = a then 0 else indexOf a tl + 1

Next tactic:
obtain ha | ha := ha
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    rw [h] at hm
    dsimp only at hm
    simp only [cond_eq_if, beq_iff_eq]
    obtain ha | ha := ha <;> 

Proof state:
case some.head
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m val✝ : α
hm : (if f hd < f val✝ then some val✝ else some hd) = some m
h : argmax f tl = some val✝
ham : f m ≤ f hd
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = hd then 0 else indexOf hd tl + 1

Next tactic:
split_ifs at hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      simp_all
    rw [h] at hm
    dsimp only at hm
    simp only [cond_eq_if, beq_iff_eq]
    obtain ha | ha := ha <;> 

Proof state:
case some.tail
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝¹ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ham : f m ≤ f a
val✝ : α
hm : (if f hd < f val✝ then some val✝ else some hd) = some m
h : argmax f tl = some val✝
a✝ : Mem a tl
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = a then 0 else indexOf a tl + 1

Next tactic:
split_ifs at hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      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 <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m val✝ : α
h : argmax f tl = some val✝
ham : f m ≤ f hd
h✝ : f hd < f val✝
hm : some val✝ = some m
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = hd then 0 else indexOf hd tl + 1

Next tactic:
injection hm with hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      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 <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m val✝ : α
h : argmax f tl = some val✝
ham : f m ≤ f hd
h✝ : ¬f hd < f val✝
hm : some hd = some m
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = hd then 0 else indexOf hd tl + 1

Next tactic:
injection hm with hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      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 <;> 

Proof state:
case pos
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝¹ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ham : f m ≤ f a
val✝ : α
h : argmax f tl = some val✝
a✝ : Mem a tl
h✝ : f hd < f val✝
hm : some val✝ = some m
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = a then 0 else indexOf a tl + 1

Next tactic:
injection hm with hm
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 ⊢
    cases h : argmax f tl
    · rw [h] at hm
      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 <;> 

Proof state:
case neg
α : Type u_1
β : Type u_2
inst✝¹ : LinearOrder β
f : α → β
l : List α
o : Option α
a✝¹ m✝ : α
inst✝ : DecidableEq α
hd : α
tl : List α
m a : α
ham : f m ≤ f a
val✝ : α
h : argmax f tl = some val✝
a✝ : Mem a tl
h✝ : ¬f hd < f val✝
hm : some hd = some m
⊢ (if hd = m then 0 else indexOf m tl + 1) ≤ if hd = a then 0 else indexOf a tl + 1

Next tactic:
injection hm with hm