Commit graph

26 commits

Author SHA1 Message Date
Leonardo de Moura
2652cc18b8
chore: error messages consistency (#10143)
This PR standardizes error messages by quoting names with backticks. The
changes were automated, so some cases may still be missing.
2025-08-26 17:55:43 +00:00
Kyle Miller
f1707117f0
feat: conv arg now can access more arguments (#5894)
Specializes the congr lemma generated for the `arg` conv tactic to only
rewrite the chosen argument. This makes it much more likely that the
chosen argument is able to be accessed.

Lets `arg` access the domain and codomain of pi types via `arg 1` and
`arg 2` in more situations. Upstreams `pi_congr` for this from mathlib.

Adds a negative indexing option, where `arg -2` accesses the
second-to-last argument for example, making the behavior of `lhs`
available to `arg`. This works for `enter` as well.

Other improvement: when there is an error in the `enter [...]` tactic,
individual locations get underlined with the error. The tactic info now
also is like `rw`, so you can see the intermediate conv states.

Closes #5871
2024-11-01 02:12:14 +00:00
Joachim Breitner
b181fd83ef
feat: in conv tactic, use try with_reducibe rfl (#3763)
The `conv` tactic tries to close “trivial” goals after itself. As of
now, it uses
`try rfl`, which means it can close goals that are only trivial after
reducing with
default transparency. This is suboptimal

* this can require a fair amount of unfolding, and possibly slow down
the proof
   a lot. And the user cannot even prevent it.
* it does not match what `rw` does, and a user might expect the two to
behave the
   same.

So this PR changes it to `with_reducible rfl`, matching `rw`’s behavior.

I considered `with_reducible eq_refl` to only solve trivial goals that
involve equality,
but not other relations (e.g. `Perm xs xs`), but a discussion on mathlib
pointed out
that it’s expected and desirable to solve more general reflexive goals:


https://leanprover.zulipchat.com/#narrow/stream/270676-lean4/topic/Closing.20after.20.60rw.60.2C.20.60conv.60.3A.20.60eq_refl.60.20instead.20of.20.60rfl.60/near/429851605
2024-03-29 11:59:45 +00:00
Kyle Miller
d39b0415f0
feat: enable pp.fieldNotation.generalized globally (#3744)
Sets the default value to `pp.fieldNotation.generalized` to `true`.
Updates tests, and fixes some minor flaws in the implementation of the
generalized field notation pretty printer.

Now generalized field notation won't be used for any function that has a
`motive` argument. This is intended to prevent recursors from pretty
printing using it as (1) recursors are more like control flow structures
than actual functions and (2) generalized field notation tends to cause
elaboration problems for recursors.

Note: be sure functions that have an `@[app_unexpander]` use
`@[pp_nodot]` if applicable. For example, `List.toArray` needs
`@[pp_nodot]` to ensure the unexpander prints it using `#[...]`
notation.
2024-03-23 02:38:09 +00:00
Joachim Breitner
17c7cb0e1c
feat: conv => fun (#3240)
Given a target
```
| f a b
```
the new conv tactic
```
conv => fun
```
turns it into
```
| f a
```
and `arg 0` turns it into
```
| f
```

Fixes #3239
2024-02-18 12:02:25 +00:00
Mario Carneiro
1c992fde37 chore: add some tests 2022-09-28 14:24:44 -07:00
Mario Carneiro
b6a58d13e1 fix: LHS goals should be pre-whnf'd 2022-09-28 14:24:44 -07:00
Mario Carneiro
9b9998f5c8 feat: pattern (occs := ...) conv 2022-09-25 19:52:56 -07:00
Sebastian Ullrich
e81ba951c6 fix: Core.transform API and uses 2022-08-25 19:07:42 -07:00
Leonardo de Moura
ddeea5e14f chore: fix test output 2022-08-05 13:01:02 -07:00
Leonardo de Moura
b2f34bdedd feat: improve congr conv tactic
It has better support for proof irrelevant and `[Decidable p]` arguments
2022-08-02 04:26:34 -07:00
Leonardo de Moura
3ab26f00ea refactor: use congr tactic to implement the congr conv tactic 2022-08-02 02:24:50 -07:00
Jakob von Raumer
d7cb93e9e4 feat: allow conv mode's arg command to access implicit arguments 2022-06-14 16:15:38 -07:00
Jakob von Raumer
033618ad5e fix: indices in conv arg now count arguments with forward dependencies 2022-06-10 18:25:34 -07:00
Sebastian Ullrich
ff6537be1b fix: use consistent goal prefix everywhere 2022-05-09 17:49:00 +02:00
Leonardo de Moura
d3c487ddbf feat: change lhs and rhs conv tactic semantics
They can now be applied to non binary applications.
2021-09-05 09:29:40 -07:00
Leonardo de Moura
41cfef5bc4 feat: add pattern conv tactic 2021-09-04 18:02:46 -07:00
Leonardo de Moura
53a3831fd5 feat: add apply conv macro 2021-09-03 20:23:15 -07:00
Leonardo de Moura
94bc386fb4 feat: remark goals as conv goals at the end of nested tactic block 2021-09-03 19:52:51 -07:00
Leonardo de Moura
e6c9da0fcc feat: add support for implication at congr conv tactic 2021-09-03 18:50:19 -07:00
Leonardo de Moura
44e7033c27 feat: add support for forall_congr at conv 2021-09-03 16:57:15 -07:00
Leonardo de Moura
8a249bddd2 feat: add try rfl at end of convTarget 2021-09-03 08:14:47 -07:00
Leonardo de Moura
b5b5ef6fdf feat: add funext conv tactic 2021-09-03 08:00:37 -07:00
Leonardo de Moura
7b8ee8f9d8 feat: add 'change' conv tactic 2021-09-02 19:26:25 -07:00
Leonardo de Moura
4d32f8eb9d feat: add arg conv tactic 2021-09-02 17:43:43 -07:00
Leonardo de Moura
4df9983843 feat: lhs and rhs conv tactics 2021-09-02 15:05:51 -07:00