Comments (10)
Thanks. This is actually horrifying, because ACL2 can prove
(thm (booleanp (standard-char-p x))).
Im aware of the "generalized boolean" issue but this is the first time it's bitten us.
I'll pursue this further later....
from acl2.
SBCL no longer has this issue (as of its commit 780ec048d0 yesterday). This morning I cloned the latest SBCL, built ACL2 on it, and ran a successful "regression-everything". I might (soon-ish) add a little to the error message for SBCL 2.4.2 users, suggesting use of either SBCL 2.4.1 or the latest github version of SBCL.
from acl2.
That's seems strange to me, since I get the following with SBCL 2.4.1 on Linux.
ACL2 !>(standard-char-p (code-char 10))
T
ACL2 !>
But maybe this has something to do with multiple characters, as you note.
I'll look into it soon, probably later today. Thanks for the report.
from acl2.
I didn't dig into this enough - it seems like it might be a bug, as standard-character-p
is not returning a Boolean on SBCL 2.4.2 in this case:
# SBCL 2.4.1
* (standard-char-p (code-char 10))
T
# SBCL 2.4.2
* (standard-char-p (code-char 10))
#\Newline
acl2-check.lisp
relies on the result being a Boolean.
from acl2.
Actually this seems to be allowed behavior by SBCL according to the HyperSpec, as standard-character-p
is specified as returning a generalized boolean.
I think that replacing the form starting on line 267 of acl2-check.lisp
with the following should resolve the immediate problem. Running the below form on SBCL 2.4.2 does not result in an error, while running the original form does.
(dotimes (i 256)
(let ((ch (code-char i)))
(or (equal (not (null (standard-char-p ch)))
(or #+(and mcl (not ccl))
(= i 13)
#-(and mcl (not ccl))
(= i 10)
(and (>= i 32)
(<= i 126))))
(error "This Common Lisp is unsuitable for ACL2 because the ~
character~%with char-code ~d ~a standard in this ~
Common Lisp but should~%~abe."
i
(if (standard-char-p ch) "is" "is not")
(if (standard-char-p ch) "not " "")))))
I can submit a PR for this change if you would like.
from acl2.
I see what's going on. Common Lisp specifies that a predicate can
return a "generalized Boolean", which is actually anything at all --
nil represents false, and everything else represents true. However,
SBCL 2.4.2 is the first time we've seen this, over more than 30 years
of ACL2 development with multiple Lisps hosting the system (currently,
six of them). In case anyone is interested, here is the relevant
definition from file src/code/target-char.lisp of the SBCL 2.4.2
source distribution.
(defun standard-char-p (char)
"The argument must be a character object. STANDARD-CHAR-P returns true if the
argument is a standard character -- one of the 95 ASCII printing characters or
<return>."
(let ((n (char-code char)))
;; returning CHAR for true is fine, and it's already in a register,
;; but the compiler can't infer BASE-CHAR from the constraint on N,
;; so we have to force it.
(if (std-char-code-p n) (truly-the base-char char) nil)))
So apparently standard-char-p is the identity function on standard
characters.
My plan is to email the sbcl-help list tomorrow to see if maybe this
wasn't really intended and might be "fixed" in the next SBCL release.
I'm guessing that the answer will be "no" (explicitly or implicitly).
In that case, our plan is to replace standard-char-p by a new function,
standard-char-p$, whose definition matches what's currently in the
ACL2 logic for standard-char-p (hence, returns a Boolean). I'll make
that replacement in the community books as well.
I suppose we could redefine standard-char-p in raw Lisp, though I
don't like that idea since maybe SBCL depends on the new definition
somehow. For what it's worth, I'll also note that same SBCL source
file declares standard-char-p to be inline (with a suitable declaim
form).
By the way, I don't want to redefine standard-char-p, in part because
it's apparently inlined.
from acl2.
I might (soon-ish) add a little to the error message for SBCL 2.4.2 users, suggesting use of either SBCL 2.4.1 or the latest github version of SBCL.
Please do so, we ran into this in Gentoo: https://bugs.gentoo.org/926360
from acl2.
@xgqt Sorry about the inconvenience. I've added such an error message (github master commit 2f29000). I think this issue can be closed.
from acl2.
Thanks so much Matt!
from acl2.
@xgqt Sorry about the inconvenience. I've added such an error message (github master commit 2f29000). I think this issue can be closed.
No need to be sorry :D I dont think anybody knew we could run into this. Thanks a lot for the fix.
from acl2.
Related Issues (20)
- XDOC ignores unknown tags HOT 4
- Make target "save-exec" sometimes fails to rebuild HOT 3
- trace output gets error when certain lisp objects encountered HOT 4
- fty::deftagsum getting error in program mode HOT 2
- Slime support HOT 5
- [Proposal] Improve doc and code links in doc HOT 10
- Add website links to ACL2-help manual page HOT 1
- In :DOC at the terminal and acl2-doc, delimiting italicized and bold text with underscores HOT 8
- ACL2 books certification with SBCL on M1 Mac HOT 7
- preventing include-raw reloading HOT 5
- preventing quicklisp bundle definition from reloading HOT 1
- zippy reload gets error
- `:pr` errors out on induction rule HOT 2
- x86isa instruction issues HOT 3
- Can't certify all books with SBCL 2.3.8 on M2 Mac HOT 12
- Quicklisp books failure for CMUCL HOT 2
- About books/projects/arm/second/fsqrt4/fsqrt4.cpp proof using ACL2 HOT 8
- Is there an automated way to convert Cpp files into lisp files HOT 1
- Use arrow keys to navigate input in ACL2 shell HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from acl2.