-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
crucible-syntax: Allow exotic characters in fresh atom names
Previously, we used `userSymbol` to create fresh atom names, but `userSymbol` will fail if given any characters outside of the very narrow range of characters allowed in What4 solver names. Instead, we now use `safeSymbol`, which will Z-encode any unallowable characters into something that is allowed in a What4 solver name. This ensures (among other things) that we can write things like `(let i-3 (fresh Bool))`, as hyphens are not allowed in What4 solver names without Z-encoding them. Fixes #1024.
- Loading branch information
1 parent
d0c27a1
commit 8be1cd0
Showing
3 changed files
with
45 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
; A regression test for #1024. | ||
|
||
(defun @exotic-fresh-names () Bool | ||
(start start: | ||
; Although the list of allowable characters in What4 solver names is very | ||
; small, we can nevertheless define atom names with unallowable characters | ||
; by Z-encoding them under the hood. | ||
(let ω (fresh Bool)) ; Fancy Unicode characters | ||
(let hyphens-are-fine (fresh Bool)) ; Hyphens | ||
(return (and ω hyphens-are-fine)))) |
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,17 @@ | ||
(defun @exotic-fresh-names () Bool | ||
(start start: | ||
(let ω (fresh Bool)) | ||
(let hyphens-are-fine (fresh Bool)) | ||
(return (and ω hyphens-are-fine)))) | ||
|
||
exotic-fresh-names | ||
%0 | ||
% 8:12 | ||
$0 = fresh BaseBoolRepr zenc!z3c9U | ||
% 9:27 | ||
$1 = fresh BaseBoolRepr zenc!hyphenszmarezmfine | ||
% 10:13 | ||
$2 = and($0, $1) | ||
% 10:5 | ||
return $2 | ||
% no postdom |