fact stringlengths 5 19.5k | statement stringlengths 5 19.5k | proof stringlengths 0 4.29k | type stringclasses 7
values | symbolic_name stringlengths 0 36 | library stringclasses 13
values | filename stringclasses 71
values | imports listlengths 0 23 | deps listlengths 0 14 | docstring stringclasses 0
values | line_start int64 1 1.24k | line_end int64 1 1.24k | has_proof bool 2
classes | source_url stringclasses 1
value | commit stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
carry : {n} (fin n) => [n] -> [n] -> Bit
carry x y = (x + y) < x
/**
* Signed carry. Returns true if the 2's complement signed addition of the
* given bitvector arguments would result in a signed overflow.
*/ | carry : {n} (fin n) => [n] -> [n] -> Bit | carry x y = (x + y) < x
/**
* Signed carry. Returns true if the 2's complement signed addition of the
* given bitvector arguments would result in a signed overflow.
*/ | function | carry | lib | lib/Cryptol.cry | [] | [
"Bit",
"fin"
] | null | 717 | 717 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
scarry : {n} (fin n, n >= 1) => [n] -> [n] -> Bit
scarry x y = (sx == sy) && (sx != sz)
where
z = x + y
sx = head x
sy = head y
sz = head z
/**
* Signed borrow. Returns true if the 2's complement signed subtraction of the
* given bitvector arguments would result in a signed overflow.
*/ | scarry : {n} (fin n, n >= 1) => [n] -> [n] -> Bit | scarry x y = (sx == sy) && (sx != sz)
where
z = x + y
sx = head x
sy = head y
sz = head z
/**
* Signed borrow. Returns true if the 2's complement signed subtraction of the
* given bitvector arguments would result in a signed overflow.
*/ | function | scarry | lib | lib/Cryptol.cry | [] | [
"!=",
"&&",
"==",
">=",
"Bit",
"fin",
"head"
] | null | 724 | 724 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sborrow : {n} (fin n, n >= 1) => [n] -> [n] -> Bit
sborrow x y = ( x <$ (x-y) ) ^ head y
/**
* Zero extension of a bitvector.
*/ | sborrow : {n} (fin n, n >= 1) => [n] -> [n] -> Bit | sborrow x y = ( x <$ (x-y) ) ^ head y
/**
* Zero extension of a bitvector.
*/ | function | sborrow | lib | lib/Cryptol.cry | [] | [
"<$",
">=",
"Bit",
"fin",
"head"
] | null | 736 | 736 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
zext : {m, n} (fin m, m >= n) => [n] -> [m]
zext x = zero # x
/**
* Sign extension of a bitvector.
*/ | zext : {m, n} (fin m, m >= n) => [n] -> [m] | zext x = zero # x
/**
* Sign extension of a bitvector.
*/ | function | zext | lib | lib/Cryptol.cry | [] | [
">=",
"fin",
"zero"
] | null | 742 | 742 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sext : {m, n} (fin m, m >= n, n >= 1) => [n] -> [m]
sext x = newbits # x
where newbits = if head x then ~zero else zero
/**
* 2's complement signed (arithmetic) right shift. The first argument
* is the sequence to shift (considered as a signed value),
* the second argument is the number of positions to shift
* ... | sext : {m, n} (fin m, m >= n, n >= 1) => [n] -> [m] | sext x = newbits # x
where newbits = if head x then ~zero else zero
/**
* 2's complement signed (arithmetic) right shift. The first argument
* is the sequence to shift (considered as a signed value),
* the second argument is the number of positions to shift
* by (considered as an unsigned value).
*/ | function | sext | lib | lib/Cryptol.cry | [] | [
">=",
"fin",
"head",
"zero"
] | null | 748 | 748 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
splitAt : {front, back, a} (fin front) => [front + back]a
-> ([front]a, [back]a)
splitAt xs = (take`{front,back} xs, drop`{front,back} xs)
/**
* Concatenates a list of sequences.
* 'join' is the inverse function to 'split'.
*/ | splitAt : {front, back, a} (fin front) => [front + back]a
-> ([front]a, [back]a) | splitAt xs = (take`{front,back} xs, drop`{front,back} xs)
/**
* Concatenates a list of sequences.
* 'join' is the inverse function to 'split'.
*/ | function | splitAt | lib | lib/Cryptol.cry | [] | [
"fin",
"xs"
] | null | 804 | 805 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
tail : {n, a} [1 + n]a -> [n]a
tail xs = drop`{1} xs
/**
* Return the first (left-most) element of a sequence.
*/ | tail : {n, a} [1 + n]a -> [n]a | tail xs = drop`{1} xs
/**
* Return the first (left-most) element of a sequence.
*/ | function | tail | lib | lib/Cryptol.cry | [] | [
"xs"
] | null | 846 | 846 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
head : {n, a} [1 + n]a -> a
head xs = xs @ (0 : Integer)
/**
* Return the right-most element of a sequence.
*/ | head : {n, a} [1 + n]a -> a | head xs = xs @ (0 : Integer)
/**
* Return the right-most element of a sequence.
*/ | function | head | lib | lib/Cryptol.cry | [] | [
"Integer",
"xs"
] | null | 852 | 852 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
last : {n, a} (fin n) => [1 + n]a -> a
last xs = xs ! (0 : Integer)
/**
* Same as 'split', but with a different type argument order.
* Take a sequence of elements and break it into 'parts' sequences
* of 'each' elements.
*/ | last : {n, a} (fin n) => [1 + n]a -> a | last xs = xs ! (0 : Integer)
/**
* Same as 'split', but with a different type argument order.
* Take a sequence of elements and break it into 'parts' sequences
* of 'each' elements.
*/ | function | last | lib | lib/Cryptol.cry | [] | [
"Integer",
"fin",
"xs"
] | null | 858 | 858 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
groupBy : {each, parts, a} (fin each) => [parts * each]a -> [parts][each]a
groupBy = split`{parts=parts}
/**
* Left shift. The first argument is the sequence to shift, the second is the
* number of positions to shift by.
*/ | groupBy : {each, parts, a} (fin each) => [parts * each]a -> [parts][each]a | groupBy = split`{parts=parts}
/**
* Left shift. The first argument is the sequence to shift, the second is the
* number of positions to shift by.
*/ | function | groupBy | lib | lib/Cryptol.cry | [] | [
"fin"
] | null | 866 | 866 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
(@@) : {n, k, ix, a} (Integral ix) => [n]a -> [k]ix -> [k]a | (@@) : {n, k, ix, a} (Integral ix) => [n]a -> [k]ix -> [k]a | function | : | lib | lib/Cryptol.cry | [] | [
"Integral"
] | null | 903 | 903 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
(!!) : {n, k, ix, a} (fin n, Integral ix) => [n]a -> [k]ix -> [k]a | (!!) : {n, k, ix, a} (fin n, Integral ix) => [n]a -> [k]ix -> [k]a | function | !! | lib | lib/Cryptol.cry | [] | [
"Integral",
"fin"
] | null | 918 | 918 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
updates : {n, k, ix, a} (Integral ix, fin k) => [n]a -> [k]ix -> [k]a -> [n]a
updates xs0 idxs vals = foldl upd xs0 (zip idxs vals)
where
upd xs (i,b) = update xs i b
/**
* Perform a series of updates to a sequence. The first argument is
* the initial sequence to update. The second argument is a sequence
* ... | updates : {n, k, ix, a} (Integral ix, fin k) => [n]a -> [k]ix -> [k]a -> [n]a | updates xs0 idxs vals = foldl upd xs0 (zip idxs vals)
where
upd xs (i,b) = update xs i b
/**
* Perform a series of updates to a sequence. The first argument is
* the initial sequence to update. The second argument is a sequence
* of indices, and the third argument is a sequence of values.
* This function a... | function | updates | lib | lib/Cryptol.cry | [] | [
"Integral",
"fin",
"foldl",
"update",
"xs",
"zip"
] | null | 946 | 946 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
updatesEnd : {n, k, ix, a} (fin n, Integral ix, fin k) => [n]a -> [k]ix -> [k]a -> [n]a
updatesEnd xs0 idxs vals = foldl upd xs0 (zip idxs vals)
where
upd xs (i,b) = updateEnd xs i b
/**
* Produce a sequence using a generating function.
* Satisfies 'generate f @ i == f i' for all 'i' between '0' and 'n-1'.
*
... | updatesEnd : {n, k, ix, a} (fin n, Integral ix, fin k) => [n]a -> [k]ix -> [k]a -> [n]a | updatesEnd xs0 idxs vals = foldl upd xs0 (zip idxs vals)
where
upd xs (i,b) = updateEnd xs i b
/**
* Produce a sequence using a generating function.
* Satisfies 'generate f @ i == f i' for all 'i' between '0' and 'n-1'.
*
* Declarations of the form 'x @ i = e' are syntactic sugar for
* 'x = generate (\i -> ... | function | updatesEnd | lib | lib/Cryptol.cry | [] | [
"Integral",
"fin",
"foldl",
"updateEnd",
"xs",
"zip"
] | null | 958 | 958 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
generate : {n, a, ix} (Integral ix, LiteralLessThan n ix) => (ix -> a) -> [n]a
generate f = [ f i | i <- [0 .. <n] ]
/**
* Sort a sequence of elements. Equivalent to 'sortBy (<=)'.
*/ | generate : {n, a, ix} (Integral ix, LiteralLessThan n ix) => (ix -> a) -> [n]a | generate f = [ f i | i <- [0 .. <n] ]
/**
* Sort a sequence of elements. Equivalent to 'sortBy (<=)'.
*/ | function | generate | lib | lib/Cryptol.cry | [] | [
"Integral",
"LiteralLessThan"
] | null | 970 | 970 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sort : {a, n} (Cmp a, fin n) => [n]a -> [n]a
sort = sortBy (<=)
/**
* Sort a sequence according to the given less-than-or-equal relation.
* The sorting is stable, so it preserves the relative position of any
* pair of elements that are equivalent according to the order relation.
*/ | sort : {a, n} (Cmp a, fin n) => [n]a -> [n]a | sort = sortBy (<=)
/**
* Sort a sequence according to the given less-than-or-equal relation.
* The sorting is stable, so it preserves the relative position of any
* pair of elements that are equivalent according to the order relation.
*/ | function | sort | lib | lib/Cryptol.cry | [] | [
"<=",
"Cmp",
"fin",
"sortBy"
] | null | 977 | 977 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sortBy : {a, n} (fin n) => (a -> a -> Bit) -> [n]a -> [n]a
sortBy le ((xs : [n/2]a) # (ys : [n/^2]a)) = take zs.0
where
xs' = if `(n/2) == (1 : Integer) then xs else sortBy le xs
ys' = if `(n/^2) == (1 : Integer) then ys else sortBy le ys
zs = [ if i == `(n/2) then (ys'@j, i , j+1)
... | sortBy : {a, n} (fin n) => (a -> a -> Bit) -> [n]a -> [n]a | sortBy le ((xs : [n/2]a) # (ys : [n/^2]a)) = take zs.0
where
xs' = if `(n/2) == (1 : Integer) then xs else sortBy le xs
ys' = if `(n/^2) == (1 : Integer) then ys else sortBy le ys
zs = [ if i == `(n/2) then (ys'@j, i , j+1)
| j == `(n/^2) then (xs'@i, i+1, j )
| ... | function | sortBy | lib | lib/Cryptol.cry | [] | [
"==",
"Bit",
"Integer",
"fin",
"take",
"xs"
] | null | 985 | 985 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
rnf : {a} Eq a => a -> a
rnf x = deepseq x x
/**
* Raise a run-time error with the given message.
* This function can be called at any type.
*/ | rnf : {a} Eq a => a -> a | rnf x = deepseq x x
/**
* Raise a run-time error with the given message.
* This function can be called at any type.
*/ | function | rnf | lib | lib/Cryptol.cry | [] | [
"Eq",
"deepseq"
] | null | 1,048 | 1,048 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
undefined : {a} a
undefined = error "undefined"
/**
* Assert that the given condition holds, and raise an error
* with the given message if it does not. If the condition
* holds, return the third argument unchanged.
*/ | undefined : {a} a | undefined = error "undefined"
/**
* Assert that the given condition holds, and raise an error
* with the given message if it does not. If the condition
* holds, return the third argument unchanged.
*/ | function | undefined | lib | lib/Cryptol.cry | [] | [
"error"
] | null | 1,061 | 1,061 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
assert : {a, n} (fin n) => Bit -> String n -> a -> a
assert pred msg x = if pred then x else error msg
/**
* Generates random values from a seed. When called with a function, currently
* generates a function that always returns zero.
*/ | assert : {a, n} (fin n) => Bit -> String n -> a -> a | assert pred msg x = if pred then x else error msg
/**
* Generates random values from a seed. When called with a function, currently
* generates a function that always returns zero.
*/ | function | assert | lib | lib/Cryptol.cry | [] | [
"Bit",
"String",
"error",
"fin"
] | null | 1,069 | 1,069 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
traceVal : {n, a} (fin n) => String n -> a -> a
traceVal msg x = trace msg x x
/* Functions previously in Cryptol::Extras */
/**
* Conjunction of all bits in a sequence.
*/ | traceVal : {n, a} (fin n) => String n -> a -> a | traceVal msg x = trace msg x x
/* Functions previously in Cryptol::Extras */
/**
* Conjunction of all bits in a sequence.
*/ | function | traceVal | lib | lib/Cryptol.cry | [] | [
"String",
"fin",
"trace"
] | null | 1,102 | 1,102 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
and : {n} (fin n) => [n]Bit -> Bit
and xs = ~zero == xs
/**
* Disjunction of all bits in a sequence.
*/ | and : {n} (fin n) => [n]Bit -> Bit | and xs = ~zero == xs
/**
* Disjunction of all bits in a sequence.
*/ | function | and | lib | lib/Cryptol.cry | [] | [
"==",
"Bit",
"fin",
"xs"
] | null | 1,111 | 1,111 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
or : {n} (fin n) => [n]Bit -> Bit
or xs = zero != xs
/**
* Conjunction after applying a predicate to all elements.
*/ | or : {n} (fin n) => [n]Bit -> Bit | or xs = zero != xs
/**
* Conjunction after applying a predicate to all elements.
*/ | function | or | lib | lib/Cryptol.cry | [] | [
"!=",
"Bit",
"fin",
"xs",
"zero"
] | null | 1,117 | 1,117 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
all : {n, a} (fin n) => (a -> Bit) -> [n]a -> Bit
all f xs = foldl' (/\) True (map f xs)
/**
* Disjunction after applying a predicate to all elements.
*/ | all : {n, a} (fin n) => (a -> Bit) -> [n]a -> Bit | all f xs = foldl' (/\) True (map f xs)
/**
* Disjunction after applying a predicate to all elements.
*/ | function | all | lib | lib/Cryptol.cry | [] | [
"/\\",
"Bit",
"True",
"fin",
"foldl'",
"map",
"xs"
] | null | 1,123 | 1,123 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
any : {n, a} (fin n) => (a -> Bit) -> [n]a -> Bit
any f xs = foldl' (\/) False (map f xs)
/**
* Map a function over a sequence.
*/ | any : {n, a} (fin n) => (a -> Bit) -> [n]a -> Bit | any f xs = foldl' (\/) False (map f xs)
/**
* Map a function over a sequence.
*/ | function | any | lib | lib/Cryptol.cry | [] | [
"Bit",
"False",
"\\/",
"fin",
"foldl'",
"map",
"xs"
] | null | 1,129 | 1,129 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
map : {n, a, b} (a -> b) -> [n]a -> [n]b
map f xs = [f x | x <- xs]
/**
* Functional left fold.
*
* foldl (+) 0 [1,2,3] = ((0 + 1) + 2) + 3
*/ | map : {n, a, b} (a -> b) -> [n]a -> [n]b | map f xs = [f x | x <- xs]
/**
* Functional left fold.
*
* foldl (+) 0 [1,2,3] = ((0 + 1) + 2) + 3
*/ | function | map | lib | lib/Cryptol.cry | [] | [
"xs"
] | null | 1,135 | 1,135 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
foldr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> b
foldr f acc xs = foldl g acc (reverse xs)
where g b a = f a b
/**
* Functional right fold, with strict evaluation of the accumulator value.
* The accumulator is reduced to weak head normal form at each step.
*
* foldr' (-) 0 [1,2,3] = 0 - (1 - (2 - 3))... | foldr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> b | foldr f acc xs = foldl g acc (reverse xs)
where g b a = f a b
/**
* Functional right fold, with strict evaluation of the accumulator value.
* The accumulator is reduced to weak head normal form at each step.
*
* foldr' (-) 0 [1,2,3] = 0 - (1 - (2 - 3))
*/ | function | foldr | lib | lib/Cryptol.cry | [] | [
"fin",
"foldl",
"reverse",
"xs"
] | null | 1,159 | 1,159 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
foldr' : {n, a, b} (fin n, Eq b) => (a -> b -> b) -> b -> [n]a -> b
foldr' f acc xs = foldl' g acc (reverse xs)
where g b a = f a b
/**
* Compute the sum of the values in the sequence.
*/ | foldr' : {n, a, b} (fin n, Eq b) => (a -> b -> b) -> b -> [n]a -> b | foldr' f acc xs = foldl' g acc (reverse xs)
where g b a = f a b
/**
* Compute the sum of the values in the sequence.
*/ | function | foldr' | lib | lib/Cryptol.cry | [] | [
"Eq",
"fin",
"foldl'",
"reverse",
"xs"
] | null | 1,169 | 1,169 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
sum : {n, a} (fin n, Eq a, Ring a) => [n]a -> a
sum xs = foldl' (+) (fromInteger 0) xs
/**
* Compute the product of the values in the sequence.
*/ | sum : {n, a} (fin n, Eq a, Ring a) => [n]a -> a | sum xs = foldl' (+) (fromInteger 0) xs
/**
* Compute the product of the values in the sequence.
*/ | function | sum | lib | lib/Cryptol.cry | [] | [
"Eq",
"Ring",
"fin",
"foldl'",
"fromInteger",
"xs"
] | null | 1,176 | 1,176 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
product : {n, a} (fin n, Eq a, Ring a) => [n]a -> a
product xs = foldl' (*) (fromInteger 1) xs
/**
* Scan left is like a foldl that also emits the intermediate values.
*/ | product : {n, a} (fin n, Eq a, Ring a) => [n]a -> a | product xs = foldl' (*) (fromInteger 1) xs
/**
* Scan left is like a foldl that also emits the intermediate values.
*/ | function | product | lib | lib/Cryptol.cry | [] | [
"Eq",
"Ring",
"fin",
"foldl'",
"fromInteger",
"xs"
] | null | 1,182 | 1,182 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
scanr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> [1+n]b
scanr f acc xs = reverse (scanl (\a b -> f b a) acc (reverse xs))
/**
* Repeat a value.
*/ | scanr : {n, a, b} (fin n) => (a -> b -> b) -> b -> [n]a -> [1+n]b | scanr f acc xs = reverse (scanl (\a b -> f b a) acc (reverse xs))
/**
* Repeat a value.
*/ | function | scanr | lib | lib/Cryptol.cry | [] | [
"fin",
"reverse",
"scanl",
"xs"
] | null | 1,193 | 1,193 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
repeat : {n, a} a -> [n]a
repeat x = [ x | _ <- zero : [n] ]
/**
* 'elem x xs' returns true if x is equal to a value in xs.
*/ | repeat : {n, a} a -> [n]a | repeat x = [ x | _ <- zero : [n] ]
/**
* 'elem x xs' returns true if x is equal to a value in xs.
*/ | function | repeat | lib | lib/Cryptol.cry | [] | [
"zero"
] | null | 1,199 | 1,199 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
elem : {n, a} (fin n, Eq a) => a -> [n]a -> Bit
elem a xs = any (\x -> x == a) xs
/**
* Create a list of tuples from two lists.
*/ | elem : {n, a} (fin n, Eq a) => a -> [n]a -> Bit | elem a xs = any (\x -> x == a) xs
/**
* Create a list of tuples from two lists.
*/ | function | elem | lib | lib/Cryptol.cry | [] | [
"==",
"Bit",
"Eq",
"any",
"fin",
"xs"
] | null | 1,205 | 1,205 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
zip : {n, a, b} [n]a -> [n]b -> [n](a, b)
zip xs ys = [(x,y) | x <- xs | y <- ys]
/**
* Create a list by applying the function to each pair of elements in the input.
*/ | zip : {n, a, b} [n]a -> [n]b -> [n](a, b) | zip xs ys = [(x,y) | x <- xs | y <- ys]
/**
* Create a list by applying the function to each pair of elements in the input.
*/ | function | zip | lib | lib/Cryptol.cry | [] | [
"xs"
] | null | 1,211 | 1,211 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
zipWith : {n, a, b, c} (a -> b -> c) -> [n]a -> [n]b -> [n]c
zipWith f xs ys = [f x y | x <- xs | y <- ys]
/**
* Transform a function into uncurried form.
*/ | zipWith : {n, a, b, c} (a -> b -> c) -> [n]a -> [n]b -> [n]c | zipWith f xs ys = [f x y | x <- xs | y <- ys]
/**
* Transform a function into uncurried form.
*/ | function | zipWith | lib | lib/Cryptol.cry | [] | [
"xs"
] | null | 1,217 | 1,217 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
uncurry : {a, b, c} (a -> b -> c) -> (a, b) -> c
uncurry f = \(a, b) -> f a b
/**
* Transform a function into curried form.
*/ | uncurry : {a, b, c} (a -> b -> c) -> (a, b) -> c | uncurry f = \(a, b) -> f a b
/**
* Transform a function into curried form.
*/ | function | uncurry | lib | lib/Cryptol.cry | [] | [] | null | 1,223 | 1,223 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
curry : {a, b, c} ((a, b) -> c) -> a -> b -> c
curry f = \a b -> f (a, b)
/**
* Map a function iteratively over a seed value, producing an infinite
* list of successive function applications.
*/ | curry : {a, b, c} ((a, b) -> c) -> a -> b -> c | curry f = \a b -> f (a, b)
/**
* Map a function iteratively over a seed value, producing an infinite
* list of successive function applications.
*/ | function | curry | lib | lib/Cryptol.cry | [] | [] | null | 1,229 | 1,229 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
iterate : {a} (a -> a) -> a -> [inf]a
iterate f z = scanl (\x _ -> f x) z (zero:[inf]()) | iterate : {a} (a -> a) -> a -> [inf]a | iterate f z = scanl (\x _ -> f x) z (zero:[inf]()) | function | iterate | lib | lib/Cryptol.cry | [] | [
"scanl"
] | null | 1,236 | 1,236 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
f === g = \ x -> f x == g x
/**
* Compare the outputs of two functions for inequality.
*/
f !== g = \x -> f x != g x
// The Cmp class ---------------------------------------------------
/** Value types that support equality and ordering comparisons. */ | f === g = \ x -> f x == g x
/**
* Compare the outputs of two functions for inequality.
*/ | f !== g = \x -> f x != g x
// The Cmp class ---------------------------------------------------
/** Value types that support equality and ordering comparisons. */ | function | f | lib | lib/Cryptol.cry | [] | [
"!=",
"!==",
"==",
"==="
] | null | 543 | 547 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
x >$ y = y <$ x
/**
* 2's complement signed less-than-or-equal.
*/
x <=$ y = ~(y <$ x)
/**
* 2's complement signed greater-than-or-equal.
*/
x >=$ y = ~(x <$ y)
// The Option and Result types ------------------------------------
/**
* The 'Option a' type represents an optional value. Every 'Option a' value is
... | x >$ y = y <$ x
/**
* 2's complement signed less-than-or-equal.
*/ | x <=$ y = ~(y <$ x)
/**
* 2's complement signed greater-than-or-equal.
*/
x >=$ y = ~(x <$ y)
// The Option and Result types ------------------------------------
/**
* The 'Option a' type represents an optional value. Every 'Option a' value is
* either 'Some' and contains a value of type 'a', or 'None' and does ... | function | x | lib | lib/Cryptol.cry | [] | [
"/\\",
"<$",
"<=$",
">$",
">=$",
"False",
"True",
"\\/"
] | null | 622 | 626 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
enum Option a = None | Some a deriving (Eq, Cmp, SignedCmp)
/**
* Values of the 'Result t e' type can either be 'Ok', representing success and
* containing a value of type 't', or 'Err', representing error and containing
* an error value of type 'e'. Functions can return 'Result' whenever errors are
* expected and... | enum Option a = None | Some a deriving (Eq, Cmp, SignedCmp)
/**
* Values of the 'Result t e' type can either be 'Ok', representing success and
* containing a value of type 't', or 'Err', representing error and containing
* an error value of type 'e'. Functions can return 'Result' whenever errors are
* expected and... | enum Result t e = Ok t | Err e deriving (Eq, Cmp, SignedCmp)
// Bit specific operations ----------------------------------------
/**
* The constant True. Corresponds to the bit value 1.
*/ | function | enum | lib | lib/Cryptol.cry | [] | [
"SignedCmp"
] | null | 645 | 653 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
a ==> b = if a then b else True
// Bitvector specific operations ----------------------------------
/**
* 2's complement signed division. Division rounds toward 0.
* Division by 0 is undefined.
*
* * Satisfies 'x == x %$ y + (x /$ y) * y' for 'y != 0'.
*/ | a ==> b = if a then b else True
// Bitvector specific operations ----------------------------------
/**
* 2's complement signed division. Division rounds toward 0.
* Division by 0 is undefined.
*
* * Satisfies 'x == x %$ y + (x /$ y) * y' for 'y != 0'.
*/ | function | a | lib | lib/Cryptol.cry | [] | [
"==>",
"True"
] | null | 690 | 700 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
xs @@ is = [ xs @ i | i <- is ]
/**
* Reverse index operator. The first argument is a finite sequence. The second
* argument is the zero-based index of the element to select, starting from the
* end of the sequence.
*/
xs !! is = [ xs ! i | i <- is ]
/**
* Update the given sequence with new value at the given ... | xs @@ is = [ xs @ i | i <- is ]
/**
* Reverse index operator. The first argument is a finite sequence. The second
* argument is the zero-based index of the element to select, starting from the
* end of the sequence.
*/ | xs !! is = [ xs ! i | i <- is ]
/**
* Update the given sequence with new value at the given index position.
* The first argument is a sequence. The second argument is the zero-based
* index of the element to update, starting from the front of the sequence.
* The third argument is the new element. The return value... | function | xs | lib | lib/Cryptol.cry | [] | [
"!!"
] | null | 904 | 910 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ValidFloat : # -> # -> Prop
/** IEEE-754 floating point numbers. */ | ValidFloat : # -> # -> Prop
/** IEEE-754 floating point numbers. */ | primitive type | ValidFloat | lib | lib/Float.cry | [] | [] | null | 3 | 5 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
exponent : #, precision : #}
ValidFloat exponent precision => Float exponent precision : *
/** An abbreviation for common 16-bit floating point numbers. */ | exponent : #, precision : #}
ValidFloat exponent precision => Float exponent precision : *
/** An abbreviation for common 16-bit floating point numbers. */ | primitive type | exponent | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 6 | 9 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Float16 = Float 5 11
/** An abbreviation for common 32-bit floating point numbers. */ | Float16 = Float 5 11
/** An abbreviation for common 32-bit floating point numbers. */ | type | Float16 | lib | lib/Float.cry | [] | [] | null | 10 | 12 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Float32 = Float 8 24
/** An abbreviation for common 64-bit floating point numbers. */ | Float32 = Float 8 24
/** An abbreviation for common 64-bit floating point numbers. */ | type | Float32 | lib | lib/Float.cry | [] | [] | null | 13 | 15 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Float64 = Float 11 53
/** An abbreviation for common 128-bit floating point numbers. */ | Float64 = Float 11 53
/** An abbreviation for common 128-bit floating point numbers. */ | type | Float64 | lib | lib/Float.cry | [] | [] | null | 16 | 18 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Float128 = Float 15 113
/** An abbreviation for common 256-bit floating point numbers. */ | Float128 = Float 15 113
/** An abbreviation for common 256-bit floating point numbers. */ | type | Float128 | lib | lib/Float.cry | [] | [] | null | 19 | 21 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
Float256 = Float 19 237
/* ----------------------------------------------------------------------
* Rounding modes (this should be an enumeration type, when we add these)
*---------------------------------------------------------------------- */
/**
* A 'RoundingMode' is used to specify the precise behavior of s... | Float256 = Float 19 237
/* ----------------------------------------------------------------------
* Rounding modes (this should be an enumeration type, when we add these)
*---------------------------------------------------------------------- */
/**
* A 'RoundingMode' is used to specify the precise behavior of s... | type | Float256 | lib | lib/Float.cry | [] | [] | null | 22 | 40 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
RoundingMode = [3]
/** Round toward nearest, ties go to even. */ | RoundingMode = [3]
/** Round toward nearest, ties go to even. */ | type | RoundingMode | lib | lib/Float.cry | [] | [] | null | 41 | 43 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpNaN : {e,p} ValidFloat e p => Float e p
/** Positive infinity. */ | fpNaN : {e,p} ValidFloat e p => Float e p
/** Positive infinity. */ | primitive | fpNaN | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 76 | 78 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpPosInf : {e,p} ValidFloat e p => Float e p
/** Negative infinity. */ | fpPosInf : {e,p} ValidFloat e p => Float e p
/** Negative infinity. */ | primitive | fpPosInf | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 80 | 82 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpFromBits : {e,p} ValidFloat e p => [e + p] -> Float e p
/** Export a floating point number in IEEE interchange format with layout:
(sign : [1]) # (biased_exponent : [e]) # (significand : [p-1])
NaN is represented as:
* positive: sign == 0
* quiet with no info: significand == 0b1 # 0
*/ | fpFromBits : {e,p} ValidFloat e p => [e + p] -> Float e p
/** Export a floating point number in IEEE interchange format with layout:
(sign : [1]) # (biased_exponent : [e]) # (significand : [p-1])
NaN is represented as:
* positive: sign == 0
* quiet with no info: significand == 0b1 # 0
*/ | primitive | fpFromBits | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 103 | 112 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpToBits : {e,p} ValidFloat e p => Float e p -> [e + p]
/* ----------------------------------------------------------------------
* Predicates
* ----------------------------------------------------------------------
*/
// Operations in `Cmp` use IEEE reasoning.
/** Check if two floating point numbers are repr... | fpToBits : {e,p} ValidFloat e p => Float e p -> [e + p]
/* ----------------------------------------------------------------------
* Predicates
* ----------------------------------------------------------------------
*/
// Operations in `Cmp` use IEEE reasoning.
/** Check if two floating point numbers are repr... | primitive | fpToBits | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 114 | 131 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
=.=) : {e,p} ValidFloat e p => Float e p -> Float e p -> Bool | =.=) : {e,p} ValidFloat e p => Float e p -> Float e p -> Bool | primitive | =.= | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 133 | 133 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsNaN : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is positive or negative infinity. */ | fpIsNaN : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is positive or negative infinity. */ | primitive | fpIsNaN | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 138 | 140 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsInf : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is positive or negative zero. */ | fpIsInf : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is positive or negative zero. */ | primitive | fpIsInf | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 141 | 143 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsZero : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is negative. */ | fpIsZero : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is negative. */ | primitive | fpIsZero | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 144 | 146 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsNeg : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is normal (not NaN, not infinite, not zero, and not subnormal). */ | fpIsNeg : {e,p} ValidFloat e p => Float e p -> Bool
/** Test if this value is normal (not NaN, not infinite, not zero, and not subnormal). */ | primitive | fpIsNeg | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 147 | 149 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsNormal : {e,p} ValidFloat e p => Float e p -> Bool
/**
* Test if this value is subnormal. Subnormal values are nonzero
* values with magnitudes smaller than can be represented with the
* normal implicit leading bit convention.
*/ | fpIsNormal : {e,p} ValidFloat e p => Float e p -> Bool
/**
* Test if this value is subnormal. Subnormal values are nonzero
* values with magnitudes smaller than can be represented with the
* normal implicit leading bit convention.
*/ | primitive | fpIsNormal | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 150 | 156 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpIsSubnormal : {e,p} ValidFloat e p => Float e p -> Bool
/* Returns true for numbers that are not an infinity or NaN. */ | fpIsSubnormal : {e,p} ValidFloat e p => Float e p -> Bool
/* Returns true for numbers that are not an infinity or NaN. */ | primitive | fpIsSubnormal | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat"
] | null | 157 | 159 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpAdd : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Subtract floating point numbers using the given rounding mode. */ | fpAdd : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Subtract floating point numbers using the given rounding mode. */ | primitive | fpAdd | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 171 | 174 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpSub : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Multiply floating point numbers using the given rounding mode. */ | fpSub : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Multiply floating point numbers using the given rounding mode. */ | primitive | fpSub | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 176 | 179 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpMul : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Divide floating point numbers using the given rounding mode. */ | fpMul : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/** Divide floating point numbers using the given rounding mode. */ | primitive | fpMul | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 181 | 184 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpDiv : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/**
* Fused-multiply-add. 'fpFMA r x y z' computes the value '(x*y)+z',
* rounding the result according to mode 'r' only after performing both
* operations.
*/ | fpDiv : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p
/**
* Fused-multiply-add. 'fpFMA r x y z' computes the value '(x*y)+z',
* rounding the result according to mode 'r' only after performing both
* operations.
*/ | primitive | fpDiv | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 186 | 193 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpFMA : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p -> Float e p
/**
* Absolute value of a floating-point value.
*/ | fpFMA : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p -> Float e p -> Float e p
/**
* Absolute value of a floating-point value.
*/ | primitive | fpFMA | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 195 | 200 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpAbs : {e,p} ValidFloat e p =>
Float e p -> Float e p
/**
* Square root of a floating-point value. The square root of
* a negative value yiels NaN, except that the sqaure root of
* '-0.0' is '-0.0'.
*/ | fpAbs : {e,p} ValidFloat e p =>
Float e p -> Float e p
/**
* Square root of a floating-point value. The square root of
* a negative value yiels NaN, except that the sqaure root of
* '-0.0' is '-0.0'.
*/ | primitive | fpAbs | lib | lib/Float.cry | [] | [
"ValidFloat"
] | null | 202 | 209 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpSqrt : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p
/* ------------------------------------------------------------ *
* Rationals *
* ------------------------------------------------------------ */
/** Convert a floating point number to a ra... | fpSqrt : {e,p} ValidFloat e p =>
RoundingMode -> Float e p -> Float e p
/* ------------------------------------------------------------ *
* Rationals *
* ------------------------------------------------------------ */
/** Convert a floating point number to a ra... | primitive | fpSqrt | lib | lib/Float.cry | [] | [
"RoundingMode",
"ValidFloat"
] | null | 211 | 219 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpToRational : {e,p} ValidFloat e p =>
Float e p -> Rational
/** Convert a rational to a floating point number, using the
given rounding mode, if the number cannot be represented exactly. */ | fpToRational : {e,p} ValidFloat e p =>
Float e p -> Rational
/** Convert a rational to a floating point number, using the
given rounding mode, if the number cannot be represented exactly. */ | primitive | fpToRational | lib | lib/Float.cry | [] | [
"Rational",
"ValidFloat"
] | null | 221 | 225 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpFromRational : {e,p} ValidFloat e p =>
RoundingMode -> Rational -> Float e p | fpFromRational : {e,p} ValidFloat e p =>
RoundingMode -> Rational -> Float e p | primitive | fpFromRational | lib | lib/Float.cry | [] | [
"Rational",
"RoundingMode",
"ValidFloat"
] | null | 227 | 228 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundNearestEven, rne : RoundingMode | roundNearestEven, rne : RoundingMode | function | roundNearestEven, | lib | lib/Float.cry | [] | [
"RoundingMode",
"rne"
] | null | 44 | 44 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundNearestAway, rna : RoundingMode | roundNearestAway, rna : RoundingMode | function | roundNearestAway, | lib | lib/Float.cry | [] | [
"RoundingMode",
"rna"
] | null | 49 | 49 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundPositive, rtp : RoundingMode | roundPositive, rtp : RoundingMode | function | roundPositive, | lib | lib/Float.cry | [] | [
"RoundingMode",
"rtp"
] | null | 54 | 54 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundNegative, rtn : RoundingMode | roundNegative, rtn : RoundingMode | function | roundNegative, | lib | lib/Float.cry | [] | [
"RoundingMode",
"rtn"
] | null | 59 | 59 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundZero, rtz : RoundingMode | roundZero, rtz : RoundingMode | function | roundZero, | lib | lib/Float.cry | [] | [
"RoundingMode",
"rtz"
] | null | 64 | 64 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
fpNegInf : {e,p} ValidFloat e p => Float e p
fpNegInf = - fpPosInf
/** Positive zero. */ | fpNegInf : {e,p} ValidFloat e p => Float e p | fpNegInf = - fpPosInf
/** Positive zero. */ | function | fpNegInf | lib | lib/Float.cry | [] | [
"ValidFloat",
"fpPosInf"
] | null | 83 | 83 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
fpPosZero : {e,p} ValidFloat e p => Float e p
fpPosZero = zero
/** Negative zero. */ | fpPosZero : {e,p} ValidFloat e p => Float e p | fpPosZero = zero
/** Negative zero. */ | function | fpPosZero | lib | lib/Float.cry | [] | [
"ValidFloat",
"zero"
] | null | 87 | 87 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
fpNegZero : {e,p} ValidFloat e p => Float e p
fpNegZero = - fpPosZero
// Binary representations
/** A floating point number using the exact bit pattern,
in IEEE interchange format with layout:
(sign : [1]) # (biased_exponent : [e]) # (significand : [p-1])
*/ | fpNegZero : {e,p} ValidFloat e p => Float e p | fpNegZero = - fpPosZero
// Binary representations
/** A floating point number using the exact bit pattern,
in IEEE interchange format with layout:
(sign : [1]) # (biased_exponent : [e]) # (significand : [p-1])
*/ | function | fpNegZero | lib | lib/Float.cry | [] | [
"ValidFloat",
"fpPosZero"
] | null | 91 | 91 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
fpIsFinite : {e,p} ValidFloat e p => Float e p -> Bool
fpIsFinite f = ~ (fpIsNaN f \/ fpIsInf f )
/* ----------------------------------------------------------------------
* Arithmetic
* ---------------------------------------------------------------------- */
/** Add floating point numbers using the given roundi... | fpIsFinite : {e,p} ValidFloat e p => Float e p -> Bool | fpIsFinite f = ~ (fpIsNaN f \/ fpIsInf f )
/* ----------------------------------------------------------------------
* Arithmetic
* ---------------------------------------------------------------------- */
/** Add floating point numbers using the given rounding mode. */ | function | fpIsFinite | lib | lib/Float.cry | [] | [
"Bool",
"ValidFloat",
"\\/",
"fpIsInf",
"fpIsNaN"
] | null | 160 | 160 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
roundNearestEven = 0 | roundNearestEven = 0 | function | roundNearestEven | lib | lib/Float.cry | [] | [] | null | 45 | 45 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rne = roundNearestEven
/** Round toward nearest, ties away from zero. */ | rne = roundNearestEven
/** Round toward nearest, ties away from zero. */ | function | rne | lib | lib/Float.cry | [] | [
"roundNearestEven"
] | null | 46 | 48 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundNearestAway = 1 | roundNearestAway = 1 | function | roundNearestAway | lib | lib/Float.cry | [] | [] | null | 50 | 50 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rna = roundNearestAway
/** Round toward positive infinity. */ | rna = roundNearestAway
/** Round toward positive infinity. */ | function | rna | lib | lib/Float.cry | [] | [
"roundNearestAway"
] | null | 51 | 53 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundPositive = 2 | roundPositive = 2 | function | roundPositive | lib | lib/Float.cry | [] | [] | null | 55 | 55 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rtp = roundPositive
/** Round toward negative infinity. */ | rtp = roundPositive
/** Round toward negative infinity. */ | function | rtp | lib | lib/Float.cry | [] | [
"roundPositive"
] | null | 56 | 58 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundNegative = 3 | roundNegative = 3 | function | roundNegative | lib | lib/Float.cry | [] | [] | null | 60 | 60 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rtn = roundNegative
/** Round toward zero. */ | rtn = roundNegative
/** Round toward zero. */ | function | rtn | lib | lib/Float.cry | [] | [
"roundNegative"
] | null | 61 | 63 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
roundZero = 4 | roundZero = 4 | function | roundZero | lib | lib/Float.cry | [] | [] | null | 65 | 65 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
rtz = roundZero
/* ----------------------------------------------------------------------
* Constants
* ---------------------------------------------------------------------- */
/** Not a number. */ | rtz = roundZero
/* ----------------------------------------------------------------------
* Constants
* ---------------------------------------------------------------------- */
/** Not a number. */ | function | rtz | lib | lib/Float.cry | [] | [
"roundZero"
] | null | 66 | 74 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
AffinePoint p =
{ x : Z p
, y : Z p
}
/**
* The type of points of an elliptic curve in (homogeneous)
* projective coordinates. The coefficients are taken from the
* prime field 'Z p' with 'p > 3'. These points should be understood as
* representatives of equivalence classes of points, where two representati... | AffinePoint p =
{ x : Z p
, y : Z p
}
/**
* The type of points of an elliptic curve in (homogeneous)
* projective coordinates. The coefficients are taken from the
* prime field 'Z p' with 'p > 3'. These points should be understood as
* representatives of equivalence classes of points, where two representati... | type | AffinePoint | lib | lib/PrimeEC.cry | [] | [] | null | 11 | 32 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ProjectivePoint p =
{ x : Z p
, y : Z p
, z : Z p
}
/**
* 'ec_is_point_affine b S' checks that the supposed affine elliptic curve
* point 'S' in fact lies on the curve defined by the curve parameter 'b'. Here,
* and throughout this module, we assume the curve parameter 'a' is equal to
* '-3'. Precisely, ... | ProjectivePoint p =
{ x : Z p
, y : Z p
, z : Z p
}
/**
* 'ec_is_point_affine b S' checks that the supposed affine elliptic curve
* point 'S' in fact lies on the curve defined by the curve parameter 'b'. Here,
* and throughout this module, we assume the curve parameter 'a' is equal to
* '-3'. Precisely, ... | type | ProjectivePoint | lib | lib/PrimeEC.cry | [] | [] | null | 33 | 46 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ec_double : {p} (prime p, p > 3) =>
ProjectivePoint p -> ProjectivePoint p
/**
* Given two projective points 'S' and 'T' where neither is the identity,
* compute 'S+T'. If the points are not known to be distinct from the point
* at infinity, use 'ec_add' instead.
*/ | ec_double : {p} (prime p, p > 3) =>
ProjectivePoint p -> ProjectivePoint p
/**
* Given two projective points 'S' and 'T' where neither is the identity,
* compute 'S+T'. If the points are not known to be distinct from the point
* at infinity, use 'ec_add' instead.
*/ | primitive | ec_double | lib | lib/PrimeEC.cry | [] | [
"ProjectivePoint",
"prime"
] | null | 114 | 121 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ec_add_nonzero : {p} (prime p, p > 3) =>
ProjectivePoint p -> ProjectivePoint p -> ProjectivePoint p
/**
* Given a projective point 'S', compute its negation, '-S'
*/ | ec_add_nonzero : {p} (prime p, p > 3) =>
ProjectivePoint p -> ProjectivePoint p -> ProjectivePoint p
/**
* Given a projective point 'S', compute its negation, '-S'
*/ | primitive | ec_add_nonzero | lib | lib/PrimeEC.cry | [] | [
"ProjectivePoint",
"prime"
] | null | 122 | 127 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ec_mult : {p} (prime p, p > 3) =>
Z p -> ProjectivePoint p -> ProjectivePoint p
/**
* Given a scalar value 'j' and a projective point 'S', and another scalar
* value 'k' and point 'T', compute the "twin" scalar multiplication 'jS + kT'.
*/ | ec_mult : {p} (prime p, p > 3) =>
Z p -> ProjectivePoint p -> ProjectivePoint p
/**
* Given a scalar value 'j' and a projective point 'S', and another scalar
* value 'k' and point 'T', compute the "twin" scalar multiplication 'jS + kT'.
*/ | primitive | ec_mult | lib | lib/PrimeEC.cry | [] | [
"ProjectivePoint",
"prime"
] | null | 154 | 160 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ec_twin_mult : {p} (prime p, p > 3) =>
Z p -> ProjectivePoint p -> Z p -> ProjectivePoint p -> ProjectivePoint p | ec_twin_mult : {p} (prime p, p > 3) =>
Z p -> ProjectivePoint p -> Z p -> ProjectivePoint p -> ProjectivePoint p | primitive | ec_twin_mult | lib | lib/PrimeEC.cry | [] | [
"ProjectivePoint",
"prime"
] | null | 161 | 162 | false | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb | |
ec_is_point_affine : {p} (prime p, p > 3) => Z p -> AffinePoint p -> Bit
ec_is_point_affine b S = S.y^^2 == S.x^^3 - (3*S.x) + b
/**
* 'ec_is_nonsingular' checks that the given curve parameter 'b' gives rise to
* a non-singular elliptic curve, appropriate for use in ECC.
*
* Precisely, this checks that '4*a^^3 + ... | ec_is_point_affine : {p} (prime p, p > 3) => Z p -> AffinePoint p -> Bit | ec_is_point_affine b S = S.y^^2 == S.x^^3 - (3*S.x) + b
/**
* 'ec_is_nonsingular' checks that the given curve parameter 'b' gives rise to
* a non-singular elliptic curve, appropriate for use in ECC.
*
* Precisely, this checks that '4*a^^3 + 27*b^^2 != 0 mod p'. Here, and
* throughout this module, we assume 'a =... | function | ec_is_point_affine | lib | lib/PrimeEC.cry | [] | [
"==",
"AffinePoint",
"Bit",
"prime"
] | null | 47 | 47 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ec_is_nonsingular : {p} (prime p, p > 3) => Z p -> Bit
ec_is_nonsingular b = (fromInteger 4) * a^^3 + (fromInteger 27) * b^^2 != 0
where a = -3 : Z p
/**
* Returns true if the given point is the identity "point at infinity."
* This is true whenever the 'z' coordinate is 0, but one of the 'x' or
* 'y' coordinates ... | ec_is_nonsingular : {p} (prime p, p > 3) => Z p -> Bit | ec_is_nonsingular b = (fromInteger 4) * a^^3 + (fromInteger 27) * b^^2 != 0
where a = -3 : Z p
/**
* Returns true if the given point is the identity "point at infinity."
* This is true whenever the 'z' coordinate is 0, but one of the 'x' or
* 'y' coordinates is nonzero.
*/ | function | ec_is_nonsingular | lib | lib/PrimeEC.cry | [] | [
"!=",
"Bit",
"fromInteger",
"prime"
] | null | 58 | 58 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ec_is_identity : {p} (prime p, p > 3) => ProjectivePoint p -> Bit
ec_is_identity S = S.z == 0 /\ ~(S.x == 0 /\ S.y == 0)
/**
* Test two projective points for equality, up to the equivalence relation
* on projective points.
*/ | ec_is_identity : {p} (prime p, p > 3) => ProjectivePoint p -> Bit | ec_is_identity S = S.z == 0 /\ ~(S.x == 0 /\ S.y == 0)
/**
* Test two projective points for equality, up to the equivalence relation
* on projective points.
*/ | function | ec_is_identity | lib | lib/PrimeEC.cry | [] | [
"/\\",
"==",
"Bit",
"ProjectivePoint",
"prime"
] | null | 67 | 67 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
ec_equal : {p} (prime p, p > 3) => ProjectivePoint p -> ProjectivePoint p -> Bit
ec_equal S T =
(S.z == 0 /\ T.z == 0) \/
(S.z != 0 /\ T.z != 0 /\ ec_affinify S == ec_affinify T)
/**
* Compute a projective representative for the given affine point.
*/ | ec_equal : {p} (prime p, p > 3) => ProjectivePoint p -> ProjectivePoint p -> Bit | ec_equal S T =
(S.z == 0 /\ T.z == 0) \/
(S.z != 0 /\ T.z != 0 /\ ec_affinify S == ec_affinify T)
/**
* Compute a projective representative for the given affine point.
*/ | function | ec_equal | lib | lib/PrimeEC.cry | [] | [
"!=",
"/\\",
"==",
"Bit",
"ProjectivePoint",
"\\/",
"ec_affinify",
"prime"
] | null | 74 | 74 | true | https://github.com/GaloisInc/cryptol | a50cac6eb2c30a79503814f423f375f9476aaceb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.