-
Notifications
You must be signed in to change notification settings - Fork 49
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve code position (match + extended assignments) (#654)
- `^match` pattern now allowed within a code pos - `#cname` can be used to select the appropriate sub-branch of a match, e.g. `^match#Some.1` - `^lv<@` and `^lv<$` are now permitted
- Loading branch information
1 parent
ed8f813
commit 9eaff01
Showing
8 changed files
with
144 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
(* -------------------------------------------------------------------- *) | ||
require import Distr. | ||
|
||
(* -------------------------------------------------------------------- *) | ||
module M = { | ||
proc f(x : bool option) = { | ||
var y; | ||
y <- false; | ||
match x with | ||
| None => {} | ||
| Some v => { | ||
if (v) { | ||
y <$ dunit ((y || true) && true); | ||
} | ||
} | ||
end; | ||
return y; | ||
} | ||
proc g(x : bool option) = { | ||
var z; | ||
z <- false; | ||
match x with | ||
| None => {} | ||
| Some v => { | ||
if (v) { | ||
z <$ dunit true; | ||
} | ||
} | ||
end; | ||
return z; | ||
} | ||
}. | ||
|
||
(* -------------------------------------------------------------------- *) | ||
equiv l: M.f ~ M.g: ={arg} ==> ={res}. | ||
proof. | ||
proc. | ||
proc rewrite {1} ^match#Some.^if.^y<$ /=. | ||
by sim. | ||
qed. |