Unjustified unsatisfiable constraint warning
Gaspi opened this issue · comments
Consider the following example
A : Type.
def f : A -> A.
B : A -> Type.
consB : x : A -> B (f x).
C : A -> A -> Type.
consC : x : A -> C x (f x).
def k : a : A -> B a -> A.
[a,b] k a (consB b) --> b.
def calc : a : A -> b : B a -> C (f a) (k a b) -> Type.
D : a : A -> B (f (f a)) -> Type.
[a,b,c] calc a (consB b) (consC c) --> A.
The LHS of the last rule is well-typed under three constraints :
a
≡f b
b
≡f c
c
≡f a
Dedukti compute the substitution (c
↦f a
, b
↦f (f a)
) from the last two and is left with the substituted equation a
≡f (f (f a))
.
Right now Dedukti cannot use this last equation to type check the rule as it is not a substitution. In this case however it doesn't need to so it's fine.
It does however raise an "unsatisfiable constraint" warning even though a
≡f (f (f a))
seems very satisfiable in general, especially as f
is definable (the file typechecks if you make it a constant) so it may very well have fixpoints.
Is this really a bug? I would say that the error message is not correct instead.
It's a bit of a bug that the error message is incorrect, isn't it ?
It could also turn into a "real" bug as "unsatisfiable constraints" essentially means "this rule will never be applied":
- we could decide at some point that Dedukti should type check all rules with "unsatisfiable constraints" regardless of the type of the RHS (rules that can never be applied have the SR property).
- the user (human or script interacting with the kernel) might think the rule useless and discard it
I think that saying unsatisfiable constraints
here is a real mistake because of the arguments you have made. Instead, it should say that it could not compute a substitution.
But using the example of yesterday, unsatsfiable constraints
means only that at the current time the rule cannot be applied, it does not mean that it will never be applied, right?
For me unsatisfiable constraints
means that the equations will never be satisfiable, ie.:
C t_1 ... t_n = D u_1 ... u_m
withC
andD
different constant symbols,- or
x = C t_1 ... t_n
such thatC
constant,x
occurs in at_i
and all thet_i
's in the grammaru ::= D u* | y | λ y.u
withD
constant andy
a variable.
It seems strongly related to #183 .