Commit graph

5045 commits

Author SHA1 Message Date
Sebastian Ullrich
b76be34119 chore: fix test 2020-02-03 16:36:37 +01:00
Leonardo de Moura
f8bfe88d6b fix: consume unnecessary let-decls at isDefEq
Make sure we solve unification constraints such as `(let x := v; ?m) =?= ?m`
2020-02-02 21:54:44 -08:00
Leonardo de Moura
2abfa1bcff fix: closes #108 2020-02-01 23:17:00 -08:00
Leonardo de Moura
8487216b1e feat: fallback to constApprox when foApprox fails 2020-02-01 22:50:29 -08:00
Leonardo de Moura
8de49b157c feat: add new approximation at isDefEq 2020-02-01 22:38:58 -08:00
Leonardo de Moura
a7c8978d81 feat: insert liftM automatically in do notation when needed
@Kha The new example demonstrates the feature in action.
I added a comment explaining why it is more effective than relying on coercions.
2020-02-01 17:33:04 -08:00
Leonardo de Moura
cd4ec6313e chore: try macros first 2020-02-01 00:53:49 -08:00
Leonardo de Moura
d8c738bef8 feat: elaborate do notation 2020-01-31 20:11:06 -08:00
Leonardo de Moura
3d0bfcd36a fix: assertion violation 2020-01-31 08:25:59 -08:00
Leonardo de Moura
21618361b7 refactor: remove ParserKind 2020-01-30 20:56:46 -08:00
Leonardo de Moura
3f32d9eb0b fix: closes #111 2020-01-30 14:09:47 -08:00
Leonardo de Moura
2f0ac98b51 feat: extend scope of cdot notation 2020-01-30 11:42:37 -08:00
Leonardo de Moura
38cfa1dcb6 feat: add elabMatch skeleton 2020-01-30 10:02:15 -08:00
Leonardo de Moura
0c4030137f feat: simplify Coe again
Users may add the expensive instances if they want.
The goal is to make sure the default configuration is solid, and
covers all examples we really want to support.

cc @kha @dselsam
2020-01-29 22:08:42 -08:00
Leonardo de Moura
812c47d463 feat: simplify CoeFun and CoeSort
The main issue is nontermination for problems that do not have
solution. When using dependent coercions, we keep creating goals of
the form `CoeSort ... (coe (coe (coe ...))) ...`. Same for `CoeFun`.
I am considering simplifying it even further, and making sure
`CoeDep` can be used at most once in a sequence of coercions `CoeTC`.

Another option is to use a very small amount of fuel to
guarantee termination when solving coercion TC problems.

cc @Kha @dselsam
2020-01-29 21:56:26 -08:00
Leonardo de Moura
f29a13323a fix: forget to update 2020-01-29 20:08:03 -08:00
Leonardo de Moura
a656096c4b feat: expected type propagation 2020-01-29 19:00:56 -08:00
Leonardo de Moura
b00c04c491 fix: missing ensureHasType 2020-01-29 16:29:48 -08:00
Leonardo de Moura
400a9c45c1 test: CoeSort test 2020-01-29 03:57:27 -08:00
Leonardo de Moura
c048a3f573 fix: Level.normalize 2020-01-29 03:38:35 -08:00
Leonardo de Moura
c33cd11be1 feat: add CoeHead and CoeTail to minimize nontermination
The adventure continues.

