Package list: Basic theory of list types

Information

namelist
version1.0
descriptionBasic theory of list types
authorJoe Hurd <joe@gilith.com>
licenseMIT
show Data.Bool
Data.List
Function
Number.Natural
Number.Numeral

Files

Defined Type Operator

Defined Constants

Theorems

map id = id

l. all (λx. T) l

l. reverse (reverse l) = l

l. l @ [] = l

l. map (λx. x) l = l

l. null l l = []

l. drop (length l) l = []

l. take (length l) l = l

l. null (concat l) all null l

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

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

n x. length (replicate n x) = n

m n. length (interval m n) = n

t h. head (h :: t) = h

l. length l = 0 l = []

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

f l. map f l = [] l = []

l n. n < length l member (nth n l) l

l m. null (l @ m) null l null m

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

l m. reverse (l @ m) = reverse m @ reverse l

x. x = [] a0 a1. x = a0 :: a1

P l. ¬exists P l all (λx. ¬P x) l

P l. ¬all P l exists (λx. ¬P x) l

n l. n length l length (take n l) = n

(null [] T) h t. null (h :: t) F

P l. (x. member x l P x) all P l

P l. (x. P x member x l) exists P l

h t. last (h :: t) = (if t = [] then h else last t)

n x i. i < n nth i (replicate n x) = x

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

l m n. l @ m @ n = (l @ m) @ n

P f l. all P (map f l) all (P o f) l

P f l. exists P (map f l) exists (P o f) l

f g l. map (g o f) l = map g (map f l)

l m. l @ m = [] l = [] m = []

p q. last (p @ q) = (if q = [] then last p else last q)

l m. head (l @ m) = (if l = [] then head m else head l)

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

l. ¬(l = []) last l = nth (length l - 1) l

P l x. member x (filter P l) P x member x l

P l. (x. exists (P x) l) exists (λs. x. P x s) l

P l. (x. all (P x) l) all (λs. x. P x s) l

n l. n length l length (drop n l) = length l - n

n l. n length l take n l @ drop n l = l

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

x l1 l2. member x (l1 @ l2) member x l1 member x l2

m n i. i < n nth i (interval m n) = m + i

P l1 l2. filter P (l1 @ l2) = filter P l1 @ filter P l2

P f l. filter P (map f l) = map f (filter (P o f) l)

P l1 l2. all P (l1 @ l2) all P l1 all P l2

f l1 l2. map f (l1 @ l2) = map f l1 @ map f l2

f. (m. l. map f l = m) y. x. f x = y

l x. member x l i. i < length l x = nth i l

P Q l. (x. P x Q x) all P l all Q l

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

reverse [] = [] l x. reverse (x :: l) = reverse l @ x :: []

f l i. i < length l nth i (map f l) = f (nth i l)

f g l. all (λx. f x = g x) l map f l = map g l

P Q l. all (λx. P x Q x) l all P l all Q l

P Q l. all P l all Q l all (λx. P x Q x) l

f y l. member y (map f l) x. member x l y = f x

(x. replicate 0 x = []) n x. replicate (suc n) x = x :: replicate n x

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

n h t. nth n (h :: t) = (if n = 0 then h else nth (n - 1) t)

(m. interval m 0 = [])
  m n. interval m (suc n) = m :: interval (suc m) n

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

(l. drop 0 l = l) n h t. drop (suc n) (h :: t) = drop n t

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

n l i. n length l i < n nth i (take n l) = nth i l

P Q l. (x. member x l P x Q x) all P l all Q l

P Q l. (x. member x l P x Q x) exists P l exists Q l

f l1 l2 n. length l1 = n length l2 = n length (zipWith f l1 l2) = n

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

(l. take 0 l = []) n h t. take (suc n) (h :: t) = h :: take n t

(P. all P [] T) h P t. all P (h :: t) P h all P t

