Package natural-bits-def: Definition of natural number to bit-list conversions

Information

namenatural-bits-def
version1.19
descriptionDefinition of natural number to bit-list conversions
authorJoe Leslie-Hurd <joe@gilith.com>
licenseMIT
provenanceHOL Light theory extracted on 2014-01-13
requiresbool
list
natural
pair
probability
relation
showData.Bool
Data.List
Data.Pair
Number.Natural
Probability.Random

Files

Defined Constants

Theorems

n. Bits.head n odd n

l. Bits.toNatural l = Bits.append l 0

b. fromBool b = if b then 1 else 0

n. Bits.tail n = n div 2

l. Bits.normal l null l last l

n i. Bits.bit n i Bits.head (Bits.shiftRight n i)

l n. Bits.append l n = foldr Bits.cons n l

n. Bits.fromNatural n = map (Bits.bit n) (interval 0 (Bits.width n))

n k. Bits.bound n k = n mod 2 k

n k. Bits.shiftLeft n k = 2 k * n

n k. Bits.shiftRight n k = n div 2 k

h t. Bits.cons h t = fromBool h + 2 * t

n. Bits.width n = if n = 0 then 0 else log 2 n + 1

n r.
    Uniform.fromRandom n r =
    let w Bits.width (n - 1) in
    let (r1, r2) split r in
    (Uniform.fromRandom.loop n w r1 mod n, r2)

n w r.
    Uniform.fromRandom.loop n w r =
    let (l, r') bits w r in
    let m Bits.toNatural l in
    if m < n then m else Uniform.fromRandom.loop n w r'

External Type Operators

External Constants

Assumptions

¬

¬

() = λp. p ((select) p)

t. (λx. t x) = t

() = λp. p = λx.

t. t

() = λp q. p q p

t. (t ) (t )

t1 t2. (if then t1 else t2) = t2

t1 t2. (if then t1 else t2) = t1

p x. p x p ((select) p)

x. a b. x = (a, b)

() = λp q. (λf. f p q) = λf. f

() = λp. q. (x. p x q) q

() = λp q. r. (p r) (q r) r

f. fn. a b. fn (a, b) = f a b

r. (x. y. r x y) f. x. r x (f x)

p g h. f. x. f x = if p x then f (g x) else h x