cc @Kha @dselsam
2020-01-28 18:20:58 -08:00
Leonardo de Moura
a7de10a74a feat: add support for CoeFun in the new elaborator
cc @kha
2020-01-28 16:50:53 -08:00
Leonardo de Moura
4aa710d4a6 feat: add bridge Coe + HasNat transitivity instance
cc @kha @dselsam
2020-01-28 16:17:14 -08:00
Leonardo de Moura
8c7aade7b6 feat: add coercion tests 2020-01-28 15:52:04 -08:00
Leonardo de Moura
e9e4dfe1ff feat: add new Coe.lean 2020-01-28 13:10:30 -08:00
Leonardo de Moura
07bfeab6be feat: add CoeFun and CoeSort to new Coe prototype 2020-01-28 12:57:14 -08:00
Leonardo de Moura
bb1a90b24d chore: fix tests 2020-01-28 10:34:27 -08:00
Leonardo de Moura
642509229f feat: split Coe and CoeDep
Motivation: control term size.
```lean
synth CoeT Nat 0 (Option (Option (Option (Option (Option Nat)))))
```
is much smaller with the new encoding
2020-01-28 09:48:18 -08:00
Leonardo de Moura
a272670ead test: new instances 2020-01-27 21:23:14 -08:00
Leonardo de Moura
9b6dfa71a2 test: new Coe prototype 2020-01-27 20:33:10 -08:00
Sebastian Ullrich
9065ce55a8 chore: ignore test output files 2020-01-27 13:08:57 +01:00
Leonardo de Moura
ac5eaa4d7d test: overload builtin notation 2020-01-26 14:00:41 -08:00
Leonardo de Moura
cde1399a01 test: overloaded syntax 2020-01-26 13:57:13 -08:00
Leonardo de Moura
e52c4291cc feat: allow macro_rules block with different syntax node kinds 2020-01-26 08:39:40 -08:00
Leonardo de Moura
43df63e594 chore: remove unnecessary |s from test 2020-01-25 20:24:22 -08:00
Leonardo de Moura
d0d3e24975 chore: fix tests 2020-01-25 20:14:50 -08:00
Leonardo de Moura
1512ccfdc8 chore: reacticate where elaboration 2020-01-25 20:11:42 -08:00
Leonardo de Moura
5b8e713150 chore: minor 2020-01-25 19:35:18 -08:00
Leonardo de Moura
901fcddf89 chore: first | is now optional at macro_rules
cc @Kha
2020-01-25 19:34:44 -08:00
Leonardo de Moura
19e4c30542 feat: elaborate new let decl
We can now write
```lean
syntax "case!" ident ":" term "with" term "," term : term
macro_rules
| `(case! $h : $c with $t, $e) => `(let $h := $c; cond $h $t $e)
```

Before the series of commits to change `let` syntax, the
quasiquotation `(let $h := $c; cond $h $t $e)
produced the weird error message "`;` expected" at ":=".
The problem was that $h was matching the now deleted "nonterminal"
```lean
def letIdDecl         := parser! try (letIdLhs >> " := ") >> termParser
```
This was not a bug, but a side-effect on how the `let` syntax was
declared.

cc @kha
2020-01-25 16:32:21 -08:00
Leonardo de Moura
993ae96fb7 chore: elaborate let_core 2020-01-25 15:21:47 -08:00
Leonardo de Moura
bdb9f4c86e feat: allow raw identifiers to be used where terms are expected
@Kha this commit fix another example of weird error message I have
experienced in the last few days.

The macro
```lean
syntax "case!" ident ":" term "with" term "," term : term
macro_rules
| `(case! $h : $cond with $t, $e) =>
  `((fun $h => cond $h $t $e) $cond)
```
is accepted, but as in `fun` binders, we get a weird error when
trying to elaborate an instance of the macro.
Example:
```lean
check case! h : 0 == 0 with h, not h
```
2020-01-25 14:55:32 -08:00
Leonardo de Moura
6d5de9f965 feat: handle raw identifiers as binders in fun
@Kha I am adding this kind of feature to improve the user experience.
For example, the macro
```
syntax "[" ident "↦" term "]" : term
macro_rules
| `([$x ↦ $v]) => `(fun $x => $v)
```
is accepted and looks perfectly reasonable.
However, before this commit, we would get a nasty error when
elaborating
```lean
check [x ↦ x + 1]
```
2020-01-25 14:55:21 -08:00
Sebastian Ullrich
2509b3913a Revert "feat: add std streams"
This reverts commit 7575a32035.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
0be2424910 Revert "feat: override standard streams"
This reverts commit bd87ea5d5e.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
a4858bf9f9 Revert "feat: MonadIO now extends MonadExcept IO.Error"
This reverts commit c0a7495495.
2020-01-25 16:32:06 +01:00
Sebastian Ullrich
e82add884f Revert "fix: test files"
This reverts commit 95f951bdf2.
2020-01-25 16:32:06 +01:00
Leonardo de Moura
850729ba1b chore: fix tests 2020-01-24 17:32:21 -08:00
Leonardo de Moura
364bb7bdf7 fix: proper Name literals
cc @kha
2020-01-24 12:38:15 -08:00
Leonardo de Moura
4425feaebb chore: fix tests 2020-01-23 16:08:52 -08:00