diff options
author | Michalis Pardalos <m.pardalos@gmail.com> | 2021-05-06 20:53:16 +0100 |
---|---|---|
committer | Michalis Pardalos <m.pardalos@gmail.com> | 2021-05-06 20:53:16 +0100 |
commit | e4edfe6242c1f87bcae3beb17c398486b525dd77 (patch) | |
tree | 1a45e26deabe0528ec3d1927274378501e4fb17f /src/common | |
parent | ecf2660a3d11ba35ec9e79d8b7d4740488da3441 (diff) | |
download | vericert-e4edfe6242c1f87bcae3beb17c398486b525dd77.tar.gz vericert-e4edfe6242c1f87bcae3beb17c398486b525dd77.zip |
Prove a spec for the mapping of function params
Extracted the traversal of call args into a function and gave it a spec,
so that it can be used to prove the overall spec for the Icall instruction.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/Monad.v | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/common/Monad.v b/src/common/Monad.v index 68233b1..c9cdc1a 100644 --- a/src/common/Monad.v +++ b/src/common/Monad.v @@ -50,19 +50,18 @@ Module MonadExtra(M : Monad). End MonadNotation. Import MonadNotation. - Fixpoint sequence {A: Type} (l: list (mon A)) {struct l}: mon (list A) := + Fixpoint traverselist {A B: Type} (f: A -> mon B) (l: list A) {struct l}: mon (list B) := match l with | nil => ret nil | x::xs => - do r <- x; - do rs <- sequence xs; + do r <- f x; + do rs <- traverselist f xs; ret (r::rs) end. - Fixpoint traverselist {A B: Type} (f: A -> mon B) (l: list A) {struct l}: mon (list B) := - sequence (map f l). + Definition sequence {A} : list (mon A) -> mon (list A) := traverselist (fun x => x). - Fixpoint traverseoption {A B: Type} (f: A -> mon B) (opt: option A) {struct opt}: mon (option B) := + Definition traverseoption {A B: Type} (f: A -> mon B) (opt: option A) : mon (option B) := match opt with | None => ret None | Some x => |