Leonardo de Moura
96a72d67f2
fix: avoid unnecessary dependencies at mkMatcher
...
fixes #1237
2022-06-23 10:21:32 -07:00
Leonardo de Moura
2a940dd4ae
feat: add Expr.collectFVars, LocalDecl.collectFVars, Pattern.collectFVars, and AltLHS.collectFVars
...
They are all in `MetaM`.
These are helper functions for issue #1237 . We need to "cleanup" the
local context before trying to compile the match-expression.
see issue #1237
2022-06-22 15:53:43 -07:00
Leonardo de Moura
bbc196eeb7
fix: make sure WF/Fix.lean tolerates MatcherApp.addArg? failures
...
see #1228
2022-06-17 17:37:33 -07:00
Leonardo de Moura
041827bed5
chore: unused variables
2022-06-07 17:54:10 -07:00
Sebastian Ullrich
8eefbf5227
chore: further clean up refactored code
2022-06-07 16:37:45 -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
090503cfd5
chore: cleanup
2022-05-06 17:12:10 -07:00
Leonardo de Moura
c241ef61b1
fix: use HEq (if needed) for encoding h : discr equalities
2022-04-29 15:05:48 -07:00
Leonardo de Moura
941ad84ece
fix: getMkMatcherInputInContext
2022-04-29 12:44:36 -07:00
Leonardo de Moura
d4d538cad8
fix: counterexample generation for new match encoding
2022-04-29 12:36:53 -07:00
Leonardo de Moura
89441aac2a
feat: match equation theorem generation for new h : discr notation encoding
...
TODO: splitter theorem generation still needs to be fixed.
2022-04-29 11:48:25 -07:00
Leonardo de Moura
8d9626dab7
feat: delaborate match h : d with ...
2022-04-29 07:17:46 -07:00
Leonardo de Moura
0f7754847d
chore: style
2022-04-29 07:17:46 -07:00
Leonardo de Moura
7a369848a0
feat: new mkMatcher
...
TODO: adjust match elaborator
2022-04-29 07:17:46 -07:00
Leonardo de Moura
f4b4b14797
refactor: prepare to handle match h: notation at Meta\Match\Match.lean
2022-04-29 07:17:46 -07:00
Leonardo de Moura
3d9e587862
fix: check type mismatch at dependent pattern matching compiler
...
see issue #1057
2022-03-21 09:28:02 -07:00
Leonardo de Moura
719db55a9c
chore: fix trace class
2022-03-17 13:22:16 -07:00
Sebastian Ullrich
54522006f4
refactor: List.get: take Fin to align with Array.get
...
/cc @leodemoura
2022-02-15 18:41:22 +01:00
Leonardo de Moura
12e2a79170
chore: fix codebase after removing auto pure
2022-02-03 18:08:14 -08:00
Leonardo de Moura
ef449e816f
chore: improve trace messages
2022-01-19 14:29:04 -08:00
Leonardo de Moura
1c1e6d79a7
feat: add equality proof for named patterns
...
The user can optionally name the equality proof.
The new test demostrates how to name the equality proof.
closes #501
2022-01-18 12:43:01 -08:00
Leonardo de Moura
68bd55af32
chore: fix codebase
2021-12-10 13:12:09 -08:00
Leonardo de Moura
41040a81de
fix: auxiliary matcher definitions should be treated as abbreviations
...
The motivation is to prevent performance problems such as the one
described at issue #854 .
Fixes #854 after a update stage0
2021-12-07 16:43:20 -08:00
Leonardo de Moura
6b235b05d2
feat: avoid code generation after stage1 for match auxiliary functions
2021-09-11 13:41:38 -07:00
Leonardo de Moura
ca747e9b27
feat: use contradiction at leaves
...
closes #644
2021-08-22 18:41:02 -07:00
Leonardo de Moura
bba9353619
fix: make sure isDefEqOffset does not expose kernel nat literals
...
This issue is similar to a bug where `isDefEqOffset` was exposing
`Nat.add` when processing `HAdd.hAdd`.
Fixes #561
The example at issue #561 is now working, but we may have other places
where raw literals are being accidentally exposed.
2021-08-02 11:27:00 -07:00
Gabriel Ebner
3cff5ceb99
perf: make trace[...] ... notation lazy
2021-06-23 00:07:27 -07:00
Daniel Fabian
9200de01ef
refactor: fix code review comments.
2021-06-06 06:40:09 -07:00
Daniel Fabian
4e88fdc99a
feat: add getMkMatcherInputInContext.
2021-06-06 06:40:09 -07:00
Leonardo de Moura
28b055463f
fix: fixes #471
2021-05-22 15:42:52 -07:00
Daniel Fabian
42bd44ab82
refactor: Capture environment modification in mkMatcher.
...
Doing this allows us to add the declaration in the backtracking case of structural recursion.
2021-05-20 15:20:16 -07:00
Daniel Fabian
91ecbb5b5c
feat: Add withMkMatcherInput.
...
This is the inverse function to `mkMatcher`, i.e. a way to turn a matcher into an input.
2021-05-19 07:28:14 -07:00
Daniel Fabian
cf030a1634
refactor: Add MkMatcherInput.
...
Since we are going to make `mkMatcher` reversible, it's quite useful to have the input be a `structure`. This way we make sure, that the inverse function always returns the same type as `mkMatcher` needs as input.
2021-05-19 07:28:14 -07:00
Leonardo de Moura
9d45ea6721
feat: try to improve dependent pattern matching failure error message
2021-03-30 23:40:11 -07:00
Leonardo de Moura
f20fc6328c
fix: better error message when cases fails and there are no alternatives
2021-03-26 16:28:21 -07:00
Leonardo de Moura
650c6df380
feat: try other variables after failure
2021-03-22 21:02:26 -07:00
Leonardo de Moura
3749213e08
fix: missing whnf at Unify.unify
2021-03-21 22:38:46 -07:00
Leonardo de Moura
be841a7cad
chore: throwError! => throwError, throwErrorAt! => throwErrorAt
...
@Kha I marked the corresponding methods as `protected`.
I currently can't stand `throw_error`, and I am optimistic about
server highlighting feature you are working on :)
2021-03-11 11:59:45 -08:00
Leonardo de Moura
68143ca8ba
chore: trace[...]! ==> trace[...]
...
@Kha I think this one is a good change, there is no real reason for
using the `!` suffix here.
2021-03-10 18:44:43 -08:00
Leonardo de Moura
e1f6965266
feat: allow user to define rewrite lemmas with (local) match expressions
2021-02-19 15:18:19 -08:00
Leonardo de Moura
6c119a1921
chore: use register_builtin_option
2021-01-26 18:24:56 -08:00
Leonardo de Moura
ea0fda39bc
chore: Declaration.lean naming convention
...
`Declaration.lean` was one of the first Lean 4 files, and was still
using an old naming convention.
cc @Kha
2021-01-20 17:07:02 -08:00
Leonardo de Moura
6a39c65bd2
feat: improve match error message
2021-01-14 14:58:34 -08:00
Leonardo de Moura
11c7ca40c3
fix: missing case at Match.lean
2021-01-07 17:38:22 -08:00
Leonardo de Moura
39e374e7cd
fix: improve error message at invalid match-expr
...
The location is not perfect because we only have a `ref` for the whole alternative.
2020-12-29 14:21:02 -08:00
Leonardo de Moura
ae5aa51712
chore: add explicit discard
2020-12-08 06:18:18 -08:00
Leonardo de Moura
9d304df757
feat: heterogeneous Append experiment
...
@Kha This one required a bunch of manual fixes. The main issue is that
before we added the string interpolation feature, we created
`MessageData`s using `++` and coercions. For example, given
`(e : Expr)`, we would write
```
let msg : MessageData := "type: " ++ e
```
and rely on the coercions `String -> MessageData` and
`Expr -> MessageData`, and the instance `Append MessageData`.
However, heterogeneous operators "block" the expected type propagation downwards.
This kind of code is obsolete now since we can write a more compact
version using string interpolation
```
let msg := m!"type: {e}"
```
2020-12-01 16:32:41 -08:00
Leonardo de Moura
b6f242434d
fix: fixes #229
2020-11-30 11:51:13 -08:00
Leonardo de Moura
0869f38de4
chore: update structure, class, inductive
2020-11-27 15:09:30 -08:00