[Merged by Bors] - feat: port cc tactic (2/3)#11960
Conversation
Vierkantor
left a comment
There was a problem hiding this comment.
Some further comments.
Observation: many procedures iterate over a collection of objects and index through pureIsDefEq. This can likely be optimized in future PRs using keyed matching in a discrimination tree, but is not a concern for the current implementation.
|
Overall the documentation is very good, most suggestions are for style issues. Good work! |
Vierkantor
left a comment
There was a problem hiding this comment.
Done with the review! Thank you so much for the work in porting and commenting the code.
Mathlib/Tactic/CC/Addition.lean
Outdated
| /-- Internalize `e` so that the AC module can deal with the given expression. -/ | ||
| def internalizeAC (e : Expr) (parent? : Option Expr) : CCM Unit := do | ||
| let some op ← isAC e | return | ||
| let parentOp? ← parent?.casesOn (pure none) isAC | ||
| if parentOp?.any (op == ·) then return |
There was a problem hiding this comment.
I'm not sure what the check on lines 1191-1192 is supposed to do, could you verify?
| /-- Internalize `e` so that the AC module can deal with the given expression. -/ | |
| def internalizeAC (e : Expr) (parent? : Option Expr) : CCM Unit := do | |
| let some op ← isAC e | return | |
| let parentOp? ← parent?.casesOn (pure none) isAC | |
| if parentOp?.any (op == ·) then return | |
| /-- Internalize `e` so that the AC module can deal with the given expression. | |
| If the expression does not contain an AC operator, or the parent expression | |
| is already processed by `internalizeAC`, this operation does nothing. | |
| -/ | |
| def internalizeAC (e : Expr) (parent? : Option Expr) : CCM Unit := do | |
| let some op ← isAC e | return | |
| let parentOp? ← parent?.casesOn (pure none) isAC | |
| if parentOp?.any (op == ·) then return |
There was a problem hiding this comment.
If the binary AC operatior in parent expression is the same to one in e, stop the process.
|
Thanks! Let's get this merged 🥳 bors r+ |
In this PR, we implements process when an new equation is added to a congruence closure. Also, `Lean.Expr.relSidesIfSymm?` is removed in #11162, but this def is required for `cc` tactic, so we recover this. Co-authored-by: Pol'tta / Miyahara Kō <52843868+Komyyy@users.noreply.github.com>
|
Pull request successfully merged into master. Build succeeded: |
cc tactic (2/3)cc tactic (2/3)
In this PR, we implements process when an new equation is added to a congruence closure. Also, `Lean.Expr.relSidesIfSymm?` is removed in #11162, but this def is required for `cc` tactic, so we recover this. Co-authored-by: Pol'tta / Miyahara Kō <52843868+Komyyy@users.noreply.github.com>
In this PR, we implements process when an new equation is added to a congruence closure. Also, `Lean.Expr.relSidesIfSymm?` is removed in #11162, but this def is required for `cc` tactic, so we recover this. Co-authored-by: Pol'tta / Miyahara Kō <52843868+Komyyy@users.noreply.github.com>
In this PR, we implements process when an new equation is added to a congruence closure.
Also,
Lean.Expr.relSidesIfSymm?is removed in #11162, but this def is required forcctactic, so we recover this.cctactic (1/3) #11956