Leonardo de Moura
1315266dd3
refactor: mark the Simp.Context constructor as private
...
motivation: this is the first step to fix the mismatch
between `isDefEq` and the discrimination tree indexing.
2024-11-13 14:12:55 +11:00
Leonardo de Moura
b02c1c56ab
fix: improve split discriminant generalization strategy ( #4401 )
...
This commit also
- improves `split` error messages.
- adds `trace.split.failure` option.
- uses new convention for trace messages.
closes #4390
2024-06-07 21:35:09 +00:00
Leonardo de Moura
1ff0e7a2f2
fix: split at h when h has forward dependencies ( #4211 )
...
We use an approach similar to the one used in `simp`.
closes #3731
2024-05-18 02:48:15 +00:00
Joachim Breitner
b27ab5e25d
refactor: module MatcherApp.Transform ( #3439 )
...
PR #3432 will introduce more operations on `MatcherApp`, including somet
that have more dependencies.
This change prepares by introducing `Lean.Meta.Match.MatcherApp.Basic`
for the basic definition, and `Lean.Meta.MatcherApp.Transform` for the
transformations, currently `addArg` and `refineThrough`, but more to
come.
2024-02-22 16:16:26 +00:00
Joachim Breitner
da24708ba5
refactor: use isAppOfArity ( #3394 )
2024-02-19 09:24:11 +00:00
Henrik Böving
23e49eb519
perf: add prelude to all Lean modules
2024-02-18 14:55:17 -08:00
Leonardo de Moura
17520fa0b8
fix: cache issue at split tatic ( #3258 )
...
closes #3229
---------
Co-authored-by: Scott Morrison <scott.morrison@gmail.com>
Co-authored-by: Joachim Breitner <mail@joachim-breitner.de>
2024-02-06 19:44:28 +00:00
Leonardo de Moura
01469bdbd6
refactor: remove workaround
...
We don't need to keep passing `discharge?` method around anymore.
2024-02-01 16:58:54 +11:00
Leonardo de Moura
b4a290a203
refactor: simp Step and Simproc types
...
Before this commit, `Simproc`s were defined as `Expr -> SimpM (Option Step)`, where `Step` is inductively defined as follows:
```
inductive Step where
| visit : Result → Step
| done : Result → Step
```
Here, `Result` is a structure containing the resulting expression and a proof demonstrating its equality to the input. Notably, the proof is optional; in its absence, `simp` assumes reflexivity.
A simproc can:
- Fail by returning `none`, indicating its inapplicability. In this case, the next suitable simproc is attempted, along with other simp extensions.
- Succeed and invoke further simplifications using the `.visit`
constructor. This action returns control to the beginning of the
simplification loop.
- Succeed and indicate that the result should not undergo further
simplifications. However, I find the current approach unsatisfactory, as it does not align with the methodology employed in `Transform.lean`, where we have the type:
```
inductive TransformStep where
/-- Return expression without visiting any subexpressions. -/
| done (e : Expr)
/--
Visit expression (which should be different from current expression) instead.
The new expression `e` is passed to `pre` again.
-/
| visit (e : Expr)
/--
Continue transformation with the given expression (defaults to current expression).
For `pre`, this means visiting the children of the expression.
For `post`, this is equivalent to returning `done`. -/
| continue (e? : Option Expr := none)
```
This type makes it clearer what is going on. The new `Simp.Step` type is similar but use `Result` instead of `Expr` because we need a proof.
2024-02-01 16:58:54 +11:00
Leonardo de Moura
916c97b625
refactor: simplify match-expressions at pre simp method
2024-01-09 12:57:15 +01:00
int-y1
8d7520b36f
chore: fix typos in comments
2023-10-08 10:46:05 +02:00
Leonardo de Moura
c3d86001c4
chore: simplify dependencies at MatchEqs
2022-11-11 05:51:05 -08:00
Mario Carneiro
b739186e98
feat: use a structured type for simp theorem Origin
2022-09-25 06:40:56 -07:00
Mario Carneiro
0961561d4e
feat: track simp lemmas through the core tactics
2022-09-25 06:40:56 -07:00
Mario Carneiro
687f1c2271
refactor: make simp lemma names mandatory
2022-09-25 06:40:56 -07:00
Sebastian Ullrich
e81ba951c6
fix: Core.transform API and uses
2022-08-25 19:07:42 -07:00
Leonardo de Moura
8335a82aed
refactor: improve MVarId method discoverability
...
See issue #1346
2022-07-24 21:36:33 -07:00
Mario Carneiro
f6211b1a74
chore: convert doc/mod comments from /- to /--//-! ( #1354 )
2022-07-22 12:05:31 -07:00
Gabriel Ebner
a8cab84735
refactor: use computed fields for Expr
2022-07-11 14:19:41 -07:00
Leonardo de Moura
f1d84a5096
perf: use dsimp := false in split tactic and while proving equation theorems
...
It is just a waste in these two cases.
It now takes 0.78 secs to process example on issue #1287 .
closes #1287
2022-07-10 08:03:42 -07:00
Leonardo de Moura
2ebcf29cde
chore: use a[i]! for array accesses that may panic
2022-07-02 15:12:05 -07:00
Leonardo de Moura
77ae79be46
chore: use let/if in do blocks
2022-06-13 17:10:14 -07:00
Leonardo de Moura
d0499ebf4d
fix: fixes #1200
2022-06-08 10:18:05 -07:00
Leonardo de Moura
041827bed5
chore: unused variables
2022-06-07 17:54:10 -07:00
Sebastian Ullrich
fb2a2b3de2
fix: fixup previous commit
2022-06-07 16:37:45 -07:00
Sebastian Ullrich
ae7b895f7a
refactor: unname some unused variables
2022-06-07 16:37:45 -07:00
Leonardo de Moura
3d04899e42
refactor: add unifyEq?
2022-06-06 15:53:40 -07:00
Leonardo de Moura
9818de078b
fix: fixes #1168
2022-05-30 07:24:23 -07:00
Leonardo de Moura
2fc23a2a2b
feat: make sure we can use split to synthesize code
2022-05-23 11:55:57 -07:00
Leonardo de Moura
94b5a9b460
feat: improve split tactic
2022-05-03 17:46:50 -07:00
Leonardo de Moura
c19672e99e
fix: basic support for the new discriminant equality encoding at split
...
TODO: This is a temporary fix. We can do better.
2022-04-29 15:29:39 -07:00
Leonardo de Moura
f891c5724d
feat: track rfl simp theorems
...
See issue #1113
We need update stage0 before closing the issue.
2022-04-21 13:42:04 -07:00
Leonardo de Moura
de2e2447d2
chore: style
2022-04-07 17:35:05 -07:00
Leonardo de Moura
4a0f68de83
fix: split tactic issue
2022-04-01 15:47:24 -07:00
Leonardo de Moura
d21e62ecb7
refactor: custom simpMatch for WF module
...
It is just the skeleton right now.
2022-03-31 14:51:07 -07:00
Leonardo de Moura
a06cd40e29
feat: improve match expression support at simp
2022-03-28 17:17:01 -07:00
Leonardo de Moura
3c964f3b9f
feat: substitute auxiliary equations introduced by the split tactic
2022-03-28 14:29:28 -07:00
Leonardo de Moura
2f67140603
fix: incorrect uses of getMVarType'
2022-03-22 14:11:29 -07:00
Leonardo de Moura
7ee7ca30b8
fix: index out of bounds
2022-03-15 05:16:19 -07:00
Leonardo de Moura
a1366fcb3b
chore: cleanup
2022-02-23 16:24:42 -08:00
Leonardo de Moura
c685a2d9ed
feat: add splitIte flag to splitTarget? tactic
2022-02-09 17:38:04 -08:00
Leonardo de Moura
7fc12014da
fix: make sure splitTarget? skips match expressions that produce type errors at splitMatch
...
We can now generate the equation theorem for
```
attribute [simp] Array.heapSort.loop
```
see #998
2022-02-09 17:07:10 -08:00
Leonardo de Moura
9c2942c36d
chore: "simp lemma" => "simp theorem"
2022-02-06 09:15:39 -08:00
Leonardo de Moura
d6dc077c86
refactor: CongrLemma => SimpCongrTheorem
2022-02-06 09:15:39 -08:00
Leonardo de Moura
188f0eb70f
fix: splitMatch tactic
...
Improve how we compute the motive for match-splitter eliminator.
closes #986
2022-02-02 15:06:03 -08:00
Leonardo de Moura
65e1fc1211
feat: at splitMatch only generalize discriminants that are not FVar
2022-02-02 15:06:03 -08:00
Leonardo de Moura
3101b98f50
feat: used nested tactic exception at splitMatch
2022-02-02 15:06:03 -08:00
Leonardo de Moura
d4f7899591
chore: avoid code duplication setting Simp.Config
2022-01-24 18:57:31 -08:00
Leonardo de Moura
68bd55af32
chore: fix codebase
2021-12-10 13:12:09 -08:00
Leonardo de Moura
2775298fef
feat: add applyMatchSplitter
...
It applies the match splitter without using simplification theorems
2021-09-18 16:30:47 -07:00