diff --git a/src/Init/Core.lean b/src/Init/Core.lean index c10db7aab2..c6322ac0f6 100644 --- a/src/Init/Core.lean +++ b/src/Init/Core.lean @@ -823,6 +823,7 @@ theorem iff_iff_implies_and_implies {a b : Prop} : (a ↔ b) ↔ (a → b) ∧ ( protected theorem Iff.rfl {a : Prop} : a ↔ a := Iff.refl a +-- And, also for backward compatibility, we try `Iff.rfl.` using `exact` (see #5366) macro_rules | `(tactic| rfl) => `(tactic| exact Iff.rfl) theorem Iff.of_eq (h : a = b) : a ↔ b := h ▸ Iff.rfl diff --git a/src/Init/Tactics.lean b/src/Init/Tactics.lean index 3f12057e4e..14b2d68e14 100644 --- a/src/Init/Tactics.lean +++ b/src/Init/Tactics.lean @@ -364,31 +364,24 @@ syntax (name := fail) "fail" (ppSpace str)? : tactic syntax (name := eqRefl) "eq_refl" : tactic /-- -`rfl` tries to close the current goal using reflexivity. -This is supposed to be an extensible tactic and users can add their own support -for new reflexive relations. - -Remark: `rfl` is an extensible tactic. We later add `macro_rules` to try different -reflexivity theorems (e.g., `Iff.rfl`). +This tactic applies to a goal whose target has the form `x ~ x`, +where `~` is equality, heterogeneous equality or any relation that +has a reflexivity lemma tagged with the attribute @[refl]. -/ -macro "rfl" : tactic => `(tactic| case' _ => fail "The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc.") - -macro_rules | `(tactic| rfl) => `(tactic| eq_refl) -macro_rules | `(tactic| rfl) => `(tactic| exact HEq.rfl) +syntax "rfl" : tactic /-- -This tactic applies to a goal whose target has the form `x ~ x`, -where `~` is a reflexive relation other than `=`, -that is, a relation which has a reflexive lemma tagged with the attribute @[refl]. +The same as `rfl`, but without trying `eq_refl` at the end. -/ syntax (name := applyRfl) "apply_rfl" : tactic +-- We try `apply_rfl` first, beause it produces a nice error message macro_rules | `(tactic| rfl) => `(tactic| apply_rfl) +-- But, mostly for backward compatibility, we try `eq_refl` too (reduces more aggressively) +macro_rules | `(tactic| rfl) => `(tactic| eq_refl) +-- Als for backward compatibility, because `exact` can trigger the implicit lambda feature (see #5366) +macro_rules | `(tactic| rfl) => `(tactic| exact HEq.rfl) /-- `rfl'` is similar to `rfl`, but disables smart unfolding and unfolds all kinds of definitions, theorems included (relevant for declarations defined by well-founded recursion). diff --git a/src/Lean/Elab/Tactic/Rfl.lean b/src/Lean/Elab/Tactic/Rfl.lean index bfd0f113e0..ce35132f12 100644 --- a/src/Lean/Elab/Tactic/Rfl.lean +++ b/src/Lean/Elab/Tactic/Rfl.lean @@ -16,6 +16,10 @@ provided the reflexivity lemma has been marked as `@[refl]`. namespace Lean.Elab.Tactic.Rfl +/-- +This tactic applies to a goal whose target has the form `x ~ x`, where `~` is a reflexive +relation, that is, a relation which has a reflexive lemma tagged with the attribute [refl]. +-/ @[builtin_tactic Lean.Parser.Tactic.applyRfl] def evalApplyRfl : Tactic := fun stx => match stx with | `(tactic| apply_rfl) => withMainContext do liftMetaFinishingTactic (·.applyRfl) diff --git a/src/Lean/Meta/Tactic/Rfl.lean b/src/Lean/Meta/Tactic/Rfl.lean index 9b683cef2c..96ea9f0853 100644 --- a/src/Lean/Meta/Tactic/Rfl.lean +++ b/src/Lean/Meta/Tactic/Rfl.lean @@ -1,7 +1,7 @@ /- Copyright (c) 2022 Newell Jensen. All rights reserved. Released under Apache 2.0 license as described in the file LICENSE. -Authors: Newell Jensen, Thomas Murrills +Authors: Newell Jensen, Thomas Murrills, Joachim Breitner -/ prelude import Lean.Meta.Tactic.Apply @@ -58,13 +58,13 @@ def _root_.Lean.MVarId.applyRfl (goal : MVarId) : MetaM Unit := goal.withContext -- NB: uses whnfR, we do not want to unfold the relation itself let t ← whnfR <|← instantiateMVars <|← goal.getType if t.getAppNumArgs < 2 then - throwError "rfl can only be used on binary relations, not{indentExpr (← goal.getType)}" + throwTacticEx `rfl goal "expected goal to be a binary relation" -- Special case HEq here as it has a different argument order. if t.isAppOfArity ``HEq 4 then let gs ← goal.applyConst ``HEq.refl unless gs.isEmpty do - throwError MessageData.tagged `Tactic.unsolvedGoals <| m!"unsolved goals\n{ + throwTacticEx `rfl goal <| MessageData.tagged `Tactic.unsolvedGoals <| m!"unsolved goals\n{ goalsToMessageData gs}" return @@ -76,8 +76,8 @@ def _root_.Lean.MVarId.applyRfl (goal : MVarId) : MetaM Unit := goal.withContext unless success do let explanation := MessageData.ofLazyM (es := #[lhs, rhs]) do let (lhs, rhs) ← addPPExplicitToExposeDiff lhs rhs - return m!"The lhs{indentExpr lhs}\nis not definitionally equal to rhs{indentExpr rhs}" - throwTacticEx `apply_rfl goal explanation + return m!"the left-hand side{indentExpr lhs}\nis not definitionally equal to the right-hand side{indentExpr rhs}" + throwTacticEx `rfl goal explanation if rel.isAppOfArity `Eq 1 then -- The common case is equality: just use `Eq.refl` @@ -86,6 +86,9 @@ def _root_.Lean.MVarId.applyRfl (goal : MVarId) : MetaM Unit := goal.withContext goal.assign (mkApp2 (mkConst ``Eq.refl us) α lhs) else -- Else search through `@refl` keyed by the relation + -- We change the type to `lhs ~ lhs` so that we do not the (possibly costly) `lhs =?= rhs` check + -- again. + goal.setType (.app t.appFn! lhs) let s ← saveState let mut ex? := none for lem in ← (reflExt.getState (← getEnv)).getMatch rel reflExt.config do @@ -102,7 +105,7 @@ def _root_.Lean.MVarId.applyRfl (goal : MVarId) : MetaM Unit := goal.withContext sErr.restore throw e else - throwError "rfl failed, no @[refl] lemma registered for relation{indentExpr rel}" + throwTacticEx `rfl goal m!"no @[refl] lemma registered for relation{indentExpr rel}" /-- Helper theorem for `Lean.MVarId.liftReflToEq`. -/ private theorem rel_of_eq_and_refl {α : Sort _} {R : α → α → Prop} diff --git a/tests/lean/run/4644.lean b/tests/lean/run/4644.lean index c4c5612a4c..c26780b5d8 100644 --- a/tests/lean/run/4644.lean +++ b/tests/lean/run/4644.lean @@ -11,11 +11,10 @@ def check_sorted [x: LE α] [DecidableRel x.le] (a: Array α): Bool := sorted_from_var a 0 /-- -error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +error: tactic 'rfl' failed, the left-hand side + check_sorted #[0, 3, 3, 5, 8, 10, 10, 10] +is not definitionally equal to the right-hand side + true ⊢ check_sorted #[0, 3, 3, 5, 8, 10, 10, 10] = true -/ #guard_msgs in diff --git a/tests/lean/run/rflReducibility.lean b/tests/lean/run/rflReducibility.lean new file mode 100644 index 0000000000..6bec115620 --- /dev/null +++ b/tests/lean/run/rflReducibility.lean @@ -0,0 +1,25 @@ +/-! +The (attribute-extensible) `rfl` tactic only unfolds the goal with reducible transparency to look +for a relation which may have a `refl` lemma associated with it. But historically, `rfl` also +invoked `eq_refl`, which more aggressively unfolds. This checks that this still works. +-/ + +def Foo (a b : Nat) : Prop := a = b + +/-- +error: tactic 'rfl' failed, no @[refl] lemma registered for relation + Foo +⊢ Foo 1 1 +-/ +#guard_msgs in +example : Foo 1 1 := by + apply_rfl + + +#guard_msgs in +example : Foo 1 1 := by + eq_refl + +#guard_msgs in +example : Foo 1 1 := by + rfl diff --git a/tests/lean/run/rflTacticErrors.lean b/tests/lean/run/rflTacticErrors.lean index bf916b8fd0..f8c4d19537 100644 --- a/tests/lean/run/rflTacticErrors.lean +++ b/tests/lean/run/rflTacticErrors.lean @@ -9,11 +9,10 @@ This file tests the `rfl` tactic: -- First, let's see what `rfl` does: /-- -error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +error: tactic 'rfl' failed, the left-hand side + false +is not definitionally equal to the right-hand side + true ⊢ false = true -/ #guard_msgs in @@ -28,9 +27,9 @@ attribute [refl] P.refl -- Plain error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side 42 -is not definitionally equal to rhs +is not definitionally equal to the right-hand side 23 ⊢ P 42 23 -/ @@ -42,9 +41,9 @@ example : P 42 23 := by apply_rfl opaque withImplicitNat {n : Nat} : Nat /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side @withImplicitNat 42 -is not definitionally equal to rhs +is not definitionally equal to the right-hand side @withImplicitNat 23 ⊢ P withImplicitNat withImplicitNat -/ @@ -86,13 +85,15 @@ example : True ↔ True := by apply_rfl example : P true true := by apply_rfl example : Q true true := by apply_rfl /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation Q' +⊢ Q' true true -/ #guard_msgs in example : Q' true true := by apply_rfl -- Error /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation R +⊢ R true true -/ #guard_msgs in example : R true true := by apply_rfl -- Error @@ -102,14 +103,16 @@ example : True ↔ True := by with_reducible apply_rfl example : P true true := by with_reducible apply_rfl example : Q true true := by with_reducible apply_rfl /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation Q' +⊢ Q' true true -/ #guard_msgs in example : Q' true true := by with_reducible apply_rfl -- Error /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation R +⊢ R true true -/ #guard_msgs in example : R true true := by with_reducible apply_rfl -- Error @@ -125,14 +128,16 @@ example : True' ↔ True := by apply_rfl example : P true' true := by apply_rfl example : Q true' true := by apply_rfl /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation Q' +⊢ Q' true' true' -/ #guard_msgs in example : Q' true' true := by apply_rfl -- Error /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation R +⊢ R true' true' -/ #guard_msgs in example : R true' true := by apply_rfl -- Error @@ -143,14 +148,16 @@ example : True' ↔ True := by with_reducible apply_rfl example : P true' true := by with_reducible apply_rfl example : Q true' true := by with_reducible apply_rfl -- NB: No error, Q and true' reducible /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation Q' +⊢ Q' true' true' -/ #guard_msgs in example : Q' true' true := by with_reducible apply_rfl -- Error /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation R +⊢ R true' true' -/ #guard_msgs in example : R true' true := by with_reducible apply_rfl -- Error @@ -166,22 +173,24 @@ example : True'' ↔ True := by apply_rfl example : P true'' true := by apply_rfl example : Q true'' true := by apply_rfl /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation Q' +⊢ Q' true'' true'' -/ #guard_msgs in example : Q' true'' true := by apply_rfl -- Error /-- -error: rfl failed, no @[refl] lemma registered for relation +error: tactic 'rfl' failed, no @[refl] lemma registered for relation R +⊢ R true'' true'' -/ #guard_msgs in example : R true'' true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ true'' = true -/ @@ -197,45 +206,45 @@ with #guard_msgs in example : HEq true'' true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side True'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side True ⊢ True'' ↔ True -/ #guard_msgs in example : True'' ↔ True := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ P true'' true -/ #guard_msgs in example : P true'' true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q true'' true -/ #guard_msgs in example : Q true'' true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q' true'' true -/ #guard_msgs in example : Q' true'' true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true'' -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ R true'' true -/ @@ -244,9 +253,9 @@ example : R true'' true := by with_reducible apply_rfl -- Error -- Unequal /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ false = true -/ @@ -262,45 +271,45 @@ with #guard_msgs in example : HEq false true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side False -is not definitionally equal to rhs +is not definitionally equal to the right-hand side True ⊢ False ↔ True -/ #guard_msgs in example : False ↔ True := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ P false true -/ #guard_msgs in example : P false true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q false true -/ #guard_msgs in example : Q false true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q' false true -/ #guard_msgs in example : Q' false true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ R false true -/ @@ -308,9 +317,9 @@ is not definitionally equal to rhs example : R false true := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ false = true -/ @@ -326,45 +335,45 @@ with #guard_msgs in example : HEq false true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side False -is not definitionally equal to rhs +is not definitionally equal to the right-hand side True ⊢ False ↔ True -/ #guard_msgs in example : False ↔ True := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ P false true -/ #guard_msgs in example : P false true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q false true -/ #guard_msgs in example : Q false true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ Q' false true -/ #guard_msgs in example : Q' false true := by with_reducible apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side false -is not definitionally equal to rhs +is not definitionally equal to the right-hand side true ⊢ R false true -/ @@ -398,18 +407,18 @@ example : HEq true 1 := by with_reducible apply_rfl -- Error inductive S : Bool → Bool → Prop where | refl : a = true → S a a attribute [refl] S.refl /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true -is not definitionally equal to rhs +is not definitionally equal to the right-hand side false ⊢ S true false -/ #guard_msgs in example : S true false := by apply_rfl -- Error /-- -error: tactic 'apply_rfl' failed, The lhs +error: tactic 'rfl' failed, the left-hand side true -is not definitionally equal to rhs +is not definitionally equal to the right-hand side false ⊢ S true false -/ diff --git a/tests/lean/run/wfirred.lean b/tests/lean/run/wfirred.lean index 89fbfcbc9f..ef3bffc967 100644 --- a/tests/lean/run/wfirred.lean +++ b/tests/lean/run/wfirred.lean @@ -31,11 +31,10 @@ example : foo (n+1) = foo n := rfl -- also for closed terms /-- -error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +error: tactic 'rfl' failed, the left-hand side + foo 0 +is not definitionally equal to the right-hand side + 0 ⊢ foo 0 = 0 -/ #guard_msgs in @@ -43,11 +42,10 @@ example : foo 0 = 0 := by rfl -- It only works on closed terms: /-- -error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +error: tactic 'rfl' failed, the left-hand side + foo (n + 1) +is not definitionally equal to the right-hand side + foo n n : Nat ⊢ foo (n + 1) = foo n -/ diff --git a/tests/lean/runTacticMustCatchExceptions.lean.expected.out b/tests/lean/runTacticMustCatchExceptions.lean.expected.out index 42215a9a19..b02e84d57c 100644 --- a/tests/lean/runTacticMustCatchExceptions.lean.expected.out +++ b/tests/lean/runTacticMustCatchExceptions.lean.expected.out @@ -1,45 +1,39 @@ -runTacticMustCatchExceptions.lean:2:25-2:28: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:2:25-2:28: error: tactic 'rfl' failed, the left-hand side + 1 +is not definitionally equal to the right-hand side + a + b a b : Nat ⊢ 1 ≤ a + b -runTacticMustCatchExceptions.lean:3:25-3:28: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:3:25-3:28: error: tactic 'rfl' failed, the left-hand side + a + b +is not definitionally equal to the right-hand side + b a b : Nat this : 1 ≤ a + b ⊢ a + b ≤ b -runTacticMustCatchExceptions.lean:4:25-4:28: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:4:25-4:28: error: tactic 'rfl' failed, the left-hand side + b +is not definitionally equal to the right-hand side + 2 a b : Nat this✝ : 1 ≤ a + b this : a + b ≤ b ⊢ b ≤ 2 -runTacticMustCatchExceptions.lean:9:18-9:21: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:9:18-9:21: error: tactic 'rfl' failed, the left-hand side + 1 +is not definitionally equal to the right-hand side + a + b a b : Nat ⊢ 1 ≤ a + b -runTacticMustCatchExceptions.lean:10:14-10:17: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:10:14-10:17: error: tactic 'rfl' failed, the left-hand side + a + b +is not definitionally equal to the right-hand side + b a b : Nat ⊢ a + b ≤ b -runTacticMustCatchExceptions.lean:11:14-11:17: error: The rfl tactic failed. Possible reasons: -- The goal is not a reflexive relation (neither `=` nor a relation with a @[refl] lemma). -- The arguments of the relation are not equal. -Try using the reflexivity lemma for your relation explicitly, e.g. `exact Eq.refl _` or -`exact HEq.rfl` etc. +runTacticMustCatchExceptions.lean:11:14-11:17: error: tactic 'rfl' failed, the left-hand side + b +is not definitionally equal to the right-hand side + 2 a b : Nat ⊢ b ≤ 2