Zulip Chat Archive

Stream: lean4

Topic: prove "bind" function is total


Locria Cyber (Jul 19 2022 at 19:45):

def extract [Pure ε] [Bind ε] : (stacked: Eff [ε] α) -> ε α
| Free.pure x => pure x
| Free.bind val cont => bind (simplify val) (λ a => extract (cont a))

the compiler says

fail to show termination for
  Eff.extract
with errors
argument #5 was not used because its type is an inductive family and indices are not variables
  Free (Union [ε]) α

structural recursion cannot be used

failed to prove termination, use `termination_by` to specify a well-founded relation

Simon Hudon (Jul 20 2022 at 01:25):

Can you show the definition of Eff?

Locria Cyber (Jul 20 2022 at 12:26):

I solved it. It cannot be proved.

Locria Cyber (Jul 20 2022 at 13:09):

(mcont a') should be smaller than val, which is mk (FreeView.bind mval mcont)

Simon Hudon (Jul 21 2022 at 01:38):

Does the termination_by line fix your issue?


Last updated: Dec 20 2023 at 11:08 UTC