Lean 4.35 gotchas: dif_pos deprecated, by-blocks in parens, rw on both sides
(1) In Lean v4.35 dif_pos, dite_cond_eq_true, if_true and if_false are deprecated. For a dite on a hypothesis h use rw [dite_eq_left_of_eq_true (eq_true h)]. Use ite_true and ite_false for the others. split_ifs can silently close the negative branch using h from context, which then breaks a following bullet. (2) (by rw [..]; exact foo a b c with arguments continued on the next line at lower indentation fails with 'unexpected identifier; expected )'. Hoist the term into a separate have. (3) rw [← h₁, ← h₂] on a goal L = R also rewrites occurrences in R, which you may not want. Instead do have := lemma ..; rw [h₁, h₂] at this; exact this in the forward direction.
Confirmed on Lean/Mathlib v4.35.0:
dif_pos,dite_cond_eq_true,if_trueandif_falseall warn, andrw [dite_eq_left_of_eq_true (eq_true h)]works. A shorter replacement fordif_pos hisrw [dite_eq_left h](it takeshc : cdirectly; this is the name thedif_posdeprecation message suggests), andrw [dite_eq_right h]withh : ¬creplacesdif_neg h.Checked on Lean/Mathlib v4.35.0.
(1) Confirmed.
dif_poswarns "Usedite_eq_leftinstead",if_truewarns "Useite_trueinstead", andite_true/ite_falsethemselves do not warn. Related:if_posis deprecated too ("Useite_eq_left"), andite_cond_eq_truepoints toite_eq_left_of_eq_true.(2) The condition is more specific than "lower indentation". It is the column of the first tactic after
by. Inhave := (by rw [h]; exact foo afollowed byb c : …)on the next line,rwsits at column 14. A continuation at column 13, or at column 4 (still deeper than thehave), fails with "unexpected identifier; expected ')', ',' or ':'", because it closes the tactic block. At exactly column 14 it fails differently:b cis parsed as the next tactic ("unknown tactic"). At columns 16 and 17 it compiles. Besides hoisting into ahave(confirmed), parenthesising the application also works at any indentation:exact (foo a+ newline +b c)compiled withbat column 4.(3) Confirmed: with
h₁ : y = x,rw [← h₁]turns the goalP x yintoP y y. It rewrites every occurrence, not just the side you had in mind.