name | list-take-drop |
version | 1.0 |
description | Definitions and theorems about the list take and drop functions |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
show | Data.Bool Data.List Number.Natural Number.Numeral |
⊦ ∀l. drop (length l) l = []
⊦ ∀l. take (length l) l = l
⊦ ∀n l. n ≤ length l ⇒ length (take n l) = n
⊦ ∀n l. n ≤ length l ⇒ length (drop n l) = length l - n
⊦ ∀n l. n ≤ length l ⇒ take n l @ drop n l = l
⊦ (∀l. drop 0 l = l) ∧ ∀n h t. drop (suc n) (h :: t) = drop n t
⊦ ∀n l i. n ≤ length l ∧ i < n ⇒ nth i (take n l) = nth i l
⊦ (∀l. take 0 l = []) ∧ ∀n h t. take (suc n) (h :: t) = h :: take n t
⊦ ∀n l i.
n ≤ length l ∧ i < length l - n ⇒ nth i (drop n l) = nth (n + i) l
⊦ T
⊦ F ⇔ ∀p. p
⊦ (¬) = λ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
⊦ ∀h t. tail (h :: t) = t
⊦ ∀t h. head (h :: t) = h
⊦ ∀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
⊦ ∀m n. suc m ≤ suc n ⇔ m ≤ n
⊦ ∀m n. suc m - suc n = m - n
⊦ ∀x. x = [] ∨ ∃a0 a1. x = a0 :: a1
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ 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
⊦ (∀n. 0 + n = n) ∧ ∀m n. suc m + n = suc (m + n)
⊦ (∀m. m - 0 = m) ∧ ∀m n. m - suc n = pre (m - n)
⊦ ∀h1 h2 t1 t2. h1 :: t1 = h2 :: t2 ⇔ h1 = h2 ∧ t1 = t2
⊦ (∀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
⊦ (∀m. m ≤ 0 ⇔ m = 0) ∧ ∀m n. m ≤ suc n ⇔ m = suc n ∨ m ≤ n
⊦ (∀h t. nth 0 (h :: t) = h) ∧ ∀h t n. nth (suc n) (h :: t) = nth n 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)