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

Information

namelist-nth
version1.13
descriptionDefinitions and theorems about the list nth function
authorJoe Hurd <joe@gilith.com>
licenseMIT
showData.Bool
Data.List
Number.Natural

Files

Defined Constant

Theorems

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

l i. i < length l Set.∈ (nth i l) (toSet l)

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

P l. all P l i. i < length l P (nth i l)

P l. exists P l i. i < length l P (nth i l)

h t n. n < length t nth (suc n) (h :: t) = nth n t

x l. Set.∈ x (toSet l) i. i < length l x = nth i l

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

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

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

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

Input Type Operators

Input Constants

Assumptions

T

F p. p

1 = suc 0

x. ¬Set.∈ x Set.∅

n. ¬(n < n)

n. 0 < suc n

n. n < suc n

(¬) = λp. p F

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

t. (x. t) t

() = λp. p = λx. T

x. x = x T

n. ¬(suc n = 0)

m. m - 0 = m

n. n - n = 0

() = λp q. p q p

n. suc n - 1 = n

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

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

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

(¬T F) (¬F T)

l. length l = 0 l = []

x y. x = y y = x

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

m n. ¬(m < n) n m

m. m = 0 n. m = suc n

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

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

m n. suc m = suc n m = n

m n. suc m < suc n m < n

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

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

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

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

P l. all P l x. Set.∈ x (toSet l) P x

P l. exists P l x. Set.∈ x (toSet l) P x

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

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

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

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

toSet [] = Set.∅ h t. toSet (h :: t) = Set.insert h (toSet t)

x y s. Set.∈ x (Set.insert y s) x = y Set.∈ x s

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

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

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

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

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

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

(l. [] @ l = l) l h t. (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 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)