Commit graph

19129 commits

Author SHA1 Message Date
Leonardo de Moura
9bc07254a1 feat: add support for CoeSort 2020-01-29 02:34:35 -08:00
Leonardo de Moura
df5afdac5d chore: update stage0 2020-01-28 19:08:09 -08:00
Leonardo de Moura
6a046a11c2 chore: remove coeSortBool
It is interacting with new `Coe`.
We can add it back at `Coe.lean` after we remove `HasCoe.lean`
2020-01-28 19:07:02 -08:00
Leonardo de Moura
9a845f5bd6 chore: update stage0 2020-01-28 18:25:22 -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
55bb0805b2 feat: handle attribute inferTCGoalsLR 2020-01-28 18:01:35 -08:00
Leonardo de Moura
f2a32e5985 feat: tag coeFunTrans and coeSortTrans with [inferTCGoalsLR] 2020-01-28 17:19:21 -08:00
Leonardo de Moura
f81027f995 chore: update stage0 2020-01-28 17:13:54 -08:00
Leonardo de Moura
8c34ccf829 feat: add attribute inferTCGoalsLR
@Kha I didn't find any workaround for the instance

```lean
instance coeFunTrans {α : Sort u} {β : Sort v} {γ : Sort w} (a : α) [CoeT α a β] [CoeFun β (coe a) γ] : CoeFun α a γ :=
```

`γ` is an output param. Thus, it is just a metavariable, and if we use
the default order, the subgoal `CoeFun ?β (coe ?a) ?γ` is really bad.
We need to go from left to right here.
2020-01-28 17:08:51 -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
2a89bcd931 feat: use Coe in the new frontend 2020-01-28 15:51:36 -08:00
Leonardo de Moura
d3cb5b832c fix: handle delayed assignments at isDefEqQuick 2020-01-28 15:09:16 -08:00
Leonardo de Moura
2df230e7a8 feat: missing instance 2020-01-28 14:09:04 -08:00
Leonardo de Moura
a9c06230b2 chore: update stage0 2020-01-28 13:11: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
2efdeda903 fix: bug at preprocessArgs 2020-01-28 12:56:01 -08:00
Leonardo de Moura
9eb1723680 fix: outParam support 2020-01-28 11:13:32 -08:00
Leonardo de Moura
ef51d6c2ab chore: improve error message 2020-01-28 10:56: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
7809274c3a chore: Coe.lean ==> HasCoe.lean 2020-01-28 08:55:22 -08:00
Leonardo de Moura
ef105ba49d chore: remove coe functions
They will be used in the new `Coe` file
2020-01-28 08:49:02 -08:00
Leonardo de Moura
5083ecffcc chore: update stage0 2020-01-28 08:46:50 -08:00
Leonardo de Moura
5ca71f48ca chore: make sure Quotation.lean does not depend on old coe 2020-01-28 08:39:36 -08:00
Leonardo de Moura
22c42ec1d8 chore: remove unnecessary method 2020-01-28 08:24:35 -08:00
Leonardo de Moura
f0f522a6d6 chore: prepare to rename old coe primitives 2020-01-28 08:18:56 -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
244382f49c chore: reintroduce accidentally dropped withMacroExpansion 2020-01-27 16:43:18 +01:00
Sebastian Ullrich
88b09315f1 chore: better error message on missing import
The macOS CI build rarely, randomly fails with a "failed to lock file" message.
This commit will not fix this error, but at least should make it clearer whether
the file actually cannot be locked or is just missing.

/cc @leodemoura
2020-01-27 13:09:01 +01:00
Sebastian Ullrich
9065ce55a8 chore: ignore test output files 2020-01-27 13:08:57 +01:00
Sebastian Ullrich
c805eb87e6 refactor: elabAnoymousCtor: align more closely to the paper 2020-01-27 10:35:16 +01:00
Leonardo de Moura
254d29b4b7 chore: update stage0 2020-01-26 15:15:20 -08:00
Leonardo de Moura
145bd50903 feat: disallow patterns with choice nodes
@Kha Patterns with nested "choice" nodes produce counterintuitive
behavior, and hard to understand errors. They only work when we have
the exact same overloads at macro definition and application time.

Here is a funky example
```
syntax [myAdd] term "++":65 term:65 : term    -- overloads "++"
/- The following `macro_rules` manages to eliminate "choice" node by using the
   explicitly provided node kind. -/
macro_rules [myAdd] `($a ++ $b) => `($a + $b)

check (1:Nat) ++ 2 -- works as expected

syntax "FOO!" term : term

/- Before this commit, the following pattern was accepted,
   and it contained a "choice" node for `++`. It is a `myAdd` or
   `HasAppend.append`.

   Now, this kind of pattern is rejected since it contains a nested
   "choice" -/
macro_rules `(FOO! $a ++ $b) => `($a ++ $b)

/- Before this commit, the following command worked because
   it contained a "choice" node similar to the one at macro definition
   time. -/
check FOO! [1, 2] ++ [2, 3]

-- Now, we have 3 overloads for "++".
syntax [myAppend] term "++":65 term:65 : term

-- The `macro_rules` fails here.
```

This commit fixes this weird behavior by disallowing "choice" nodes in
patterns.
2020-01-26 15:13:14 -08:00
Leonardo de Moura
4e580e78bc chore: update stage0 2020-01-26 15:13:14 -08:00
Leonardo de Moura
8525584a78 refactor: naming consistency ensure List and Array have similar find* methods
`find?`     -> takes predicate
`findSome?` -> takes a function (A -> Option B)
2020-01-26 15:13:05 -08:00
Leonardo de Moura
ac5eaa4d7d test: overload builtin notation 2020-01-26 14:00:41 -08:00
Leonardo de Moura
5ff63c2bc6 choice: better error message 2020-01-26 13:58:51 -08:00
Leonardo de Moura
cde1399a01 test: overloaded syntax 2020-01-26 13:57:13 -08:00
Leonardo de Moura
17d5453827 fix: elabTerm must be part of observing 2020-01-26 13:55:21 -08:00
Leonardo de Moura
7133d3fc84 feat: handle explicit node kinds in macro_rules, and handle choice kind 2020-01-26 09:39:46 -08:00
Leonardo de Moura
6a1712717f chore: update stage0 2020-01-26 08:43:43 -08:00
Leonardo de Moura
02d31fb619 feat: allow user to specify intended syntax node kind at macro_rules 2020-01-26 08:43:05 -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
6a0208630e feat: add sanity checking at macro_rules 2020-01-25 20:31:58 -08:00
Leonardo de Moura
43df63e594 chore: remove unnecessary |s from test 2020-01-25 20:24:22 -08:00
Leonardo de Moura
b0bcc1c2bb chore: update stage0 2020-01-25 20:18:03 -08:00