WHNF and confluence
francoisthire opened this issue · comments
On the example below, we observe a strange behavior:
A : Type.
a : A.
aa : A -> A.
def f : (A -> A) -> A -> A.
def g : (A -> A) -> A -> A.
def h : (A -> A) -> (A -> A) -> A -> A.
def bb : A -> A := aa.
(; WHNF not well-defined on non confluent system ;)
[] f (x => bb x) --> (x : A => aa x).
#EVAL[WHNF] f (x => bb x).
Dedukti gives us that the WHNF of f (x => bb x)
is itself while it is obviously a redex. The reason is that bb
being defined, Dedukti tries first to reduce the argument (x => bb x) (not using a WHNF strategy), that reduces to (x => aa x), and then tries to match the pattern.
I think the manual should clearly state that the WHNF strategy is not well-defined for non-confluent systems. Notice that this behavior applies also to the HNF strategy.
Well, dedukti itself is not well-defined on non-confluent systems!
See #90 for a definition of WHNF as implemented now by Dedukti (is it a good definition is still an open problem).
I have the impression that my example contradicts your definition. You should had the hypothesis that the rewrite system is confluent.
Why ?
f (x => bb x)
reduces to f (x => aa x)
, which is in normal form and in this sequence no reduction occurs at the head.