Skip to content

Commit

Permalink
Merge pull request #1149 from GaloisInc/issue734
Browse files Browse the repository at this point in the history
Teach the typechecker a bit more about exponents
  • Loading branch information
robdockins authored Apr 6, 2021
2 parents 523a2dc + 3258bb1 commit 78a5d0b
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 3 deletions.
6 changes: 4 additions & 2 deletions lib/CryptolTC.z3
Original file line number Diff line number Diff line change
Expand Up @@ -267,10 +267,12 @@
))
)



(declare-fun cryExpUnknown (Int Int) Int)

(assert (forall ((x Int) (y Int))
(=> (and (> y 0) (> x 0))
(>= (cryExpUnknown x y) x))))

(define-fun cryExpTable ((x Int) (y Int)) Int
(ite (= y 0) 1
(ite (= y 1) x
Expand Down
1 change: 1 addition & 0 deletions tests/issues/issue148.icry
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
:set showExamples = no
:l issue148.cry
:sat (\(e:[64]) -> (e@@[8..24]) != zero)
1 change: 0 additions & 1 deletion tests/issues/issue148.icry.stdout
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ Loading module Cryptol
Loading module Cryptol
Loading module Main
Satisfiable
(\(e : [64]) -> (e @@ [8 .. 24]) != zero) 0x00feff8000000000 = True
8 changes: 8 additions & 0 deletions tests/issues/issue734.cry
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
f : {a} (fin a) => [2^^a - 1] -> [3*(2^^a - 1)]
f x = x # x # x

asdf1 : {r} (fin r, width (2^^r)==r+1) => [r+1]
asdf1 = `(2^^r)

asdf2 : {r} (fin r, width(2^^r-1)==r) => [r]
asdf2 = `(2^^r-1)
6 changes: 6 additions & 0 deletions tests/issues/issue734.icry
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
:l issue734.cry

f`{3} 0b1010101

asdf1`{8}
asdf2`{8}
6 changes: 6 additions & 0 deletions tests/issues/issue734.icry.stdout
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Loading module Cryptol
Loading module Cryptol
Loading module Main
0x156ad5
0x100
0xff

0 comments on commit 78a5d0b

Please sign in to comment.