subtypep giving inconsistent results on certain cons types

Bug #1694839 reported by Paul F. Dietz on 2017-05-31
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SBCL
Undecided
Unassigned

Bug Description

If A is a subtype of B, then (NOT B) should be a subtype of (NOT A). If subtypep can determine the subtype relationship in both cases then they must be consistent. However:

(SUBTYPEP '(CONS INTEGER (CONS (REAL -3.3 4.4) (EQL 1)))
          '(NOT (CONS T (CONS (NOT INTEGER) (EQL 0))))) => T, T
(SUBTYPEP '(NOT (NOT (CONS T (CONS (NOT INTEGER) (EQL 0)))))
          '(NOT (CONS INTEGER (CONS (REAL -3.3 4.4) (EQL 1))))) => NIL, T
(SUBTYPEP '(CONS T (CONS (NOT INTEGER) (EQL 0)))
          '(NOT (CONS INTEGER (CONS (REAL -3.3 4.4) (EQL 1))))) => NIL, T

This is in sbcl 1.3.18.

tags: added: types
Changed in sbcl:
status: New → Incomplete
Paul F. Dietz (paul-f-dietz) wrote :

This is still occurring in 1.4.3.

Changed in sbcl:
status: Incomplete → New
Michał "phoe" Herda (phoe-krk) wrote :

(let* ((t1 '(not (cons float t)))
       (t2 `(or (not (cons (eql 0)
                           (real -3.926510009989861d7 -3.926510009989861d7)))
                (not (cons t (eql 0))))))
  (subtypep t1 t2))

;=> NIL, T

This happens even though T2 is equivalent to T.

Paul F. Dietz (paul-f-dietz) wrote :

That was from test SUBTYPEP.CONS.43 in ansi-test, which was added back in SBCL 0.9.6.57.

To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers