name | list |
version | 1.16 |
description | Basic theory of list types |
author | Joe Hurd <joe@gilith.com> |
license | MIT |
show | Data.Bool Data.List Function Number.Natural |
⊦ map id = id
⊦ ∀l. Set.finite (toSet l)
⊦ ∀l. all (λx. T) l
⊦ ∀l. reverse (reverse l) = l
⊦ ∀l. l @ [] = l
⊦ ∀l. drop 0 l = l
⊦ ∀l. take 0 l = []
⊦ ∀l. map (λx. x) l = l
⊦ ∀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. Set.size (toSet l) ≤ length l
⊦ ∀l. drop (length l) l = []
⊦ ∀l. take (length l) l = l
⊦ ∀l. case.[].:: [] (::) l = l
⊦ ∀f. zipWith f [] [] = []
⊦ ∀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
⊦ ∀n x. length (replicate n x) = n
⊦ ∀m n. length (interval m n) = n
⊦ ∀l. length l = 0 ⇔ l = []
⊦ ∀l. toSet l = Set.∅ ⇔ l = []
⊦ ∀s. Set.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. Set.⊆ (toSet (filter p l)) (toSet l)
⊦ ∀s. Set.finite s ⇒ length (fromSet s) = Set.size s
⊦ ∀x l. member x l ⇔ Set.∈ x (toSet l)
⊦ ∀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 = []) ⇒ Set.∈ (last l) (toSet l)
⊦ ∀f l. toSet (map f l) = Set.image f (toSet l)
⊦ ∀f l. map f l = [] ⇔ l = []
⊦ ∀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) = Set.∪ (toSet l1) (toSet l2)
⊦ ∀l. l = [] ∨ ∃h t. l = h :: t
⊦ ∀P l. ¬all P l ⇔ exists (λx. ¬P x) l
⊦ ∀P l. ¬exists P l ⇔ all (λx. ¬P x) l
⊦ ∀n l. n ≤ length l ⇒ length (take n l) = n
⊦ ∀l i. i < length l ⇒ Set.∈ (nth i l) (toSet l)
⊦ ∀s. Set.finite s ⇒ ∀x. member x (fromSet s) ⇔ Set.∈ x s
⊦ (null [] ⇔ T) ∧ ∀h t. null (h :: t) ⇔ F
⊦ ∀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
⊦ ∀n x i. i < n ⇒ nth i (replicate n x) = x
⊦ ∀l m n. l @ m @ n = (l @ m) @ n
⊦ ∀l. ¬(l = []) ⇒ length (tail l) = length l - 1
⊦ ∀f g l. map (g o f) l = map g (map f l)
⊦ ∀P f l. all P (map f l) ⇔ all (P o f) l
⊦ ∀P f l. exists P (map f l) ⇔ exists (P o f) l
⊦ ∀n x. toSet (replicate n x) = if n = 0 then Set.∅ else Set.insert x Set.∅
⊦ ∀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 = []
⊦ length [] = 0 ∧ ∀h t. length (h :: t) = suc (length t)
⊦ ∀l. ¬(l = []) ⇒ last l = nth (length l - 1) l
⊦ ∀s.
Set.finite s ⇒ toSet (fromSet s) = s ∧ length (fromSet s) = Set.size s
⊦ ∀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
⊦ concat [] = [] ∧ ∀h t. concat (h :: t) = h @ concat t
⊦ toSet [] = Set.∅ ∧ ∀h t. toSet (h :: t) = Set.insert h (toSet 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 f l. filter P (map f l) = map f (filter (P o f) l)
⊦ ∀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
⊦ reverse [] = [] ∧ ∀x l. reverse (x :: l) = reverse l @ x :: []
⊦ ∀h t n. n < length t ⇒ nth (suc n) (h :: t) = nth n t
⊦ ∀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
⊦ (∀x. replicate 0 x = []) ∧ ∀x n. replicate (suc n) x = x :: replicate n x
⊦ ∀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
⊦ (∀m. interval m 0 = []) ∧
∀m n. interval m (suc n) = m :: interval (suc m) n
⊦ ∀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 ≤ 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
⊦ nubReverse [] = [] ∧
∀h t.
nubReverse (h :: t) =
if member h t then nubReverse t else h :: nubReverse t
⊦ (∀l. [] @ l = l) ∧ ∀l h t. (h :: t) @ l = h :: t @ l
⊦ (∀f. map f [] = []) ∧ ∀f h t. map f (h :: t) = f h :: map f t
⊦ (∀P. all P [] ⇔ T) ∧ ∀P h t. all P (h :: t) ⇔ P h ∧ all P t
⊦ (∀P. exists P [] ⇔ F) ∧ ∀P h t. exists P (h :: t) ⇔ P h ∨ exists P t
⊦ (∀h. last (h :: []) = h) ∧ ∀h k t. last (h :: k :: t) = last (k :: t)
⊦ (∀x. member x [] ⇔ F) ∧ ∀x h t. member x (h :: t) ⇔ x = h ∨ member x t
⊦ (∀b f. case.[].:: b f [] = b) ∧ ∀b f h t. case.[].:: b f (h :: t) = f h t
⊦ ∀l m.
length l = length m ∧ (∀i. i < length l ⇒ nth i l = nth i m) ⇒ l = m
⊦ (∀l. drop 0 l = l) ∧
∀n h t. n ≤ length t ⇒ drop (suc n) (h :: t) = drop n t
⊦ ∀n l i.
n ≤ length l ∧ i < length l - n ⇒ nth i (drop n l) = nth (n + i) l
⊦ ∀f. (∀l m. map f l = map f m ⇒ l = m) ⇔ ∀x y. f x = f y ⇒ x = y
⊦ (∀l. take 0 l = []) ∧
∀n h t. n ≤ length t ⇒ take (suc n) (h :: t) = h :: take n t
⊦ (∀P. filter P [] = []) ∧
∀P h t. filter P (h :: t) = if P h then h :: filter P t else filter P t
⊦ ∀f h1 h2 t1 t2.
length t1 = length t2 ⇒
zipWith f (h1 :: t1) (h2 :: t2) = f h1 h2 :: zipWith f t1 t2
⊦ (∀h t. nth 0 (h :: t) = h) ∧
∀h t n. n < length t ⇒ nth (suc n) (h :: t) = nth n t
⊦ ∀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
⊦ (∀f. zipWith f [] [] = []) ∧
∀f h1 h2 t1 t2.
length t1 = length t2 ⇒
zipWith f (h1 :: t1) (h2 :: t2) = f h1 h2 :: zipWith f t1 t2
⊦ T
⊦ Set.finite Set.∅
⊦ id = λx. x
⊦ Set.size Set.∅ = 0
⊦ ∀n. 0 ≤ n
⊦ ∀n. n ≤ n
⊦ ∀s. Set.⊆ s s
⊦ F ⇔ ∀p. p
⊦ 1 = suc 0
⊦ ∀x. ¬Set.∈ x Set.∅
⊦ ∀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
⊦ ∀x. x = x ⇔ T
⊦ ∀n. ¬(suc n = 0)
⊦ ∀m. m + 0 = m
⊦ ∀m. m - 0 = m
⊦ ∀n. n - n = 0
⊦ ∀n. even (2 * n)
⊦ ∀n. bit0 n = n + n
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀t. (t ⇔ T) ∨ (t ⇔ F)
⊦ ∀n. bit1 n = suc (n + n)
⊦ ∀n. suc n - 1 = n
⊦ ∀x s. ¬(Set.insert x s = Set.∅)
⊦ (¬T ⇔ F) ∧ (¬F ⇔ T)
⊦ ∀f y. (let x ← y ∈ f x) = f y
⊦ ∀x y. x = y ⇒ y = x
⊦ ∀t1 t2. t1 ∨ t2 ⇔ t2 ∨ t1
⊦ ∀m n. m + n - m = n
⊦ ∀s x. Set.finite (Set.insert x s) ⇔ Set.finite s
⊦ ∀s t. Set.∪ s t = Set.∪ 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. Set.insert x (Set.insert x s) = Set.insert x s
⊦ ∀x s. Set.∪ (Set.insert x Set.∅) s = Set.insert x s
⊦ ∀m n. m + suc 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 o g) x = f (g x)
⊦ ∀m n. even (m * n) ⇔ even m ∨ even n
⊦ ∀m n. even (m + n) ⇔ even m ⇔ even n
⊦ ∀m n. m ≤ n ⇔ ∃d. n = m + d
⊦ ∀f g. f = g ⇔ ∀x. f x = g x
⊦ ∀P a. (∃x. a = x ∧ P x) ⇔ P a
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ (even 0 ⇔ T) ∧ ∀n. even (suc n) ⇔ ¬even n
⊦ ∀m n. m ≤ n ⇔ m < n ∨ m = n
⊦ ∀m n. m ≤ n ∧ n ≤ m ⇔ m = n
⊦ (∀s. Set.∪ Set.∅ s = s) ∧ ∀s. Set.∪ s Set.∅ = 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
⊦ ∀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 < m + p ⇔ n < p
⊦ ∀m n p. m < n ∧ n ≤ p ⇒ m < p
⊦ ∀m n p. m ≤ n ∧ n ≤ p ⇒ m ≤ p
⊦ ∀s t u. Set.∪ (Set.∪ s t) u = Set.∪ s (Set.∪ t u)
⊦ ∀s t u. Set.⊆ s t ∧ Set.⊆ t u ⇒ Set.⊆ s u
⊦ ∀s t. s = t ⇔ ∀x. Set.∈ x s ⇔ Set.∈ x t
⊦ ∀P x. (∀y. P y ⇔ y = x) ⇒ (select) P = x
⊦ ∀P. (∀x. ∃y. P x y) ⇔ ∃y. ∀x. P x (y x)
⊦ ∀t1 t2. (if T then t1 else t2) = t1 ∧ (if F then t1 else t2) = t2
⊦ ∀m n. n ≤ m ⇒ suc m - suc n = m - n
⊦ ∀m n. m * n = 0 ⇔ m = 0 ∨ n = 0
⊦ ∀P. P 0 ∧ (∀n. P n ⇒ P (suc n)) ⇒ ∀n. P n
⊦ (∀t. ¬¬t ⇔ t) ∧ (¬T ⇔ F) ∧ (¬F ⇔ T)
⊦ ∀m n. exp m n = 0 ⇔ m = 0 ∧ ¬(n = 0)
⊦ (∀s t. Set.⊆ s (Set.∪ s t)) ∧ ∀s t. Set.⊆ s (Set.∪ t s)
⊦ ∀x y s. Set.∈ x (Set.insert y s) ⇔ x = y ∨ Set.∈ x s
⊦ ∀s t u. Set.⊆ (Set.∪ s t) u ⇔ Set.⊆ s u ∧ Set.⊆ t u
⊦ ∀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
⊦ (∀n. 0 + n = n) ∧ ∀m n. suc m + n = suc (m + n)
⊦ ∀m n p. m * n < m * p ⇔ ¬(m = 0) ∧ n < p
⊦ ∀x y a b. Data.Pair., x y = Data.Pair., 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
⊦ (∀m. exp m 0 = 1) ∧ ∀m n. exp m (suc n) = m * exp m n
⊦ ∀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'
⊦ (∀m. m < 0 ⇔ F) ∧ ∀m n. m < suc n ⇔ m = n ∨ m < n
⊦ ∀t1 t2. (¬(t1 ∧ t2) ⇔ ¬t1 ∨ ¬t2) ∧ (¬(t1 ∨ t2) ⇔ ¬t1 ∧ ¬t2)
⊦ (∀f. Set.image f Set.∅ = Set.∅) ∧
∀f x s. Set.image f (Set.insert x s) = Set.insert (f x) (Set.image f s)
⊦ Set.size Set.∅ = 0 ∧
∀x s.
Set.finite s ⇒
Set.size (Set.insert x s) =
if Set.∈ x s then Set.size s else suc (Set.size s)
⊦ (∀m. m ≤ 0 ⇔ m = 0) ∧ ∀m n. m ≤ suc n ⇔ m = suc n ∨ m ≤ n
⊦ ∀t. ((T ⇔ t) ⇔ t) ∧ ((t ⇔ T) ⇔ t) ∧ ((F ⇔ t) ⇔ ¬t) ∧ ((t ⇔ F) ⇔ ¬t)
⊦ ∀P.
P Set.∅ ∧
(∀x s. P s ∧ ¬Set.∈ x s ∧ Set.finite s ⇒ P (Set.insert x s)) ⇒
∀s. Set.finite s ⇒ P s
⊦ ∀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 ∨ F ⇔ t) ∧ (t ∨ t ⇔ t)
⊦ ∀t. (T ⇒ t ⇔ t) ∧ (t ⇒ T ⇔ T) ∧ (F ⇒ t ⇔ T) ∧ (t ⇒ t ⇔ T) ∧ (t ⇒ F ⇔ ¬t)
⊦ (∀n. 0 + n = n) ∧ (∀m. m + 0 = m) ∧ (∀m n. suc m + n = suc (m + n)) ∧
∀m n. m + suc n = suc (m + n)
⊦ ∀p q r.
(p ∧ q ⇔ q ∧ p) ∧ ((p ∧ q) ∧ r ⇔ p ∧ q ∧ r) ∧ (p ∧ q ∧ r ⇔ q ∧ p ∧ r) ∧
(p ∧ p ⇔ p) ∧ (p ∧ p ∧ q ⇔ p ∧ q)
⊦ ∀p q r.
(p ∨ q ⇔ q ∨ p) ∧ ((p ∨ q) ∨ r ⇔ p ∨ q ∨ r) ∧ (p ∨ q ∨ r ⇔ q ∨ p ∨ r) ∧
(p ∨ p ⇔ p) ∧ (p ∨ p ∨ q ⇔ p ∨ q)