File tree Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Expand file tree Collapse file tree 1 file changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -487,6 +487,26 @@ theorem minimum_of_length_pos_le_getElem {i : ℕ} (w : i < l.length) (h := (Nat
487
487
l.minimum_of_length_pos h ≤ l[i] :=
488
488
getElem_le_maximum_of_length_pos (α := αᵒᵈ) w
489
489
490
+ lemma getD_maximum?_eq_unbot'_maximum (l : List α) (d : α) :
491
+ l.maximum?.getD d = l.maximum.unbot' d := by
492
+ cases hy : l.maximum with
493
+ | bot => simp [List.maximum_eq_bot.mp hy]
494
+ | coe y =>
495
+ rw [List.maximum_eq_coe_iff] at hy
496
+ simp only [WithBot.unbot'_coe]
497
+ cases hz : l.maximum? with
498
+ | none => simp [List.maximum?_eq_none_iff.mp hz] at hy
499
+ | some z =>
500
+ have : Antisymm (α := α) (· ≤ ·) := ⟨_root_.le_antisymm⟩
501
+ rw [List.maximum?_eq_some_iff] at hz
502
+ · rw [Option.getD_some]
503
+ exact _root_.le_antisymm (hy.right _ hz.left) (hz.right _ hy.left)
504
+ all_goals simp [le_total]
505
+
506
+ lemma getD_minimum?_eq_untop'_minimum (l : List α) (d : α) :
507
+ l.minimum?.getD d = l.minimum.untop' d :=
508
+ getD_maximum?_eq_unbot'_maximum (α := αᵒᵈ) _ _
509
+
490
510
end LinearOrder
491
511
492
512
end MaximumMinimum
You can’t perform that action at this time.
0 commit comments