name | list-nth |
version | 1.0 |
description | Definitions and theorems about the list nth function |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
show | Data.Bool Data.List Number.Natural Number.Numeral |
⊦ ∀l. ¬(l = []) ⇒ last l = nth (length l - 1) l
⊦ ∀f l i. i < length l ⇒ nth i (map f l) = f (nth i l)
⊦ ∀n h t. nth n (h :: t) = (if n = 0 then h else nth (n - 1) t)
⊦ ∀k l m.
nth k (l @ m) =
(if k < length l then nth k l else nth (k - length l) m)
⊦ (∀h t. nth 0 (h :: t) = h) ∧ ∀h t n. nth (suc n) (h :: t) = nth n t
⊦ ∀l m.
length l = length m ∧ (∀i. i < length l ⇒ nth i l = nth i m) ⇒ l = m
⊦ T
⊦ F ⇔ ∀p. p
⊦ ∀n. 0 < 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)
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ T) ∨ (t ⇔ F)
⊦ ∀n. suc n - 1 = n
⊦ ∀h t. tail (h :: t) = t
⊦ ∀t h. head (h :: t) = h
⊦ (¬T ⇔ F) ∧ (¬F ⇔ T)
⊦ ∀l. length l = 0 ⇔ l = []
⊦ (∧) = λ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
⊦ ∀m n. suc m - suc n = m - n
⊦ ∀m. 0 - m = 0 ∧ m - 0 = 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)
⊦ ∀t1 t2. (if T then t1 else t2) = t1 ∧ (if F then t1 else t2) = t2
⊦ length [] = 0 ∧ ∀h t. length (h :: t) = suc (length t)
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ ∀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
⊦ ∀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) ∧ ∀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 ⇒ t ⇔ T) ∧ (t ⇒ F ⇔ ¬t)