Comments (3)
from agda.
I don't think this reaction is appropriate; it's not April. This issue is a legitimate feature request, with prior art in other proof assistants and, more importantly, our very own (FROMNAT
, FROMNEG
, FROMSTRING
, do
notation, idiom brackets).
The reason I suspect this would be possible to implement without moving a mountain of code is that we (a) already have handling for deferring the checking of arguments when a function's type is unresolved and (b) already overload function application, in --cubical
, to support applying PathP
s.
The idea is simple: in checkArgumentsE
, if we're checking an application of a visible argument to a type that is definitely not a Pi (or Path), then we instead elaborate (f as # x) es
, where as
stands for the already-checked arguments, x:es
are the arguments-to-check, and _#_
is whatever appropriate builtin --- maybe BUILTIN TOFUNCTION
.
However, there are actually a couple implementation challenges regardless.
-
Agda is quite content to assume that any rigid symbol is the "target type" of aΠ
, even if the type is just aDef
, so it's actually pretty difficult to get into a situation where you'd get aShouldBePi
. For example:
Fixed, see below -
checkArgumentsE
and its callers assume that checking an application can only snoc newElim
s onto the end of the head term. The feature proposed here would require some shuffling, so thatcheckArgumentsE
would be allowed to do the "rotation" necessary to build the application of_#_
.The most sensible thing, IMO, would be to defunctionalise the continuation to
checkArguments
--- essentially storing the head term ± information about whether or not some parameters should be dropped. -
inferApplication
,checkArguments
etc. like to postpone instance constraints. If the user has implemented their_#_
using instance arguments, then it's probably a good idea to at least try solving constraints generated by elaboratingf # x
immediately.Using the 1Lab's
_#_
for an example, if we're checking e.g.f x y
, forf : T
withinstance app : Funlike T A (λ _ → B → C)
the only viable candidate, then solving theFunlike
constraint eagerly would allow us to know thatx : A
and(f # x) : B → C
. This would avoid postponing the checking ofx
and of the remaining argumentsy
.
Because this will be a more significant refactoring of checkArgumentsE
than I originally thought, I think it's probably a good idea to wait for some actual opinions for/against this feature before I spend my time implementing it. Needless to say, if we do go forward with this, I'm happy to put in the work.
from agda.
- This is probably a bug worth fixing regardless of whether or not we go ahead with the feature proposed here.
Indeed! To not side track the discussion here, I singled this out into:
from agda.
Related Issues (20)
- Prune `Setup.hs` HOT 5
- Reorganize `HACKING.md`
- Merge `.authorspellings` and `.mailmap` HOT 1
- Mimer internal error when querying `recRecursive` HOT 1
- Interactive highlighting remnants with lambda-where
- Pattern synonyms with named arguments can be defined but not used HOT 3
- Automatically create names for syntax
- Mangled trX/Con clause for indexed type with green slime HOT 1
- Why do we `reduce` and `instantiateFull` constraints? HOT 2
- Use of Non-terminating Function in Data Declaration Makes Typechecker Loop HOT 4
- Misprinted domain-free parameters with cohesion attribute HOT 1
- Regression in 2.6.4.2 concerning `with` HOT 6
- Regression in 2.6.4 in `rewrite` with instances
- Future: cabal build-type `Setup` will be phased out in favor of `Hooks`
- Non-sensical error since 2.5.4 when applying a non-function HOT 5
- cabal install Agda -- fails with executable-dynamic HOT 18
- No tests for tagged releases HOT 5
- Underapplied pattern synonyms expand to lambdas with wrong hiding in expressions
- Confusing error "Unused variable in pattern synonym"
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from agda.