mathlib4 icon indicating copy to clipboard operation
mathlib4 copied to clipboard

feat: `symm` and `trans` tactics

Open siddhartha-gadgil opened this issue 3 years ago • 13 comments

I have implemented a symm tactic, using annotations for symm rules. This follows (including using code from) the ext implementation.

I also have a couple of test examples

siddhartha-gadgil avatar Mar 28 '22 11:03 siddhartha-gadgil

There is a stub transitivity in Tactic.Basic. Probably, it should be removed. Also, could you please mark some lemmas as @[symm]/@[trans]?

urkud avatar Jul 18 '22 14:07 urkud

@urkud I don't know if transitivity is meant to be a stub for something different. Can someone who knows clarify?

I have cases of @[symm] and @[trans] in the test files. Do you mean also in the mathlib4 code?

siddhartha-gadgil avatar Jul 19 '22 03:07 siddhartha-gadgil

The transitivity tactic in Mathlib.Tactic.Basic is indeed meant to be subsumed by your trans tactic, but make sure to add some tests of the transitivity tactic and ensure that they still work with trans.

digama0 avatar Jul 19 '22 05:07 digama0

The transitivity tactic in Mathlib.Tactic.Basic is indeed meant to be subsumed by your trans tactic, but make sure to add some tests of the transitivity tactic and ensure that they still work with trans.

~I have used a macro to map this and added a few tests. Sorry, I created a mistake as transitivity was used in Init~

siddhartha-gadgil avatar Jul 19 '22 06:07 siddhartha-gadgil

The transitivity tactic in Mathlib.Tactic.Basic is indeed meant to be subsumed by your trans tactic, but make sure to add some tests of the transitivity tactic and ensure that they still work with trans.

I made a mess earlier, but have addressed this correctly I hope now. There is a single use of transitivity in the codebase and I copied the example and checked that trans works instead.

siddhartha-gadgil avatar Jul 19 '22 06:07 siddhartha-gadgil

@gebner just want to clarify that so far as I see I have addressed the comments. Should the "awaiting-author" tag be removed.

siddhartha-gadgil avatar Jul 19 '22 12:07 siddhartha-gadgil

Yes, in the code. BTW, what lemmas does lean4 calc mode use? In lean 3 we had one attribute that was used both for calc and trans. In lean 3, the tactic transitivity uses trans lemmas.

urkud avatar Jul 19 '22 12:07 urkud

When you want another round of review, you remove awaiting author and add awaiting review.

urkud avatar Jul 19 '22 12:07 urkud

When you want another round of review, you remove awaiting author and add awaiting review.

I don't seem to be able to do this. Maybe only maintainers can.

siddhartha-gadgil avatar Jul 19 '22 13:07 siddhartha-gadgil

Yes, in the code. BTW, what lemmas does lean4 calc mode use? In lean 3 we had one attribute that was used both for calc and trans. In lean 3, the tactic transitivity uses trans lemmas.

There is a typeclass Trans. This is picked up by the trans tactic I implemented in addition to attributes.

siddhartha-gadgil avatar Jul 19 '22 13:07 siddhartha-gadgil

To fix the main import linting error you can run

/usr/bin/find Mathlib -name "*.lean" | LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > Mathlib.lean

in the mathlib root dir

EdAyers avatar Jul 25 '22 13:07 EdAyers

To fix the main import linting error you can run

/usr/bin/find Mathlib -name "*.lean" | LC_ALL=C sort | sed 's/\.lean//;s,/,.,g;s/^/import /' > Mathlib.lean

in the mathlib root dir

Thanks. Done this.

siddhartha-gadgil avatar Jul 27 '22 10:07 siddhartha-gadgil

Can this tactic rewrite hypotheses? symm at h ? I tried it but doesn't seem to like it. I believe the symmetry tactic could do that.

lovettchris avatar Oct 13 '22 21:10 lovettchris

bors merge

digama0 avatar Oct 22 '22 15:10 digama0

Build failed:

bors[bot] avatar Oct 22 '22 15:10 bors[bot]

bors merge

digama0 avatar Oct 22 '22 16:10 digama0

Build failed:

  • Build

bors[bot] avatar Oct 22 '22 16:10 bors[bot]

bors merge

digama0 avatar Oct 22 '22 16:10 digama0

Build failed:

bors[bot] avatar Oct 22 '22 16:10 bors[bot]

bors merge

digama0 avatar Oct 22 '22 16:10 digama0

Canceled.

bors[bot] avatar Oct 22 '22 16:10 bors[bot]

bors merge

digama0 avatar Oct 22 '22 16:10 digama0

Build failed (retrying...):

  • Build

bors[bot] avatar Oct 22 '22 16:10 bors[bot]

Pull request successfully merged into master.

Build succeeded:

bors[bot] avatar Oct 22 '22 16:10 bors[bot]