DeepSpec / InteractionTrees

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

State facts #58

Closed Zdancewic closed 5 years ago

Zdancewic commented 5 years ago

This pull request completes some of the missing proofs in MorphismsFacts.v that have to do with interp_state. It also adds a Proper morphism declaration for interp_state to enable rewriting.

Zdancewic commented 5 years ago

I just checked in some more work on some examples with reasoning about the state monad. (See the experiments/Reasoning.v file.)

-- The runboth lemmas were mostly boilerplate. It would be good to think about how to abstract over these: lemmas that combine two separate run functions and show that their operations commute generically, as well as "lifting" properties (such as get_law) from one monad's interpretation into an interpeter combined with another.

Lysxia commented 5 years ago

It might be a bit cleaner if functions like interp_state didn't introduce a Tau node for Vis constructors that they don't handle. The way things are now, nesting monads introduces extra Taus when the unhandled visible even propagates through the interpreter.

interp1_state has a notion of "unhandled" events for which it avoids the extra Tau.

Zdancewic commented 5 years ago

Good point about interp1! I modified the examples to use that instead. (Along the way, I added Proper inter1_state and accompanying lemmas). It seems to me that we probably want to use the "interp1" version of interpreters whenever we can.