diff options
| author | Thomas Bauereiss | 2018-05-04 17:44:07 +0100 |
|---|---|---|
| committer | Thomas Bauereiss | 2018-05-09 14:19:57 +0100 |
| commit | c3f3642dfa5647685ae3dea86beeef8abc27f026 (patch) | |
| tree | fdb90562b5a4c194c97a764eabe607d1fd9a02c5 /src/gen_lib | |
| parent | 9fea45722d58132cc484d9421fb3407286dc4f01 (diff) | |
Support short-circuiting of Boolean expressions in Lem
Diffstat (limited to 'src/gen_lib')
| -rw-r--r-- | src/gen_lib/prompt.lem | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/gen_lib/prompt.lem b/src/gen_lib/prompt.lem index de683047..830f2350 100644 --- a/src/gen_lib/prompt.lem +++ b/src/gen_lib/prompt.lem @@ -38,6 +38,12 @@ end declare {isabelle} termination_argument foreachM = automatic +val and_boolM : forall 'rv 'e. monad 'rv bool 'e -> monad 'rv bool 'e -> monad 'rv bool 'e +let and_boolM l r = l >>= (fun l -> if l then r else return false) + +val or_boolM : forall 'rv 'e. monad 'rv bool 'e -> monad 'rv bool 'e -> monad 'rv bool 'e +let or_boolM l r = l >>= (fun l -> if l then return true else r) + val bool_of_bitU_fail : forall 'rv 'e. bitU -> monad 'rv bool 'e let bool_of_bitU_fail = function | B0 -> return false |
