DeepSpec / InteractionTrees

A Library for Representing Recursive and Impure Programs in Coq
MIT License
199 stars 50 forks source link

re-defining monad notations #156

Closed vzaliva closed 3 years ago

vzaliva commented 4 years ago

Currently module ITreeNotations re-defines some standard monad notations already defined in ext-lib:

Notation "t1 >>= k2" := (ITree.bind t1 k2)
  (at level 50, left associativity) : itree_scope.
Notation "x <- t1 ;; t2" := (ITree.bind t1 (fun x => t2))
  (at level 61, t1 at next level, right associativity) : itree_scope.
Notation "t1 ;; t2" := (ITree.bind t1 (fun _ => t2))
  (at level 61, right associativity) : itree_scope.
Notation "' p <- t1 ;; t2" :=
  (ITree.bind t1 (fun x_ => match x_ with p => t2 end))
  (at level 61, t1 at next level, p pattern, right associativity) : itree_scope.
Infix ">=>" := ITree.cat (at level 61, right associativity) : itree_scope.

The recent change in ext-lib changed levels for these notations and now they are conflicting with itrees' notations for projects which depend on both (e.g. Vellvm, Helix).

Additionally, this notation in trees is defined as cat while in ext-lib it is mcompose

  Infix ">=>" := ITree.cat (at level 61, right associativity) : itree_scope.

It would be nice to switch to ext-lib notations everywhere.

Lysxia commented 4 years ago

I agree these notations are currently a pain to maintain. I'm strongly considering removing them and just using ext-lib, but we still have to be especially careful about setting the right version bounds because of the recent fluctuations in notations and definitions, which can break our code.

At the moment branch master works only with coq-ext-lib.0.10.3 (unless one is careful to avoid the notation clash).

Lysxia commented 4 years ago

Hm, this is actually somewhat difficult to fix because type classes behave differently with computation. The problem is that cbn reduces @bind _ Monad_itree back to ITree.bind. I tried setting Monad_itree to simpl never, but this blocks proofs by computation. In particular uses of tau_steps in tutorial/Interoduction.v no longer do anything.

I have to experiment more with that.

Lysxia commented 3 years ago