statement
stringlengths
1
746
proof
stringlengths
0
19.5k
type
stringclasses
7 values
symbolic_name
stringlengths
1
36
library
stringclasses
13 values
filename
stringclasses
70 values
imports
listlengths
0
23
deps
listlengths
0
14
docstring
stringclasses
1 value
source_url
stringclasses
1 value
commit
stringclasses
1 value
Node
= { message : WorkBlock, state : State } // Some encryption schemes process multiple blocks at once
type
Node
examples
examples/AE.cry
[]
[ "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
WorkBlock
= [p*n]
type
WorkBlock
examples
examples/AE.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
State
= [p*n] // The state for `p` blocks
type
State
examples
examples/AE.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Tweak
= { nonce : Nonce, state : A, z : Int }
type
Tweak
examples
examples/AE.cry
[]
[ "Int" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Nonce
= [n] /* property // The tweak in the `i`th query to the tweak_cipher tweak_prop i { nonce = n, state = a, z = v } = { nonce = n, state = a, z = v + i - 1 } // Property of decrypt Dec_prop : Tweak -> Node -> Bit Dec_prop t { message = m, state = x } = Dec t { message = c, state = x }...
type
Nonce
examples
examples/AE.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Int
= [64]
type
Int
examples
examples/AE.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
encrypt : {m} fin m => K -> Nonce -> A -> [m * (p * n)] -> [m * (p * n) + tagAmount]
encrypt key nonce state inputMsg = encMsg # tag where encMsg = join rest.0.message tag = take (Tag key (tweak (1 - final.1)) final.0.state) final = steps ! 0 steps = [ ({ message = undefined, state = zero }, 1) ] # rest rest = [ (Enc key (tweak v) { message = m, state = prev.state }, v + Cost) ...
function
encrypt
examples
examples/AE.cry
[]
[ "Int", "Nonce", "Tweak", "fin", "join", "split", "take", "zero" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AES128
= 4
type
AES128
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AES192
= 6
type
AES192
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AES256
= 8
type
AES256
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Nk
= AES128 // For Cryptol 2.x | x > 0 // NkValid: `Nk -> Bit // property NkValid k = (k == `AES128) || (k == `AES192) || (k == `AES256) // Number of blocks and Number of rounds
type
Nk
examples
examples/AES.cry
[]
[ "AES128" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Nb
= 4
type
Nb
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Nr
= 6 + Nk
type
Nr
examples
examples/AES.cry
[]
[ "Nk" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESKeySize
= (Nk*32) // Helper type definitions
type
AESKeySize
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
GF28
= [8]
type
GF28
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
State
= [4][Nb]GF28
type
State
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
RoundKey
= State
type
RoundKey
examples
examples/AES.cry
[]
[ "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
KeySchedule
= (RoundKey, [Nr-1]RoundKey, RoundKey) // GF28 operations
type
KeySchedule
examples
examples/AES.cry
[]
[ "RoundKey" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESCorrect msg key
= aesDecrypt (aesEncrypt (msg, key), key) == msg
property
AESCorrect
examples
examples/AES.cry
[]
[ "==", "aesDecrypt", "aesEncrypt" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28Add : {n} (fin n) => [n]GF28 -> GF28
gf28Add ps = sums ! 0 where sums = [zero] # [ p ^ s | p <- ps | s <- sums ]
function
gf28Add
examples
examples/AES.cry
[]
[ "GF28", "fin", "sums" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28Mult : (GF28, GF28) -> GF28
gf28Mult (x, y) = pmod(pmult x y) irreducible
function
gf28Mult
examples
examples/AES.cry
[]
[ "GF28", "irreducible", "pmod", "pmult" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28Pow : (GF28, [8]) -> GF28
gf28Pow (n, k) = pow k where sq x = gf28Mult (x, x) odd x = x ! 0 pow i = if i == 0 then 1 else if odd i then gf28Mult(n, sq (pow (i >> 1))) else sq (pow (i >> 1))
function
gf28Pow
examples
examples/AES.cry
[]
[ "==", ">>", "GF28", "gf28Mult" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28Inverse : GF28 -> GF28
gf28Inverse x = gf28Pow (x, 254)
function
gf28Inverse
examples
examples/AES.cry
[]
[ "GF28", "gf28Pow" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28DotProduct : {n} (fin n) => ([n]GF28, [n]GF28) -> GF28
gf28DotProduct (xs, ys) = gf28Add [ gf28Mult (x, y) | x <- xs | y <- ys ]
function
gf28DotProduct
examples
examples/AES.cry
[]
[ "GF28", "fin", "gf28Add", "gf28Mult", "xs" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28VectorMult : {n, m} (fin n) => ([n]GF28, [m][n]GF28) -> [m]GF28
gf28VectorMult (v, ms) = [ gf28DotProduct(v, m) | m <- ms ]
function
gf28VectorMult
examples
examples/AES.cry
[]
[ "fin", "gf28DotProduct" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
gf28MatrixMult : {n, m, k} (fin m) => ([n][m]GF28, [m][k]GF28) -> [n][k]GF28
gf28MatrixMult (xss, yss) = [ gf28VectorMult(xs, yss') | xs <- xss ] where yss' = transpose yss // The affine transform and its inverse
function
gf28MatrixMult
examples
examples/AES.cry
[]
[ "fin", "gf28VectorMult", "transpose", "xs" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
xformByte : GF28 -> GF28
xformByte b = gf28Add [b, (b >>> 4), (b >>> 5), (b >>> 6), (b >>> 7), c] where c = 0x63
function
xformByte
examples
examples/AES.cry
[]
[ ">>>", "GF28", "gf28Add" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
xformByte' : GF28 -> GF28
xformByte' b = gf28Add [(b >>> 2), (b >>> 5), (b >>> 7), d] where d = 0x05 // The SubBytes transform and its inverse
function
xformByte'
examples
examples/AES.cry
[]
[ ">>>", "GF28", "gf28Add" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
SubByte : GF28 -> GF28
SubByte b = xformByte (gf28Inverse b)
function
SubByte
examples
examples/AES.cry
[]
[ "GF28", "gf28Inverse", "xformByte" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
SubByte' : GF28 -> GF28
SubByte' b = sbox@b
function
SubByte'
examples
examples/AES.cry
[]
[ "GF28", "sbox" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
SubBytes : State -> State
SubBytes state = [ [ SubByte' b | b <- row ] | row <- state ]
function
SubBytes
examples
examples/AES.cry
[]
[ "State", "SubByte'" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
InvSubByte : GF28 -> GF28
InvSubByte b = gf28Inverse (xformByte' b)
function
InvSubByte
examples
examples/AES.cry
[]
[ "GF28", "gf28Inverse", "xformByte'" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
InvSubBytes : State -> State
InvSubBytes state = [ [ InvSubByte b | b <- row ] | row <- state ] // The ShiftRows transform and its inverse
function
InvSubBytes
examples
examples/AES.cry
[]
[ "InvSubByte", "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
ShiftRows : State -> State
ShiftRows state = [ row <<< shiftAmount | row <- state | shiftAmount <- [0 .. 3] ]
function
ShiftRows
examples
examples/AES.cry
[]
[ "<<<", "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
InvShiftRows : State -> State
InvShiftRows state = [ row >>> shiftAmount | row <- state | shiftAmount <- [0 .. 3] ] // The MixColumns transform and its inverse
function
InvShiftRows
examples
examples/AES.cry
[]
[ ">>>", "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
MixColumns : State -> State
MixColumns state = gf28MatrixMult (m, state) where m = [[2, 3, 1, 1], [1, 2, 3, 1], [1, 1, 2, 3], [3, 1, 1, 2]]
function
MixColumns
examples
examples/AES.cry
[]
[ "State", "gf28MatrixMult" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
InvMixColumns : State -> State
InvMixColumns state = gf28MatrixMult (m, state) where m = [[0x0e, 0x0b, 0x0d, 0x09], [0x09, 0x0e, 0x0b, 0x0d], [0x0d, 0x09, 0x0e, 0x0b], [0x0b, 0x0d, 0x09, 0x0e]] // The AddRoundKey transform
function
InvMixColumns
examples
examples/AES.cry
[]
[ "State", "gf28MatrixMult" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AddRoundKey : (RoundKey, State) -> State
AddRoundKey (rk, s) = rk ^ s // Key expansion
function
AddRoundKey
examples
examples/AES.cry
[]
[ "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Rcon : [8] -> [4]GF28
Rcon i = [(gf28Pow (<| x |>, i-1)), 0, 0, 0]
function
Rcon
examples
examples/AES.cry
[]
[ "gf28Pow" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
SubWord : [4]GF28 -> [4]GF28
SubWord bs = [ SubByte' b | b <- bs ]
function
SubWord
examples
examples/AES.cry
[]
[ "SubByte'" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
RotWord : [4]GF28 -> [4]GF28
RotWord [a0, a1, a2, a3] = [a1, a2, a3, a0]
function
RotWord
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
NextWord : ([8],[4][8],[4][8]) -> [4][8]
NextWord(i, prev, old) = old ^ mask where mask = if i % `Nk == 0 then SubWord(RotWord(prev)) ^ Rcon (i / `Nk) else if (`Nk > 6) && (i % `Nk == 4) then SubWord(prev) else prev
function
NextWord
examples
examples/AES.cry
[]
[ "&&", "==", "Rcon", "RotWord", "SubWord" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
ExpandKeyForever : [Nk][4][8] -> [inf]RoundKey
ExpandKeyForever seed = [ transpose g | g <- groupBy`{4} (keyWS seed) ]
function
ExpandKeyForever
examples
examples/AES.cry
[]
[ "keyWS", "transpose" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
keyWS : [Nk][4][8] -> [inf][4][8]
keyWS seed = xs where xs = seed # [ NextWord(i, prev, old) | i <- [ `Nk ... ] | prev <- drop`{Nk-1} xs | old <- xs ]
function
keyWS
examples
examples/AES.cry
[]
[ "NextWord", "xs" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
ExpandKey : [AESKeySize] -> KeySchedule
ExpandKey key = (keys @ 0, keys @@ [1 .. (Nr - 1)], keys @ `Nr) where seed : [Nk][4][8] seed = split (split key) keys = ExpandKeyForever seed
function
ExpandKey
examples
examples/AES.cry
[]
[ "ExpandKeyForever", "KeySchedule", "Nr", "split" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
fromKS : KeySchedule -> [Nr+1][4][32]
fromKS (f, ms, l) = [ formKeyWords (transpose k) | k <- [f] # ms # [l] ] where formKeyWords bbs = [ join bs | bs <- bbs ] // AES rounds and inverses
function
fromKS
examples
examples/AES.cry
[]
[ "KeySchedule", "join", "transpose" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESRound : (RoundKey, State) -> State
AESRound (rk, s) = AddRoundKey (rk, MixColumns (ShiftRows (SubBytes s)))
function
AESRound
examples
examples/AES.cry
[]
[ "AddRoundKey", "MixColumns", "ShiftRows", "State", "SubBytes" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESFinalRound : (RoundKey, State) -> State
AESFinalRound (rk, s) = AddRoundKey (rk, ShiftRows (SubBytes s))
function
AESFinalRound
examples
examples/AES.cry
[]
[ "AddRoundKey", "ShiftRows", "State", "SubBytes" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESInvRound : (RoundKey, State) -> State
AESInvRound (rk, s) = InvMixColumns (AddRoundKey (rk, InvSubBytes (InvShiftRows s)))
function
AESInvRound
examples
examples/AES.cry
[]
[ "AddRoundKey", "InvMixColumns", "InvShiftRows", "InvSubBytes", "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
AESFinalInvRound : (RoundKey, State) -> State
AESFinalInvRound (rk, s) = AddRoundKey (rk, InvSubBytes (InvShiftRows s)) // Converting a 128 bit message to a State and back
function
AESFinalInvRound
examples
examples/AES.cry
[]
[ "AddRoundKey", "InvShiftRows", "InvSubBytes", "State" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
msgToState : [128] -> State
msgToState msg = transpose (split (split msg))
function
msgToState
examples
examples/AES.cry
[]
[ "State", "split", "transpose" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
stateToMsg : State -> [128]
stateToMsg st = join (join (transpose st)) // AES Encryption
function
stateToMsg
examples
examples/AES.cry
[]
[ "State", "join", "transpose" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aesEncrypt : ([128], [AESKeySize]) -> [128]
aesEncrypt (pt, key) = stateToMsg (AESFinalRound (kFinal, rounds ! 0)) where (kInit, ks, kFinal) = ExpandKey key state0 = AddRoundKey(kInit, msgToState pt) rounds = [state0] # [ AESRound (rk, s) | rk <- ks | s <- rounds ...
function
aesEncrypt
examples
examples/AES.cry
[]
[ "AESFinalRound", "AESRound", "AddRoundKey", "ExpandKey", "ks", "msgToState", "stateToMsg" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
aesDecrypt : ([128], [AESKeySize]) -> [128]
aesDecrypt (ct, key) = stateToMsg (AESFinalInvRound (kFinal, rounds ! 0)) where (kFinal, ks, kInit) = ExpandKey key state0 = AddRoundKey(kInit, msgToState ct) rounds = [state0] # [ AESInvRound (rk, s) | rk <- reverse ks | s <- rounds ...
function
aesDecrypt
examples
examples/AES.cry
[]
[ "AESFinalInvRound", "AESInvRound", "AddRoundKey", "ExpandKey", "ks", "msgToState", "reverse", "stateToMsg" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
sbox : [256]GF28
sbox = [ 0x63, 0x7c, 0x77, 0x7b, 0xf2, 0x6b, 0x6f, 0xc5, 0x30, 0x01, 0x67, 0x2b, 0xfe, 0xd7, 0xab, 0x76, 0xca, 0x82, 0xc9, 0x7d, 0xfa, 0x59, 0x47, 0xf0, 0xad, 0xd4, 0xa2, 0xaf, 0x9c, 0xa4, 0x72, 0xc0, 0xb7, 0xfd, 0x93, 0x26, 0x36, 0x3f, 0xf7, 0xcc, 0x34, 0xa5, 0xe5, 0xf1, 0x71, 0xd8, 0x31, 0x15, 0x04, 0xc7, 0x23, ...
function
sbox
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
irreducible
= <| x^^8 + x^^4 + x^^3 + x + 1 |>
function
irreducible
examples
examples/AES.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
x : [_][8]
x = [1,2,3,4,5,19,12,38,5,3]
function
x
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
y : [_][8]
y = [19,3,27,5,12]
function
y
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
z
= x # y
function
z
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
m
= z @ (0 : [1]) //1
function
m
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
w
= z @ 2 //3
function
w
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t
= z @ 10 //19 (0x13)
function
t
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
v
= z @ 11 //3
function
v
examples
examples/append.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t : [8]
t = if True then 5 else 4 //5
function
t
examples
examples/builtins.cry
[]
[ "True" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
f : [8]
f = if False then 3 else 5 //5
function
f
examples
examples/builtins.cry
[]
[ "False" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
times : [8]
times = 5 * 1 * 2 * 3 //30
function
times
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
div : [8]
div = (((30/1)/2)/3) //5
function
div
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
mod : [8]
mod = 205%10 //5
function
mod
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
exp : [8]
exp = 2^^7 //128
function
exp
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
lgtest : [8]
lgtest = lg2 128 //7
function
lgtest
examples
examples/builtins.cry
[]
[ "lg2" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p : [8]
p = 3+2 //5
function
p
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
m : [8]
m = 8-3 //5
function
m
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
neg : [8]
neg = -(-5) //5
function
neg
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
comp : [8]
comp = ~250 //5
function
comp
examples
examples/builtins.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p1
= x == (2 : [2]) //same thing written 2 different ways
property
p1
examples
examples/builtin_lifting.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p2
= x + y == 3
property
p2
examples
examples/builtin_lifting.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p3
= x + y == [True,True]
property
p3
examples
examples/builtin_lifting.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p4
= xx + yy == [3] //negation is a unary operator that also lifts over sequences
property
p4
examples
examples/builtin_lifting.cry
[]
[ "==", "xx", "yy" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p5
= ~ xx == yy
property
p5
examples
examples/builtin_lifting.cry
[]
[ "==", "xx", "yy" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p6
= (xinf + yinf) @ (0 : [0]) == (1 : [2]) //negation lifts pointwise over an infinite list
property
p6
examples
examples/builtin_lifting.cry
[]
[ "==", "xinf", "yinf" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p7
= (~ xinf) @ (0 : [0]) == (1 : [2])
property
p7
examples
examples/builtin_lifting.cry
[]
[ "==", "xinf" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p8
= xrec + xrec + xrec == xrec //lift over tuples and records at the same time
property
p8
examples
examples/builtin_lifting.cry
[]
[ "==", "xrec" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p9
= (2,2,xrec) + (2,2,xrec) + (2,2,xrec) == (2:[2],2:[2],xrec) //lift unary over tuples and lists
property
p9
examples
examples/builtin_lifting.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
p10
= (~ { x = (1,2), y = [3,4,5] }) == {x = (0:[1],1:[2]), y = [4, 3, 2] : [3][3] }
property
p10
examples
examples/builtin_lifting.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
x
= [True,False]
function
x
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
y
= [False,True] //make sure bitvectors are numbers
function
y
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
xx
= [[True,False]]
function
xx
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
yy
= [[False,True]] //addition lifts pointwise over sequences
function
yy
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
xinf
= [2 ... ]
function
xinf
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
yinf
= [3 ... ] //addition lifts pointwise over infinite lists
function
yinf
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
xrec
= { x = 2 : [2], y = 2 : [2] } : {x : [2], y : [2]}
function
xrec
examples
examples/builtin_lifting.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
Cipher KeySize BlockSize
= { encrypt : [KeySize] -> [BlockSize] -> [BlockSize] , decrypt : [KeySize] -> [BlockSize] -> [BlockSize] }
type
Cipher
examples
examples/Cipher.cry
[]
[ "decrypt", "encrypt" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t1
= x @ 0 == (1,3,5,7)
property
t1
examples
examples/comp.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t2
= x @ 2 == (2,3,5,9)
property
t2
examples
examples/comp.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t3
= x @ 3 == (2,4,6,7)
property
t3
examples
examples/comp.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
t4
= y @ 3 == (2,2,0)
property
t4
examples
examples/comp.cry
[]
[ "==" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
x : [_]([2],[3],[3],[4])
x = [(a,b,c,d) | a <- [1,2], b <- [3,4] | c <- [5,6], d <- [7,8,9] ]
function
x
examples
examples/comp.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
y
= [(a,b,c) | a <- [1,2,3], b <- [1,2] | c <- [1 ... ] ]
function
y
examples
examples/comp.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
x : {a}(fin a) => [a] -> [(a*2)+3]
x v = 0 + 1
function
x
examples
examples/demote.cry
[]
[ "fin" ]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb
y
= x (2 : [3])
function
y
examples
examples/demote.cry
[]
[]
https://github.com/GaloisInc/cryptol
a50cac6eb2c30a79503814f423f375f9476aaceb