@@ -13,6 +13,7 @@ public import Std.Data.Internal.List.Defs
1313import all Std.Data.Internal.List.Defs
1414public import Init.Data.Order.Ord
1515import Init.Data.Subtype.Order
16+ public import Init.Data.Order.ClassesExtra
1617
1718public section
1819
@@ -8249,6 +8250,90 @@ theorem containsKey_minKey? [Ord α] [TransOrd α] [BEq α] [LawfulBEqOrd α] {l
82498250 obtain ⟨e, ⟨hm, _⟩, rfl⟩ := hkm
82508251 exact containsKey_of_mem hm
82518252
8253+ theorem List.minKey ?_compare_eq_min ?_map_fst [Ord α] [TransOrd α] [LE α] [Min α] [Std.LawfulOrderOrd α] [Std.LawfulOrderMin α] [Std.LawfulEqOrd α]
8254+ (l : List ((a : α) × β a)) :
8255+ List.minKey? l = (l.map Sigma.fst).min? := by
8256+ induction l
8257+ case nil =>
8258+ simp [minKey?_of_isEmpty]
8259+ case cons h t ih =>
8260+ simp [minKey?, minEntry?_cons]
8261+ simp [minEntry?]
8262+ split
8263+ case h_1 => sorry
8264+ case h_2 _ w heq =>
8265+ have : Associative (min : α → α → α) := by sorry
8266+ simp [List.min?_cons]
8267+ simp [min]
8268+ split
8269+ case isTrue heq2 =>
8270+ rw [← ih]
8271+ simp [Option.elim]
8272+ split
8273+ case h_1 _ _ v heq3 =>
8274+ rw [minKey?, minEntry?] at heq3
8275+ rw [heq] at heq3
8276+ simp at heq3
8277+ rw [← heq3]
8278+ have leq := (@Std.LawfulOrderOrd.isLE_compare α _ _ _ h.fst w.fst).1 heq2
8279+ apply Or.elim <| @MinEqOr.min_eq_or α _ _ h.fst w.fst
8280+ case left =>
8281+ intro hyp
8282+ rw [hyp]
8283+ case right =>
8284+ intro hyp
8285+ rw [hyp]
8286+ have := @LawfulOrderInf.le_min_iff α _ _ _ w.fst h.fst w.fst
8287+ rw [hyp] at this
8288+ have := this.1 (by simp [← Std.LawfulOrderOrd.isLE_compare])
8289+ letI inst : Antisymm (α := α) (· ≤ ·) := by
8290+ constructor
8291+ intro a b
8292+ sorry
8293+ apply @Antisymm.antisymm (α := α) (· ≤ ·) inst
8294+ · exact leq
8295+ · exact this.1
8296+
8297+
8298+
8299+
8300+ case isFalse => sorry
8301+
8302+
8303+
8304+
8305+
8306+
8307+
8308+
8309+
8310+
8311+
8312+
8313+
8314+
8315+
8316+ case isFalse heq =>
8317+ sorry
8318+
8319+
8320+
8321+
8322+
8323+
8324+
8325+
8326+
8327+
8328+
8329+
8330+
8331+
8332+
8333+
8334+
8335+
8336+
82528337theorem minKey ?_eraseKey_eq_iff_beq_minKey ?_eq_false [Ord α] [TransOrd α] [BEq α] [LawfulBEqOrd α]
82538338 {k} {l : List ((a : α) × β a)} (hd : DistinctKeys l) :
82548339 minKey? (eraseKey k l) = minKey? l ↔ ∀ {km}, minKey? l = some km → (k == km) = false := by
0 commit comments