Package list-length: Definitions and theorems about the list length function

Information

namelist-length
version1.0
description Definitions and theorems about the list length function
authorJoe Hurd <joe@gilith.com>
licenseMIT
show Data.Bool
Data.List
Number.Natural
Number.Numeral

Files

Defined Constant

Theorems

l. length l = 0 l = []

l f. length (map f l) = length l

l m. length (l @ m) = length l + length m

l. ¬(l = []) length (tail l) = length l - 1

length [] = 0 h t. length (h :: t) = suc (length t)

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

Input Type Operators

Input Constants

Assumptions

T

F p. p

(¬) = λp. p F

() = λP. P ((select) P)

t. (x. t) t

t. (x. t) t

t. (λx. t x) = t

() = λP. P = λx. T

x. x = x T

n. ¬(suc n = 0)

() = λp q. p q p

t. (t T) (t F)

n. suc n - 1 = n

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

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

(¬T F) (¬F T)

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

P. ¬(x. P x) x. ¬P x

() = λP. q. (x. P x q) q

m n. suc m = suc n m = n

m. 0 - m = 0 m - 0 = m

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

P Q. P (x. Q x) x. P Q x

P Q. P (x. Q x) x. P Q x

t1 t2 t3. t1 t2 t3 (t1 t2) t3

(t. ¬¬t t) (¬T F) (¬F T)

P. P [] (a0 a1. P a1 P (a0 :: a1)) x. P x

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

NIL' CONS'.
    fn. fn [] = NIL' a0 a1. fn (a0 :: a1) = CONS' a0 a1 (fn a1)

(l. [] @ l = l) h t l. (h :: t) @ l = h :: t @ l

(f. map f [] = []) f h t. map f (h :: t) = f h :: map f t

t. ((T t) t) ((t T) t) ((F t) ¬t) ((t F) ¬t)

t. (T t t) (t T t) (F t F) (t F F) (t t t)

t. (T t T) (t T T) (F t t) (t F t) (t t t)

t. (T t t) (t T T) (F t T) (t t T) (t F ¬t)

(n. 0 + n = n) (m. m + 0 = m) (m n. suc m + n = suc (m + n))
  m n. m + suc n = suc (m + n)