(P. exists P [] F) h P t. exists P (h :: t) P h exists P t

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

(h. last (h :: []) = h) h k t. last (h :: k :: t) = last (k :: t)

k l m.
    nth k (l @ m) =
    (if k < length l then nth k l else nth (k - length l) m)

(x. member x [] F) h x t. member x (h :: t) x = h member x t

(h t. nth 0 (h :: t) = h) h t n. nth (suc n) (h :: t) = nth n t

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

l m.
    length l = length m (i. i < length l nth i l = nth i m) l = m

n l i.
    n length l i < length l - n nth i (drop n l) = nth (n + i) l

f. (l m. map f l = map f m l = m) x y. f x = f y x = y

(P. filter P [] = [])
  h P t. filter P (h :: t) = (if P h then h :: filter P t else filter P t)

(f. zipWith f [] [] = [])
  f h1 h2 t1 t2.
    zipWith f (h1 :: t1) (h2 :: t2) = f h1 h2 :: zipWith f t1 t2

Input Type Operators

Input Constants

Assumptions

T

id = λx. x

n. 0 n

F p. p

x. id x = x

t. t ¬t

n. 0 < suc n

(¬) = λp. p F

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

a. x. x = a

a. ∃!x. x = a

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)

m. m + 0 = m

n. even (2 * n)

n. bit0 n = n + n

() = λp q. p q p

t. (t T) (t F)

n. bit1 n = suc (n + n)

n. suc n - 1 = n

(¬T F) (¬F T)

f y. (λx. f x) y = f y

t1 t2. t1 t2 t2 t1

n. 2 * n = n + n

m n. ¬(m < n n m)

m n. ¬(m n n < m)

m n. suc m n m < n

m. m = 0 n. m = suc n

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

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

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

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

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

m n. suc m = suc n m = n

m n. suc m < suc n m < n

m n. suc m suc n m n

m n. suc m - suc n = m - n

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

f g x. (f o g) x = f (g x)

m n. even (m * n) even m even n

m n. even (m + n) even m even n

f g. f = g x. f x = g x

P a. (x. a = x P x) P a

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

(even 0 T) n. even (suc n) ¬even n

m n. m n m < n m = n

m n. m n n m m = n

P. (x y. P x y) y x. P x y

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

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

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

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

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

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

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

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

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

m n p. m * (n * p) = m * n * p

m n p. m + p = n + p m = n

P x. (y. P y y = x) (select) P = x

P. (x. y. P x y) y. x. P x (y x)

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

m n. m * n = 0 m = 0 n = 0

P. P 0 (n. P n P (suc n)) n. P n

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

m n. exp m n = 0 m = 0 ¬(n = 0)

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

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

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

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

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

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

e f. fn. fn 0 = e n. fn (suc n) = f (fn n) n

m n p. m * n = m * p m = 0 n = p

m n p. m * n m * p m = 0 n p

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

(m. m - 0 = m) m n. m - suc n = pre (m - n)

m n p. m * n < m * p ¬(m = 0) n < p

x y a b. Data.Pair., x y = Data.Pair., a b x = a y = b

A B C D. (A B) (C D) A C B D

A B C D. (A B) (C D) A C B D

P. (x. ∃!y. P x y) f. x y. P x y f x = y

(m. exp m 0 = 1) m n. exp m (suc n) = m * exp m n

P c x y. P (if c then x else y) (c P x) (¬c P y)

P. (∃!x. P x) (x. P x) x x'. P x P x' x = x'

(m. m < 0 F) m n. m < suc n m = n m < n

t1 t2. (¬(t1 t2) ¬t1 ¬t2) (¬(t1 t2) ¬t1 ¬t2)

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

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)

p q r.
    (p q q p) ((p q) r p q r) (p q r q p r)
    (p p p) (p p q p q)

p q r.
    (p q q p) ((p q) r p q r) (p q r q p r)
    (p p p) (p p q p q)