Repository navigation
Conversation
Fixes #4803. Previously only the Windows job was uploading that binary, which meant that the `install_agda_user.sh` script would fail.
Displays the concerned instances in case of an inconsistence instances error.
GHC 8.0 does not support the {-# COMPLETE #-} pragma,
leading to false positives.
[skip travis]
|
I could build 57e31fe using GHC 8.10.4. I'd like to test some of my code, but the standard library (agda/agda-stdlib@d66a21f) is not accepted by this version of Agda. |
|
@nad You can try the version of the standard library that this version of Agda is built against: |
|
The following code is accepted by Agda 2.6.2-f9a1816, but rejected by 57e31fe: variable
A B : Set
P : A → Set
x y : A
_$_ : ((x : A) → P x) → ((x : A) → P x)
f $ x = f x
postulate
_≡_ : A → A → Set
refl : (x : A) → x ≡ x
elim : (P : {x y : A} → x ≡ y → Set) →
(∀ x → P (refl x)) →
(x≡y : x ≡ y) → P x≡y
elim-refl : (P : {x y : A} → x ≡ y → Set)
(r : ∀ x → P (refl x)) →
elim P r (refl x) ≡ r x
cong : (f : A → B) → x ≡ y → f x ≡ f y
subst : (P : A → Set) → x ≡ y → P x → P y
subst P = elim (λ {u v} _ → P u → P v) (λ _ p → p)
subst-refl : (P : A → Set) (p : P x) → subst P (refl x) p ≡ p
subst-refl _ p = cong (_$ p) (elim-refl _ _) |
|
For the record, the regression was introduced from d41a104 to 88e00e0 . The crux of the issue lies in the following two constraints:
In Agda, _x_112 and _y_13 are instantiated without issues, and this enables the other metavariables to be solved. With heterogeneous unification, this instantiation is potentially unsound (as the types of the LHS and RHS do not match). A work around is to give the first argument of This type checks with 57e31fe. |
That might be annoying, I encountered unsolved metavariables for a number of pieces of similar-looking code. |
One possibility is to add a flag which, using the new constraint prioritization mechanism, will perform instantiations of metavariables which are only well-typed modulo as a last resort, and emit a warning when doing so. But it's kind of a hack. |
Are the solutions that Agda comes up with at the moment incorrect? |
|
I tried to make one of my developments work with this branch (8fb611e). This failed, because Cubical Agda is not supported yet, but I made more than 20000 lines ( Once support for Cubical Agda is added I might see how much work the remaining ∼60000 lines of code require, and I have a bunch of other developments as well. |
|
I think we should try to get this pull request into a state in which it can be merged before the code bit-rots too much. If I understand correctly the main problem relates to Cubical Agda, and there seems to be some code somewhere which addresses that problem, seemingly by using the hack that is currently in use everywhere:
@vlopezj, can you give us access to that code, and explain how it relates to the future-hetcon-no-compat branch? |
This change was done in collaboration with Andreas Abel.
15f86ca to
456a32a
Compare
|
I brought the code up to date. As part of that I made some changes to the standard library (@vlopezj had already fixed one of the problems before, in a different way). I also disabled some test cases. The following ones do not make use of Cubical Agda:
These three test cases, as well as one standard library file that I changed, use mutual recursion. I constructed a small test case from the standard library code: {-# OPTIONS --without-K #-}
P : Set → Set₁
Q : (A : Set) → P A → Set₁
Q _ _ = Set
E : Set₁
E = (A : Set) (x : P A) → Q _ x
P _ = SetWe get the following error message: This code should not be rejected, because it is accepted if Previously Some things that remain to be done before the code can be merged:
|
456a32a to
c56058d
Compare
Some test cases were disabled: * examples/TT.agda * test/Fail/InjectivityHITs.agda * test/Fail/Issue5237.agda * test/Fail/Issue5838.agda * test/Fail/Issue5838b.agda * test/Succeed/InjectivityHITs.agda * test/Succeed/Issue1592.agda * test/Succeed/Issue5576.agda * test/Succeed/Issue5579.agda * test/Succeed/SST.agda * test/Compiler/simple/Erased-cubical.agda Furthermore some changes were made to the standard library. Previously Agda.TypeChecking.Records.expandRecordVar was commented out, but this procedure is used in Agda.TypeChecking.Rules.LHS.Unify.LeftInverse.buildEquiv, so the commented-out code was restored. It is not known to the author of this commit whether the restored code is correct.
c56058d to
f7a535d
Compare
I wonder if, and if so how, the following code should be changed: agda/src/full/Agda/TypeChecking/Monad/Base.hs Lines 3333 to 3343 in c56058d Several Cubical Agda test cases trigger the error on the last line above. The use of agda/src/full/Agda/TypeChecking/Monad/Base.hs Lines 3109 to 3116 in c56058d The following pieces of code which use
All occurrences of
Perhaps the code is not correct, see above. |
|
As an experiment I replaced The cubical library test triggered another error: agda/src/full/Agda/TypeChecking/Conversion.hs Line 388 in f7a535d I could fix this by replacing
I don't advocate blindly applying the changes I discuss above, but this experiment suggests to me that it might be feasible to make the code "work". |
|
@nad wrote:
According to bisection, this indeed breaks first on your merge commit: f7a535d is the first bad commit |
|
Unfortunately, it does not seem like anyone has had the time to do the remaining work to bring this PR in a state that can be merged. Since we are now just two months from the (planned) release of 2.6.3, I don't think we should merge this now. Unfortunately, this means further bitrot of this PR is likely to occur, but I don't see a good alternative. |
This pull request supersedes #4605.
What?
Constraints in Agda are currently of the form:
Γ ⊢ t ≈ u : AThese constraints are homogeneous, which means that:
tanduhave typeA.When unifying a Π-types (
Γ ⊢ ΠAB ≈ ΠA′B′ type) we obtain the following two constraints:Γ ⊢ A ≈ A′ typeΓ,_α ⊢ B ≈ B′ typeWhat the type of
_αshould be is not obvious:_αas an uninterpreted constant (c.f. Norell (2007)). This solves some, but not all problems (e.g. Internal error in the presence of unsatisfiable constraints #3027), and is the current approach in Agda._α := A, but this means that the right-hand side may be ill-typed._α := A′, but this means that the right-hand side may be ill-typed.Regarding the last two, this pull request can be summarized as:
“¿Por qué no los dos?” (Gundry (and McBride) (2013), López Juan and Danielsson (2020)).
How?
This pull request affects conversion checking. Other parts of the code-base, such as term reduction, unification for pattern matching, Auto, the size solver, etc. are unaffected.
The most important changes to the infrastructure are described in this gist.
For the theory and motivation behind those changes, I suggest this short paper.
Main improvements
EffortLevel, until all constraints with a lower effort level are asleep. This can be used as a mechanism to run certain necessary but costly conversion operations as a last resort.ISets, for problem ids, but which could potentially also be used to represent sets of metavariables among other things.Before merging/What doesn't work
This pull request is quite large and complex, so a merge rather than a rebase would be called for.
Here are the points that need to be address and/or acknowledged before this can be merged:
See agda/agda-stdlib@d00ba75
masterthat was merged 47179128 (January 7th). Some conflicting changes (not to theConversionmodule, luckily) have been done since.types. For instance, it can tackle a constraint of type
Γ ⊢ t ≈ u : Path A, but what about a heterogeneous constraint of typeΓ ⊢ t : Path A ≈ u : Path A'?Also, context variables, etc. Currently, cubical-related code that unexpectedly encounters a twin type will crash with an
__UNIMPLEMENTED__error.Some experiments in separate branches show that the a big part of the cubical library code (except for one definition in one module) can still type-check by (unsoundly?) replacing twin-types by uninterpreted constants, as was done before.
Het,TwinT) may not be the most intuitive.2021-08-27
Here is a summary of the work that would absolutely need to be done before this PR can be merged into
master:The pull request has been tested with agda-prelude, agda-stdlib, and HoTT-Intro. It should also be tested with other large projects, among them:
This PR is based on a January 2020 commit (4717912820a7). It should be brought up to date with the latest release.
Type-checking Cubical Agda involves novel constraint manipulations which, as currently written, don't take into account the existence of twin types. At least the following operations need to be adapted in order to support constraints and contexts with twin types:
mGlue,mHCompandmSubheaded neutral terms.isOne …, where the type of the constraint is a twin type with differing parameters toisOneon each side.forallFaceMaps.Due to the more stringent preconditions for assigning metavariables, there are cases of existing well-typed programs in which some implicit arguments would now need to be given explicitly. These users should be warned so that they can adapt their code.