Package list: List types
Information
name | list |
version | 1.40 |
description | List types |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
requires | bool function pair natural set |
show | Data.Bool Data.List Data.Pair Function Number.Natural Set |
Files
- Package tarball list-1.40.tgz
- Theory file list.thy (included in the package tarball)
Defined Type Operator
- Data
- List
- list
- List
Defined Constants
- Data
- List
- ::
- @
- []
- all
- case
- concat
- drop
- exists
- filter
- fromSet
- head
- interval
- last
- length
- map
- member
- nth
- nub
- nubReverse
- null
- replicate
- reverse
- tail
- take
- toSet
- zipWith
- List
Theorems
⊦ null []
⊦ length [] = 0
⊦ concat [] = []
⊦ nubReverse [] = []
⊦ reverse [] = []
⊦ toSet [] = ∅
⊦ map id = id
⊦ ∀l. finite (toSet l)
⊦ ∀p. all p []
⊦ ∀l. all (λx. T) l
⊦ ∀x. ¬member x []
⊦ ∀p. ¬exists p []
⊦ ∀x. replicate 0 x = []
⊦ ∀m. interval m 0 = []
⊦ ∀l. reverse (reverse l) = l
⊦ ∀l. [] @ l = l
⊦ ∀l. l @ [] = l
⊦ ∀l. drop 0 l = l
⊦ ∀l. take 0 l = []
⊦ ∀f. map f [] = []
⊦ ∀P. filter P [] = []
⊦ ∀l. map (λx. x) l = l
⊦ ∀h. last (h :: []) = h
⊦ ∀l. null l ⇔ l = []
⊦ ∀l. length (reverse l) = length l
⊦ ∀l. nub (nub l) = nub l
⊦ ∀l. nubReverse (nubReverse l) = nubReverse l
⊦ ∀l. toSet (nub l) = toSet l
⊦ ∀l. toSet (nubReverse l) = toSet l
⊦ ∀l. toSet (reverse l) = toSet l
⊦ ∀l. length (nub l) ≤ length l
⊦ ∀l. length (nubReverse l) ≤ length l
⊦ ∀l. size (toSet l) ≤ length l
⊦ ∀l. drop (length l) l = []
⊦ ∀l. take (length l) l = l
⊦ ∀l. case [] (::) l = l
⊦ ∀f. zipWith f [] [] = []
⊦ ∀h t. ¬null (h :: t)
⊦ ∀l. nub l = reverse (nubReverse (reverse l))
⊦ ∀l. null (concat l) ⇔ all null l
⊦ ∀h t. ¬(h :: t = [])
⊦ ∀h t. head (h :: t) = h
⊦ ∀h t. tail (h :: t) = t
⊦ ∀b f. case b f [] = b
⊦ ∀n x. length (replicate n x) = n
⊦ ∀m n. length (interval m n) = n
⊦ ∀l. length l = 0 ⇔ l = []
⊦ ∀l. toSet l = ∅ ⇔ l = []
⊦ ∀s. finite s ⇒ toSet (fromSet s) = s
⊦ ∀h t. nth 0 (h :: t) = h
⊦ ∀l f. length (map f l) = length l
⊦ ∀p l. length (filter p l) ≤ length l
⊦ ∀p l. toSet (filter p l) ⊆ toSet l
⊦ ∀s. finite s ⇒ length (fromSet s) = size s
⊦ ∀x l. member x l ⇔ x ∈ toSet l
⊦ ∀h t. length (h :: t) = suc (length t)
⊦ ∀l x. member x (nub l) ⇔ member x l
⊦ ∀l x. member x (nubReverse l) ⇔ member x l
⊦ ∀l x. member x (reverse l) ⇔ member x l
⊦ ∀l. ¬(l = []) ⇒ last l ∈ toSet l
⊦ ∀h t. toSet (h :: t) = insert h (toSet t)
⊦ ∀h t. concat (h :: t) = h @ concat t
⊦ ∀f l. toSet (map f l) = image f (toSet l)
⊦ ∀f l. map f l = [] ⇔ l = []
⊦ ∀x n. replicate (suc n) x = x :: replicate n x
⊦ ∀l n. n < length l ⇒ member (nth n l) l
⊦ ∀l m. null (l @ m) ⇔ null l ∧ null m
⊦ ∀l m. length (l @ m) = length l + length m
⊦ ∀l m. reverse (l @ m) = reverse m @ reverse l
⊦ ∀l1 l2. toSet (l1 @ l2) = toSet l1 ∪ toSet l2
⊦ ∀l. l = [] ∨ ∃h t. l = h :: t
⊦ ∀l. ¬(l = []) ⇒ head l :: tail l = l
⊦ ∀P l. ¬all P l ⇔ exists (λx. ¬P x) l
⊦ ∀P l. ¬exists P l ⇔ all (λx. ¬P x) l
⊦ ∀x l. reverse (x :: l) = reverse l @ x :: []
⊦ ∀m n. interval m (suc n) = m :: interval (suc m) n
⊦ ∀n l. n ≤ length l ⇒ length (take n l) = n
⊦ ∀l i. i < length l ⇒ nth i l ∈ toSet l
⊦ ∀s. finite s ⇒ ∀x. member x (fromSet s) ⇔ x ∈ s
⊦ ∀P l. (∀x. member x l ⇒ P x) ⇔ all P l
⊦ ∀P l. (∃x. P x ∧ member x l) ⇔ exists P l
⊦ ∀h t. last (h :: t) = if t = [] then h else last t
⊦ ∀h k t. last (h :: k :: t) = last (k :: t)
⊦ ∀n x i. i < n ⇒ nth i (replicate n x) = x
⊦ ∀l h t. (h :: t) @ l = h :: t @ l
⊦ ∀l m n. l @ m @ n = (l @ m) @ n
⊦ ∀l. ¬(l = []) ⇒ length (tail l) = length l - 1
⊦ ∀f g l. map (g ∘ f) l = map g (map f l)
⊦ ∀P l. all P l ⇔ ∀x. x ∈ toSet l ⇒ P x
⊦ ∀P l. exists P l ⇔ ∃x. x ∈ toSet l ∧ P x
⊦ ∀P f l. all P (map f l) ⇔ all (P ∘ f) l
⊦ ∀P f l. exists P (map f l) ⇔ exists (P ∘ f) l
⊦ ∀b f h t. case b f (h :: t) = f h t
⊦ ∀n x. toSet (replicate n x) = if n = 0 then ∅ else insert x ∅
⊦ ∀l m. head (l @ m) = if l = [] then head m else head l
⊦ ∀p q. last (p @ q) = if q = [] then last p else last q
⊦ ∀l m. l @ m = [] ⇔ l = [] ∧ m = []
⊦ ∀l. ¬(l = []) ⇒ last l = nth (length l - 1) l
⊦ ∀s. finite s ⇒ toSet (fromSet s) = s ∧ length (fromSet s) = size s
⊦ ∀f h t. map f (h :: t) = f h :: map f t
⊦ ∀p h t. all p (h :: t) ⇔ p h ∧ all p t
⊦ ∀p h t. exists p (h :: t) ⇔ p h ∨ exists p t
⊦ ∀P l x. member x (filter P l) ⇔ P x ∧ member x l
⊦ ∀P l. (∀x. all (P x) l) ⇔ all (λs. ∀x. P x s) l
⊦ ∀P l. (∃x. exists (P x) l) ⇔ exists (λs. ∃x. P x s) l
⊦ ∀n l. n ≤ length l ⇒ length (drop n l) = length l - n
⊦ ∀n l. n ≤ length l ⇒ take n l @ drop n l = l
⊦ ∀x h t. member x (h :: t) ⇔ x = h ∨ member x t
⊦ ∀x l1 l2. member x (l1 @ l2) ⇔ member x l1 ∨ member x l2
⊦ ∀m n i. i < n ⇒ nth i (interval m n) = m + i
⊦ ∀f l1 l2. map f (l1 @ l2) = map f l1 @ map f l2
⊦ ∀f. (∀m. ∃l. map f l = m) ⇔ ∀y. ∃x. f x = y
⊦ ∀P l1 l2. all P (l1 @ l2) ⇔ all P l1 ∧ all P l2
⊦ ∀P l1 l2. filter P (l1 @ l2) = filter P l1 @ filter P l2
⊦ ∀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)
⊦ ∀P f l. filter P (map f l) = map f (filter (P ∘ f) l)
⊦ ∀h t.
nubReverse (h :: t) =
if member h t then nubReverse t else h :: nubReverse t
⊦ ∀l x. member x l ⇔ ∃i. i < length l ∧ x = nth i l
⊦ ∀P Q l. (∀x. P x ⇒ Q x) ⇒ all P l ⇒ all Q l
⊦ ∀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
⊦ ∀x l. x ∈ toSet l ⇔ ∃i. i < length l ∧ x = nth i l
⊦ ∀n h t. n ≤ length t ⇒ drop (suc n) (h :: t) = drop n t
⊦ ∀f l i. i < length l ⇒ nth i (map f l) = f (nth i l)
⊦ ∀f y l. member y (map f l) ⇔ ∃x. member x l ∧ y = f x
⊦ ∀f g l. all (λx. f x = g x) l ⇒ map f l = map g l
⊦ ∀P Q l. all P l ∧ all Q l ⇔ all (λx. P x ∧ Q x) l
⊦ ∀P Q l. all (λx. P x ⇒ Q x) l ∧ all P l ⇒ all Q l
⊦ ∀h1 h2 t1 t2. h1 :: t1 = h2 :: t2 ⇔ h1 = h2 ∧ t1 = t2
⊦ ∀n h t. n ≤ length t ⇒ take (suc n) (h :: t) = h :: take n t
⊦ ∀P h t. filter P (h :: t) = if P h then h :: filter P t else filter P t
⊦ ∀l n. length l = suc n ⇔ ∃h t. l = h :: t ∧ length t = n
⊦ ∀NIL' CONS'.
∃fn. fn [] = NIL' ∧ ∀a0 a1. fn (a0 :: a1) = CONS' a0 a1 (fn a1)
⊦ ∀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
⊦ ∀P Q l. (∀x. member x l ∧ P x ⇒ Q x) ∧ all P l ⇒ all Q l
⊦ ∀P Q l. (∀x. member x l ∧ P x ⇒ Q x) ∧ exists P l ⇒ exists Q l
⊦ ∀f l1 l2 n. length l1 = n ∧ length l2 = n ⇒ length (zipWith f l1 l2) = n
⊦ ∀l m.
length l = length m ∧ (∀i. i < length l ⇒ nth i l = nth i m) ⇒ l = m
⊦ ∀f. (∀l m. map f l = map f m ⇒ l = m) ⇔ ∀x y. f x = f y ⇒ x = y
⊦ ∀f h1 h2 t1 t2.
length t1 = length t2 ⇒
zipWith f (h1 :: t1) (h2 :: t2) = f h1 h2 :: zipWith f t1 t2
⊦ ∀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
- Pair
- ×
- Pair
- Number
- Natural
- natural
- Natural
- Set
- set
Input Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∃!
- ∨
- ¬
- cond
- F
- T
- Pair
- ,
- Bool
- Function
- id
- ∘
- Number
- Natural
- *
- +
- -
- <
- ≤
- bit0
- bit1
- even
- exp
- suc
- zero
- Natural
- Set
- ∅
- finite
- image
- insert
- ∈
- size
- ⊆
- ∪
Assumptions
⊦ T
⊦ finite ∅
⊦ id = λx. x
⊦ ¬F ⇔ T
⊦ ¬T ⇔ F
⊦ bit0 0 = 0
⊦ size ∅ = 0
⊦ ∀t. t ⇒ t
⊦ ∀n. 0 ≤ n
⊦ ∀n. n ≤ n
⊦ ∀s. s ⊆ s
⊦ F ⇔ ∀p. p
⊦ ∀x. ¬(x ∈ ∅)
⊦ ∀x. id x = x
⊦ ∀t. t ∨ ¬t
⊦ ∀n. ¬(n < n)
⊦ ∀n. 0 < suc n
⊦ ∀n. n < suc n
⊦ ∀n. n ≤ suc n
⊦ (¬) = λp. p ⇒ F
⊦ (∃) = λP. P ((select) P)
⊦ ∀a. ∃x. x = a
⊦ ∀a. ∃!x. x = a
⊦ ∀t. (∀x. t) ⇔ t
⊦ ∀t. (∃x. t) ⇔ t
⊦ ∀t. (λx. t x) = t
⊦ (∀) = λp. p = λx. T
⊦ ∀t. ¬¬t ⇔ t
⊦ ∀t. (T ⇔ t) ⇔ t
⊦ ∀t. (t ⇔ T) ⇔ t
⊦ ∀t. F ∧ t ⇔ F
⊦ ∀t. T ∧ t ⇔ t
⊦ ∀t. t ∧ F ⇔ F
⊦ ∀t. t ∧ T ⇔ t
⊦ ∀t. t ∧ t ⇔ t
⊦ ∀t. F ⇒ t ⇔ T
⊦ ∀t. T ⇒ t ⇔ t
⊦ ∀t. t ⇒ T ⇔ T
⊦ ∀t. F ∨ t ⇔ t
⊦ ∀t. T ∨ t ⇔ T
⊦ ∀t. t ∨ F ⇔ t
⊦ ∀t. t ∨ T ⇔ T
⊦ ∀n. ¬(suc n = 0)
⊦ ∀m. m < 0 ⇔ F
⊦ ∀n. 0 + n = n
⊦ ∀m. m + 0 = m
⊦ ∀m. m - 0 = m
⊦ ∀n. n - n = 0
⊦ ∀f. image f ∅ = ∅
⊦ ∀t. (F ⇔ t) ⇔ ¬t
⊦ ∀t. (t ⇔ F) ⇔ ¬t
⊦ ∀t. t ⇒ F ⇔ ¬t
⊦ ∀n. even (2 * n)
⊦ ∀n. bit1 n = suc (bit0 n)
⊦ ∀m. exp m 0 = 1
⊦ ∀m n. m ≤ m + n
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ T) ∨ (t ⇔ F)
⊦ ∀n. even (suc n) ⇔ ¬even n
⊦ ∀m. m ≤ 0 ⇔ m = 0
⊦ ∀n. suc n - 1 = n
⊦ ∀t1 t2. (if F then t1 else t2) = t2
⊦ ∀t1 t2. (if T then t1 else t2) = t1
⊦ ∀x s. ¬(insert x s = ∅)
⊦ ∀n. bit0 (suc n) = suc (suc (bit0 n))
⊦ ∀f y. (let x ← y in f x) = f y
⊦ ∀x y. x = y ⇔ y = x
⊦ ∀x y. x = y ⇒ y = x
⊦ ∀t1 t2. t1 ∧ t2 ⇔ t2 ∧ t1
⊦ ∀t1 t2. t1 ∨ t2 ⇔ t2 ∨ t1
⊦ ∀m n. m + n - m = n
⊦ ∀s x. finite (insert x s) ⇔ finite s
⊦ ∀s t. s ∪ t = t ∪ s
⊦ ∀n. 2 * n = n + n
⊦ ∀m n. ¬(m < n ∧ n ≤ m)
⊦ ∀m n. ¬(m ≤ n ∧ n < m)
⊦ ∀m n. ¬(m < n) ⇔ n ≤ m
⊦ ∀m n. suc m ≤ n ⇔ m < n
⊦ ∀m. m = 0 ∨ ∃n. m = suc n
⊦ (∧) = λp q. (λf. f p q) = λf. f T T
⊦ ∀P. ¬(∀x. P x) ⇔ ∃x. ¬P x
⊦ ∀P. ¬(∃x. P x) ⇔ ∀x. ¬P x
⊦ (∃) = λP. ∀q. (∀x. P x ⇒ q) ⇒ q
⊦ ∀x s. insert x (insert x s) = insert x s
⊦ ∀x s. insert x ∅ ∪ s = insert x s
⊦ ∀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
⊦ ∀f g x. (f ∘ g) x = f (g x)
⊦ ∀t1 t2. ¬(t1 ∧ t2) ⇔ ¬t1 ∨ ¬t2
⊦ ∀t1 t2. ¬(t1 ∨ t2) ⇔ ¬t1 ∧ ¬t2
⊦ ∀m n. even (m * n) ⇔ even m ∨ even n
⊦ ∀m n. even (m + n) ⇔ even m ⇔ even n
⊦ ∀m n. exp m (suc n) = m * exp m n
⊦ ∀f g. (∀x. f x = g x) ⇔ f = g
⊦ ∀P a. (∃x. a = x ∧ P x) ⇔ P a
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀m n. m ≤ n ⇔ m < n ∨ m = n
⊦ ∀m n. m ≤ n ∧ n ≤ m ⇔ m = n
⊦ (∀s. ∅ ∪ s = s) ∧ ∀s. s ∪ ∅ = s
⊦ ∀P. (∀x y. P x y) ⇔ ∀y x. P x y
⊦ ∀P Q. (∃x. P ∧ Q x) ⇔ P ∧ ∃x. Q x
⊦ ∀P Q. P ∧ (∃x. Q x) ⇔ ∃x. P ∧ Q x
⊦ ∀P Q. P ∨ (∃x. Q x) ⇔ ∃x. P ∨ Q x
⊦ ∀P Q. (∀x. P x ⇒ Q) ⇔ (∃x. P x) ⇒ Q
⊦ ∀P Q. (∃x. P x) ∧ Q ⇔ ∃x. P x ∧ Q
⊦ ∀P Q. (∃x. P x) ⇒ Q ⇔ ∀x. P x ⇒ Q
⊦ ∀P Q. (∃x. P x) ∨ Q ⇔ ∃x. P x ∨ Q
⊦ ∀t1 t2 t3. (t1 ∧ t2) ∧ t3 ⇔ t1 ∧ t2 ∧ t3
⊦ ∀t1 t2 t3. (t1 ∨ t2) ∨ t3 ⇔ t1 ∨ t2 ∨ t3
⊦ ∀m n p. m * (n * p) = m * n * p
⊦ ∀m n p. m + p = n + p ⇔ m = n
⊦ ∀m n p. m < n ∧ n ≤ p ⇒ m < p
⊦ ∀m n p. m ≤ n ∧ n ≤ p ⇒ m ≤ p
⊦ ∀s t u. s ∪ t ∪ u = s ∪ (t ∪ u)
⊦ ∀s t u. s ⊆ t ∧ t ⊆ u ⇒ s ⊆ u
⊦ ∀s t. (∀x. x ∈ s ⇔ x ∈ t) ⇔ s = t
⊦ ∀P x. (∀y. P y ⇔ y = x) ⇒ (select) P = x
⊦ ∀P. (∀x. ∃y. P x y) ⇔ ∃y. ∀x. P x (y x)
⊦ ∀m n. n ≤ m ⇒ suc m - suc n = m - n
⊦ ∀m n. m ≤ suc n ⇔ m = suc n ∨ m ≤ n
⊦ ∀m n. m * n = 0 ⇔ m = 0 ∨ n = 0
⊦ ∀f x s. image f (insert x s) = insert (f x) (image f s)
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ ∀m n. exp m n = 0 ⇔ m = 0 ∧ ¬(n = 0)
⊦ (∀s t. s ⊆ s ∪ t) ∧ ∀s t. s ⊆ t ∪ s
⊦ ∀x y s. x ∈ insert y s ⇔ x = y ∨ x ∈ s
⊦ ∀s t u. s ∪ t ⊆ u ⇔ s ⊆ u ∧ t ⊆ u
⊦ (∃!) = λP. (∃) P ∧ ∀x y. P x ∧ P y ⇒ x = y
⊦ ∀P Q. (∀x. P x ∧ Q x) ⇔ (∀x. P x) ∧ ∀x. Q x
⊦ ∀P Q. (∃x. P x ∨ Q x) ⇔ (∃x. P x) ∨ ∃x. Q x
⊦ ∀P Q. (∀x. P x ⇒ Q x) ⇒ (∀x. P x) ⇒ ∀x. Q x
⊦ ∀P Q. (∀x. P x ⇒ Q x) ⇒ (∃x. P x) ⇒ ∃x. Q x
⊦ ∀P Q. (∀x. P x) ∧ (∀x. Q x) ⇔ ∀x. P x ∧ Q x
⊦ ∀P Q. (∃x. P x) ∨ (∃x. Q x) ⇔ ∃x. P x ∨ Q x
⊦ ∀e f. ∃!fn. fn 0 = e ∧ ∀n. fn (suc n) = f (fn n) n
⊦ ∀m n p. m * n = m * p ⇔ m = 0 ∨ n = p
⊦ ∀m n p. m * n ≤ m * p ⇔ m = 0 ∨ n ≤ p
⊦ ∀x s.
finite s ⇒ size (insert x s) = if x ∈ s then size s else suc (size s)
⊦ ∀m n p. m * n < m * p ⇔ ¬(m = 0) ∧ n < p
⊦ ∀x y a b. (x, y) = (a, b) ⇔ x = a ∧ y = b
⊦ ∀A B C D. (A ⇒ B) ∧ (C ⇒ D) ⇒ A ∧ C ⇒ B ∧ D
⊦ ∀A B C D. (A ⇒ B) ∧ (C ⇒ D) ⇒ A ∨ C ⇒ B ∨ D
⊦ ∀P. (∀x. ∃!y. P x y) ⇔ ∃f. ∀x y. P x y ⇔ f x = y
⊦ ∀P c x y. P (if c then x else y) ⇔ (c ⇒ P x) ∧ (¬c ⇒ P y)
⊦ ∀P. (∃!x. P x) ⇔ (∃x. P x) ∧ ∀x x'. P x ∧ P x' ⇒ x = x'
⊦ ∀P.
P ∅ ∧ (∀x s. P s ∧ ¬(x ∈ s) ∧ finite s ⇒ P (insert x s)) ⇒
∀s. finite s ⇒ P s