Skip to content

Conversation

@eric-wieser
Copy link
Contributor

@eric-wieser eric-wieser commented Feb 6, 2026

The lemmas this golfs are now unused, and could also be deleted.

Comment on lines +70 to +72
· simp
· simp
· grind [cons_merge_cons]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I usually try to stay consistent about using simp or grind when they are both just working with theorems that make sense as @[simp, grind =] attributes, e.g.

Suggested change
· simp
· simp
· grind [cons_merge_cons]
· grind [nil_merge]
· grind [merge_right]
· grind [cons_merge_cons]

(If these were already annotated upstream I'd just write fun_induction merge <;> grind, but I don't think it's helpful when you are specifying theorems for different branches manually.)

| case3 =>
grind
| _ => simp
simp
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you address the simpNF linter by removing ret_merge, this is the only affected proof that then becomes

Suggested change
simp
grind [List.length_merge]

| case2 _ _ _ _ _ ih2 ih1 => exact sorted_merge ih2 ih1

lemma merge_perm (l₁ l₂ : List α) : ⟪merge l₁ l₂⟫ ~ l₁ ++ l₂ := by
fun_induction merge with
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like this should follow suit and be grind [List.merge_perm_append]

/-- Key Lemma: ⌈log2 ⌈n/2⌉⌉ ≤ ⌈log2 n⌉ - 1 for n > 1 -/
@[grind →]
lemma clog2_half_le (n : ℕ) (h : n > 1) : clog 2 ((n + 1) / 2) ≤ clog 2 n - 1 := by
rw [Nat.clog_of_one_lt one_lt_two h]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If golfing, this could just be grind [Nat.clog_of_one_lt].

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants