You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Some data types are translated into Coq data types that violate the strict positivity restriction. As a result, the generated Coq code cannot be compiled.
Steps to Reproduce
Translate the following Haskell program with the Free compiler.
dataNSPa=Vala | Stack (NSP (NSPa))
Expected Behavior
The compiler should throw an error when it encounters a Haskell data type whose translation would violate the strict positivity restriction.
Actual Behavior
No error is thrown. Translating this program leads to the following data type definition in Coq.
Inductive NSP (Shape : Type) (Pos : Shape -> Type) (a : Type) : Type
:= val : Free Shape Pos a -> NSP Shape Pos a
| stack : Free Shape Pos (NSP Shape Pos (NSP Shape Pos a)) -> NSP Shape Pos a.
This definition causes the following error.
Non strictly positive occurrence of
"NSP" in
"Free Shape Pos (NSP Shape Pos (NSP Shape Pos a)) ->
NSP Shape Pos a".
Implement an analysis that checks whether a data type's translation would violate the strict positivity restriction and throw an error if this is the case.
The text was updated successfully, but these errors were encountered:
MajaRet
changed the title
Translation of certain data types violates Coq's strict positivity restriction
Translated data types violate Coq's strict positivity restriction
Jul 27, 2020
Description
Some data types are translated into Coq data types that violate the strict positivity restriction. As a result, the generated Coq code cannot be compiled.
Steps to Reproduce
Translate the following Haskell program with the Free compiler.
Expected Behavior
The compiler should throw an error when it encounters a Haskell data type whose translation would violate the strict positivity restriction.
Actual Behavior
No error is thrown. Translating this program leads to the following data type definition in Coq.
This definition causes the following error.
Versions
8779013877645b9547bb36c93fa1df9856b2b1aa
ghc --version
:8.6.5
cabal --version
:3.2.0.0
coqc --version
:8.11.0
ToDo
Implement an analysis that checks whether a data type's translation would violate the strict positivity restriction and throw an error if this is the case.
The text was updated successfully, but these errors were encountered: