Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: rwa tactic macro #3299

Merged
merged 1 commit into from
Feb 10, 2024
Merged

chore: rwa tactic macro #3299

merged 1 commit into from
Feb 10, 2024

Conversation

leodemoura
Copy link
Member

No description provided.

This commit also allows the `rfl` tactic to be used as shorthand for
`Iff.rfl` and `HEq.rfl`
@leodemoura leodemoura requested a review from Kha as a code owner February 10, 2024 02:41
@github-actions github-actions bot added the toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN label Feb 10, 2024
@leanprover-community-mathlib4-bot
Copy link
Collaborator

Mathlib CI status (docs):

  • ❗ Std/Mathlib CI will not be attempted unless your PR branches off the nightly-with-mathlib branch. (2024-02-10 02:56:39)

@github-actions github-actions bot temporarily deployed to lean-lang.org/lean4/doc February 10, 2024 03:25 Inactive
@kim-em kim-em added this pull request to the merge queue Feb 10, 2024
Merged via the queue into master with commit c138801 Feb 10, 2024
9 checks passed
@@ -323,9 +323,14 @@ 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`).
Copy link
Collaborator

Choose a reason for hiding this comment

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

“We later add” doesn't quite work well for a user facing docstring, does it?

/-- `rwa` calls `rw`, then closes any remaining goals using `assumption`. -/
macro "rwa " rws:rwRuleSeq loc:(location)? : tactic =>
`(tactic| (rw $rws:rwRuleSeq $[$loc:location]?; assumption))

Copy link
Collaborator

Choose a reason for hiding this comment

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

The docstring says “any goals” but the code looks like it will close exactly one goal. Should the docstring say “the remaining goal”?

has type
?m ↔ ?m : Prop
but is expected to have type
b ≤ 2 : Prop
Copy link
Collaborator

Choose a reason for hiding this comment

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

This seems to be a slight regression of error reporting, but for something so elementary as rfl not irrelevant.

If macro rules are used, which tactic decides about the error message? Last or first? Can we somehow register a fail "trivial equality (or equivalence) expected" or simply fail "rfl failed" or something like this as the last tactic to try with rfl?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
toolchain-available A toolchain is available for this PR, at leanprover/lean4-pr-releases:pr-release-NNNN
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants