Package list-length: The list length function

Information

namelist-length
version1.46
descriptionThe list length function
authorJoe Leslie-Hurd <joe@gilith.com>
licenseMIT
requiresbool
list-def
list-dest
list-thm
natural
showData.Bool
Data.List
Number.Natural

Files

Defined Constant

Theorems

length [] = 0

l. length l = 0 null l

l. length l = 0 l = []

h t. length (h :: t) = suc (length t)

l. ¬null l length (tail l) = length l - 1

l n. length l = suc n h t. l = h :: t length t = n

External Type Operators

External Constants

Assumptions

null []

¬

¬

p. p

t. t ¬t

(¬) = λp. p

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

t. (x. t) t

t. (x. t) t

() = λp. p = λx.

t. ¬¬t t

t. ( t) t

t. t

t. t t

t. t

t. t t

n. ¬(suc n = 0)

t. ( t) ¬t

t. t ¬t

l. null l l = []

h t. ¬null (h :: t)

() = λp q. p q p

n. suc n - 1 = n

h t. ¬(h :: t = [])

h t. tail (h :: t) = t

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

p. ¬(x. p x) x. ¬p x

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

m n. suc m = suc n m = n

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

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

p. p [] (h t. p t p (h :: t)) l. p l

h1 h2 t1 t2. h1 :: t1 = h2 :: t2 h1 = h2 t1 = t2

b f. fn. fn [] = b h t. fn (h :: t) = f h t (fn t)