Comments (9)
It's a map so the order really doesn't matter:
from agda.
This can be reproduced immediately with Agda 2.6.3, but older versions of Agda 2.6 do not export PathP
from Agda.Primitive.Cubical
.
from agda.
{-# OPTIONS -v tc.cc:15 #-}
reveals this:
clauses before compilation
onS¹ base = ⊤
onS¹ (loop i) = ⊤
onS¹ _ = ⊥
The constructed clauses are then generated (but not debug printed).
The case tree looks like this:
compiled clauses of onS¹
case 0 of
Issue7033.D.base -> done[] Issue7033.⊤
Issue7033.D.loop -> done[i] Issue7033.⊤
Agda.Primitive.Cubical.primHComp -> done[{_}, {_}, {_}, _, _] Issue7033.⊥
_ -> done[_] Issue7033.⊥
It seems that hcomp
should maybe not be mapped to the empty type here. What should it be mapped to?
from agda.
Well, I'm not familiar with the Agda internals, but the generated clause looks fine to me (-v tc.def.fun.clauses:15
):
onS¹ base = ⊤
onS¹ (loop i) = ⊤
onS¹ _ = ⊥
onS¹ (hcomp {.Agda.Primitive.lzero} {.D} {φ = φ} u a)
= primComp (λ i .o → onS¹ (u i _)) (onS¹ a)
It's just that, when the case tree is made, the hcomp
case is caught by the _
clause. The non-problematic definition
onS¹ : D → Set
onS¹ base = ⊤
onS¹ (loop i) = ⊤
onS¹ other = ⊥
produces the case tree
case 0 of
Issue7033-1-none.D.base -> done[] Issue7033-1-none.⊤
Issue7033-1-none.D.loop -> done[i] Issue7033-1-none.⊤
Issue7033-1-none.D.other -> done[] Issue7033-1-none.⊥
Agda.Primitive.Cubical.primHComp ->
done[{_}, {_}, {_}, _, _]
Agda.Primitive.Cubical.primComp
{λ i -> lsuc lzero} {λ i -> Set}
{Agda.Primitive.Cubical.primIMax @2 Agda.Primitive.Cubical.i0}
(λ i -> λ o -> Issue7033-1-none.onS¹ (@3 @1 @0))
(Issue7033-1-none.onS¹ @0)
I would think that last term is the correct one that should also appear in the case tree for the problematic version of onS¹
.
from agda.
Would it make sense to consider the generated hcomp
clauses as coming first instead of last for the purpose of constructing the case tree?
from agda.
Would it make sense to consider the generated
hcomp
clauses as coming first instead of last for the purpose of constructing the case tree?
This would probably fix the issue and we could go for this now.
Might have some negative impact on performance if the hcomp case is always tried first...
from agda.
For the case tree it doesn't matter since it is just a switch on the constructor name, no? Or do we still go through all of the constructors linearly? In that case we could still force the hcomp constructor to come last, but before any catchall branches.
from agda.
There is a statement in the code asking for adding hcomp clauses at the end:
Unfortunately, direct blame history is truncated at 145dc62 due to code movement.
Tracing it manually, https://github.com/agda/agda/blame/d845567b76c0c5d963c7e19801acc63c3c85516a/src/full/Agda/TypeChecking/Coverage.hs#L1903 , gets us to the initial commit, fbc50e5, which already had the "Important: add at the end" comment.
from agda.
The reason behind hcomp
clauses having to come last, I assume, is a question of strictness. Since hcomp
always looks like a Def
, regardless of whether or not it's actually something you can match on (e.g. in higher inductive types), it's infeasible for an arbitrary function to tell, if they're splitting on a Def hcomp ...
, whether that's actually an "hcomp-constructor", or whether it's just something unevaluated.
Placing the hcomp clauses after the constructor cases makes it so that the ordinary pattern-matching behaviour will force the split argument to head-normal form, so that if you actually did end up with a Def
, you can be sure it's actually of the hcomp-constructor variety.
In that case we could still force the hcomp constructor to come last, but before any catchall branches.
This would work, but I'm not yet familiar enough with the coverage code to figure out how to do it. (This should also happen for transpX
clauses.)
from agda.
Related Issues (20)
- Latex backend/package bug: `! Package array Error: Empty preamble: 'l' used.` HOT 5
- Recursion with records HOT 1
- Failed to write interface /usr/share/Agda-stdlib/_build/2.6.4.3/agda/src/Data/Unit/Base.agdai. HOT 2
- fail in solving instance of `⊆-refl` in Agda 2.6.4.3 HOT 12
- with-abstraction regression HOT 6
- U+02B3 (MODIFIER SMALL LETTER R, aka superscript r) not available via \^r HOT 4
- Testsuite: heads up: with GHC 9.10, `throw` will print a callstack HOT 4
- Agda >=2.6.3 hangs on conflicting record directives HOT 4
- Revert cyclic computation of ranges (and ban `mdo` from this code base) HOT 2
- Bad interaction between instance search and opaque HOT 6
- Normalization gives trivial `transp` HOT 1
- `--postfix-projections` do not make use of mixfix syntax HOT 1
- No warning about useless `{-# CATCHALL #-}` pragma
- HTML backend: inconsistent highlighting for macro names
- Internal error on pattern lambda with no clauses
- wrong type for unnamed record constructor
- Search for project root crashes when (parent) directory lacks permissions HOT 1
- quoteTerm loops on dependent copattern lambda HOT 3
- Caching loses reflection-generated pragmas
- Emacs: Support default value of `agda2-infer-type-maybe-toplevel` from type at point HOT 1
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.