Skip to content

Commit

Permalink
feat: improve grind case-split on Iff (#6940)
Browse files Browse the repository at this point in the history
This PR improves how the `grind` tactic performs case splits on `p <->
q`.
  • Loading branch information
leodemoura authored Feb 4, 2025
1 parent 6f8c13b commit cd72256
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 14 deletions.
4 changes: 2 additions & 2 deletions src/Init/Grind/Lemmas.lean
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ theorem Bool.false_of_not_eq_self {a : Bool} (h : (!a) = a) : False := by
by_cases a <;> simp_all

/- The following two helper theorems are used to case-split `a = b` representing `iff`. -/
theorem of_eq_eq_true {a b : Prop} (h : (a = b) = True) : (¬a ∨ b) b ∨ a) := by
theorem of_eq_eq_true {a b : Prop} (h : (a = b) = True) : (a ∧ b) a ∧ ¬ b) := by
by_cases a <;> by_cases b <;> simp_all
theorem of_eq_eq_false {a b : Prop} (h : (a = b) = False) : (¬a ∨ ¬b) ∧ (b ∨ a) := by
theorem of_eq_eq_false {a b : Prop} (h : (a = b) = False) : (a ∧ ¬b) ∨ (¬ a ∧ b) := by
by_cases a <;> by_cases b <;> simp_all

/-! Forall -/
Expand Down
17 changes: 5 additions & 12 deletions tests/lean/run/grind_pre.lean
Original file line number Diff line number Diff line change
Expand Up @@ -157,31 +157,24 @@ p q r : Prop
h₁ : HEq p a
h₂ : HEq q a
h₃ : p = r
left : ¬p ∨ r
h : ¬r
left : p
right : r
⊢ False
[grind] Diagnostics
[facts] Asserted facts
[prop] HEq p a
[prop] HEq q a
[prop] p = r
[prop] ¬p ∨ r
[prop] ¬r ∨ p
[prop] ¬r
[prop] p
[prop] r
[eqc] True propositions
[prop] p = r
[prop] ¬p ∨ r
[prop] ¬r ∨ p
[prop] ¬p
[prop] ¬r
[eqc] False propositions
[prop] a
[prop] p
[prop] q
[prop] r
[cases] Case analyses
[cases] [1/1]: p = r
[cases] [1/2]: ¬r ∨ p
[cases] [1/2]: p = r
[grind] Issues
[issue] #1 other goal(s) were not fully processed due to previous failures, threshold: `(failures := 1)`
-/
Expand Down

0 comments on commit cd72256

Please sign in to comment.