Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dm4f: M not quite a synonym for Tot #710

Closed
catalin-hritcu opened this issue Oct 9, 2016 · 4 comments
Closed

dm4f: M not quite a synonym for Tot #710

catalin-hritcu opened this issue Oct 9, 2016 · 4 comments

Comments

@catalin-hritcu
Copy link
Member

catalin-hritcu commented Oct 9, 2016

Switching from Tot to M causes 3 of my previous ifc proofs to fail. For instance, the following code works with Tot, but does not work with M:

module Bug

type label =
  | Low
  | High

let ifc (a:Type) = label -> M (option (a * label))

let eq_ifc (a:Type) (f:ifc a) (g:ifc a) =
   forall l. f l == g l

let return_ifc (a:Type) (x:a) : ifc a = fun l -> Some (x, l)
let bind_ifc (a:Type) (b:Type) (f:ifc a) (g: a -> Tot (ifc b)) : ifc b
  = fun l0 -> let fl0 = f l0 in match fl0 with
           | None -> None
           | Some (x, l1) ->
             let gxl1 = g x l1 in match gxl1 with
             | None -> None
             | Some (y, l2) -> Some(y, l2)

val left_unit: a:Type -> b:Type -> x:a -> f:(a -> Tot (ifc b))
            -> Lemma (eq_ifc b (bind_ifc a b (return_ifc a x) f) (f x))
let left_unit a b x f = ()
[hritcu@detained bug-reports]$ fstar.exe bug710.fst
./bug710.fst(22,71-23,26): could not prove post-condition
Error: 1 errors were reported (see above)
catalin-hritcu added a commit that referenced this issue Oct 9, 2016
@catalin-hritcu
Copy link
Member Author

@kyoDralliam was looking at this and it seems a problem with the way M is encoded to the SMT solver.

@kyoDralliam
Copy link
Contributor

More precisely, M is encoded in the SMT solver query as a non total effect.

@catalin-hritcu catalin-hritcu mentioned this issue Oct 28, 2016
27 tasks
@kyoDralliam
Copy link
Contributor

kyoDralliam commented Dec 8, 2016

Fixed by the introduction of the cps attribute (commit 9168f97)

@catalin-hritcu
Copy link
Member Author

If this is fixed we should consider moving the monad laws from
https://github.com/FStarLang/FStar/blob/master/examples/dm4free/FStar.DM4F.MonadLaws.fst
to their respective files and make them use M instead of Tot.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants