soft-contract icon indicating copy to clipboard operation
soft-contract copied to clipboard

Soundness bug: fact 4 >= 120

Open dvanhorn opened this issue 10 years ago • 2 comments
trafficstars

This program is incorrectly proved safe.

(module factorial racket
  (define (fact x)
    (if (zero? x)
        1
        (* x (fact (sub1 x)))))

  (provide
   (contract-out
    [fact (-> (and/c integer? (>=/c 4))
              (and/c integer? (>=/c 120)))])))

dvanhorn avatar Jan 16 '15 20:01 dvanhorn

Just tried this program. It's rejected. Then I tried changing (>=/c 4) to (>=/c 5) and it's still rejected (new issue?)

bennn avatar Jun 04 '17 05:06 bennn

Rejecting (>=/c 5) would be a precision problem I suppose?

philnguyen avatar Jun 04 '17 17:06 philnguyen