EmilyOng / AlgebraicEffect

effects system for continuation
https://songyahui.github.io/AlgebraicEffect/
0 stars 0 forks source link

Search tree module #3

Closed EmilyOng closed 10 months ago

EmilyOng commented 10 months ago

Sample program: foldr_length

Note 1

Proof is currently at: [any; unfold rhs] ex v92 v93; req emp; ens tail(xs)=v93/\is_cons(xs)=true; length(v93, v92); ex r; req emp; Norm(r=1+v92/\res=r+init)

Screenshot 2023-12-16 at 11 37 06 AM

Now, the proof succeeds but all does not seem to be respected (because it has a failed any child, hidden due to compact search tree representation). Shouldn't it be ?

Screenshot 2023-12-16 at 11 37 19 AM

Note 2

The ✔ [all; unfold lhs] ex v53; req emp; Norm(is_nil(xs)=true/\res=init) flow is marked to succeed though it has an unverified any. Below is a non-compact tree representation.

Screenshot 2023-12-16 at 11 53 22 AM

(tracing) State update over here https://github.com/EmilyOng/AlgebraicEffect/blob/StagedSL/parsing/search.ml#L80

EmilyOng commented 10 months ago

Another question for take_skip

[any; disj rhs] Norm(res=[]) is marked as failed prematurely, should the subsequent flows still be tried?

Screenshot 2023-12-16 at 11 41 43 AM

dariusf commented 10 months ago

"any" means that the parent goal succeeds if any child succeeds. In other words, any of the nodes marked "any" have to succeed.

I went through all 3 examples and think they are correct under this interpretation. For example, in the last one, the "any" has failed because all its children have to succeed, which is no longer possible.

Anyway, I agree that it's confusing. I've tweaked the drawing, hopefully it's more intuitive (and less noisy) now. If not we can always change it back/further.

EmilyOng commented 10 months ago

Thanks very much!