Skip to content

Commit 41248e0

Browse files
authored
chore: cleanup Common/Brackets.lean (#270)
1 parent 4d11f69 commit 41248e0

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

HumanEvalLean/Common/Brackets.lean

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -95,42 +95,14 @@ theorem minBalance_eq_zero_iff {l : List Paren} : minBalance l = 0 ↔ ∀ k, 0
9595
Nat.zero_le, true_and, forall_exists_index, and_imp, forall_apply_eq_imp_iff₂]
9696
exact ⟨fun h n => List.take_eq_take_min ▸ h (min n l.length) (by simp), fun h n _ => h n⟩
9797

98-
theorem add_min [Add α] [Min α] [LE α] [comm : Std.Commutative (α := α) (· + ·)] [Std.IsPartialOrder α] [Std.LawfulOrderMin α]
99-
[Lean.Grind.OrderedAdd α] {a b c : α} : a + min b c = min (a + b) (a + c) := by
100-
refine Std.le_antisymm ?_ ?_
101-
· rw [Std.le_min_iff, comm.comm a, comm.comm a, ← Lean.Grind.OrderedAdd.add_le_left_iff,
102-
comm.comm a, ← Lean.Grind.OrderedAdd.add_le_left_iff]
103-
exact ⟨Std.min_le_left, Std.min_le_right⟩
104-
· rw [Std.min_le, comm.comm a, comm.comm a, ← Lean.Grind.OrderedAdd.add_le_left_iff,
105-
comm.comm a, ← Lean.Grind.OrderedAdd.add_le_left_iff]
106-
obtain (h|h) := Std.min_eq_or (a := b) (b := c)
107-
· rw (occs := [1]) [← h]
108-
simp
109-
· rw (occs := [2]) [← h]
110-
simp
111-
112-
theorem List.add_min [Add α] [Min α] [LE α] [comm : Std.Commutative (α := α) (· + ·)] [Std.IsPartialOrder α] [Std.LawfulOrderMin α]
113-
[Lean.Grind.OrderedAdd α] {a : α} {l : List α} {h} :
114-
a + l.min h = (l.map (a + ·)).min (by simpa) := by
115-
generalize hlen : l.length = n
116-
induction n generalizing l with
117-
| zero => simp_all
118-
| succ n ih =>
119-
match n, l, hlen with
120-
| 0, [b], _ => simp
121-
| 1, [b, c], _ => simp [_root_.add_min]
122-
| n + 2, b :: c :: tl, _ =>
123-
simp only [min_cons_cons, map_cons]
124-
rw [ih (by grind)]
125-
simp [map_cons, _root_.add_min]
126-
12798
@[simp]
12899
theorem minBalance_cons {l : List Paren} {p : Paren} :
129100
minBalance (p :: l) = min 0 (p.toInt + minBalance l) := by
130101
rw [minBalance]
131102
simp [Nat.toList_rcc_succ_right_eq_cons_map]
132103
rw [List.min_cons, List.min?_eq_some_min (by simp)]
133-
simp only [Option.elim_some, minBalance, List.add_min, List.map_map]
104+
simp only [Option.elim_some, minBalance, ← (List.min_map_eq_min (f := (p.toInt + ·)) (by simp)),
105+
List.map_map]
134106
congr 1
135107

136108
@[simp]

0 commit comments

Comments
 (0)