Package list-nth: The list nth function
Information
name | list-nth |
version | 1.26 |
description | The list nth function |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
requires | bool natural set list-def list-thm list-dest list-length list-set list-append list-map list-quant list-last |
show | Data.Bool Data.List Number.Natural Set |
Files
- Package tarball list-nth-1.26.tgz
- Theory file list-nth.thy (included in the package tarball)
Defined Constant
- Data
- List
- nth
- List
Theorems
⊦ ∀h t. nth 0 (h :: t) = h
⊦ ∀l i. i < length l ⇒ 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. 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
⊦ ∀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
- →
- bool
- Data
- List
- list
- List
- Number
- Natural
- natural
- Natural
- Set
- set
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ∨
- ¬
- cond
- F
- T
- List
- ::
- @
- []
- all
- exists
- head
- last
- length
- map
- tail
- toSet
- Bool
- Number
- Natural
- +
- -
- <
- ≤
- bit0
- bit1
- suc
- zero
- Natural
- Set
- ∅
- insert
- ∈
Assumptions
⊦ T
⊦ ¬F ⇔ T
⊦ ¬T ⇔ F
⊦ length [] = 0
⊦ bit0 0 = 0
⊦ toSet [] = ∅
⊦ ∀t. t ⇒ t
⊦ F ⇔ ∀p. p
⊦ ∀x. ¬(x ∈ ∅)
⊦ ∀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
⊦ ∀t. F ∧ t ⇔ F
⊦ ∀t. T ∧ t ⇔ t
⊦ ∀t. t ∧ T ⇔ t
⊦ ∀t. F ⇒ t ⇔ T
⊦ ∀t. T ⇒ t ⇔ t
⊦ ∀t. t ⇒ T ⇔ T
⊦ ∀t. T ∨ t ⇔ T
⊦ ∀n. ¬(suc n = 0)
⊦ ∀m. m < 0 ⇔ F
⊦ ∀m. m - 0 = m
⊦ ∀n. n - n = 0
⊦ ∀l. [] @ l = l
⊦ ∀n. bit1 n = suc (bit0 n)
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀n. suc n - 1 = n
⊦ ∀t1 t2. (if F then t1 else t2) = t2
⊦ ∀t1 t2. (if T then t1 else t2) = t1
⊦ ∀h t. ¬(h :: t = [])
⊦ ∀h t. head (h :: t) = h
⊦ ∀h t. tail (h :: t) = t
⊦ ∀l. length l = 0 ⇔ l = []
⊦ ∀x y. x = y ⇒ y = x
⊦ ∀l f. length (map f l) = length l
⊦ ∀h t. length (h :: t) = suc (length t)
⊦ ∀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
⊦ ∀h t. toSet (h :: t) = insert h (toSet t)
⊦ ∀m n. suc m + n = suc (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
⊦ (∨) = λ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
⊦ ∀l h t. (h :: t) @ l = h :: t @ l
⊦ ∀P l. all P l ⇔ ∀x. x ∈ toSet l ⇒ P x
⊦ ∀P l. exists P l ⇔ ∃x. x ∈ toSet l ∧ P x
⊦ ∀m n. n ≤ m ⇒ suc m - suc n = m - n
⊦ ∀f h t. map f (h :: t) = f h :: map f t
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ ∀x y s. x ∈ insert y s ⇔ x = y ∨ x ∈ s
⊦ (∃!) = λ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
⊦ ∀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)