Package list-take-drop: The list take and drop functions
Information
name | list-take-drop |
version | 1.26 |
description | The list take and drop functions |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
requires | bool natural list-def list-thm list-dest list-length list-append list-nth |
show | Data.Bool Data.List Number.Natural |
Files
- Package tarball list-take-drop-1.26.tgz
- Theory file list-take-drop.thy (included in the package tarball)
Defined Constants
- Data
- List
- drop
- take
- List
Theorems
⊦ ∀l. drop 0 l = l
⊦ ∀l. take 0 l = []
⊦ ∀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
⊦ ∀n h t. n ≤ length t ⇒ drop (suc n) (h :: t) = drop n t
⊦ ∀n h t. n ≤ length t ⇒ take (suc n) (h :: t) = h :: take n t
⊦ ∀n l i. n + i < length l ⇒ nth i (drop n l) = nth (n + i) l
⊦ ∀n l i. n ≤ length l ∧ i < n ⇒ nth i (take n l) = nth i l
Input Type Operators
- →
- bool
- Data
- List
- list
- List
- Number
- Natural
- natural
- Natural
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ¬
- F
- T
- List
- ::
- @
- []
- head
- length
- nth
- tail
- Bool
- Number
- Natural
- +
- -
- <
- ≤
- suc
- zero
- Natural
Assumptions
⊦ T
⊦ length [] = 0
⊦ ∀n. n ≤ n
⊦ F ⇔ ∀p. p
⊦ (¬) = λp. p ⇒ F
⊦ (∃) = λP. P ((select) P)
⊦ ∀t. (∀x. t) ⇔ t
⊦ (∀) = λp. p = λx. T
⊦ ∀t. F ∧ t ⇔ F
⊦ ∀t. T ∧ t ⇔ t
⊦ ∀t. t ∧ F ⇔ F
⊦ ∀t. t ∧ T ⇔ t
⊦ ∀t. F ⇒ t ⇔ T
⊦ ∀t. T ⇒ t ⇔ t
⊦ ∀t. t ⇒ T ⇔ T
⊦ ∀n. ¬(suc n = 0)
⊦ ∀m. m < 0 ⇔ F
⊦ ∀n. 0 + n = n
⊦ ∀n. n - n = 0
⊦ ∀l. [] @ l = l
⊦ ∀l. l @ [] = l
⊦ ∀m n. m ≤ m + n
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀m. m ≤ 0 ⇔ m = 0
⊦ ∀h t. head (h :: t) = h
⊦ ∀h t. tail (h :: t) = t
⊦ ∀l. length l = 0 ⇔ l = []
⊦ ∀h t. nth 0 (h :: t) = h
⊦ ∀m n. m + n - m = n
⊦ ∀h t. length (h :: t) = suc (length t)
⊦ ∀m n. suc m ≤ n ⇔ m < n
⊦ (∧) = λp q. (λf. f p q) = λf. f T T
⊦ (∃) = λP. ∀q. (∀x. P x ⇒ q) ⇒ q
⊦ ∀m n. m + suc n = suc (m + n)
⊦ ∀m n. suc m + 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
⊦ ∀l m. length (l @ m) = length l + length m
⊦ ∀m n p. m < n ∧ n ≤ p ⇒ m < p
⊦ ∀m n p. m ≤ n ∧ n ≤ p ⇒ m ≤ p
⊦ ∀l h t. (h :: t) @ l = h :: t @ l
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ (∃!) = λP. (∃) P ∧ ∀x y. P x ∧ P y ⇒ x = y
⊦ ∀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
⊦ ∀h t n. n < length t ⇒ nth (suc n) (h :: t) = nth n t
⊦ ∀h1 h2 t1 t2. h1 :: t1 = h2 :: t2 ⇔ h1 = h2 ∧ t1 = t2