Package parser-all-thm: Properties of the whole stream parser
Information
name | parser-all-thm |
version | 1.90 |
description | Properties of the whole stream parser |
author | Joe Leslie-Hurd <joe@gilith.com> |
license | MIT |
provenance | HOL Light theory extracted on 2012-12-10 |
requires | bool function list natural option pair parser-all-def parser-comb parser-stream |
show | Data.Bool Data.List Data.Option Data.Pair Function Number.Natural Parser Parser.Stream |
Files
- Package tarball parser-all-thm-1.90.tgz
- Theory source file parser-all-thm.thy (included in the package tarball)
Theorems
⊦ ∀p s. length (parseStream p s) ≤ length s
⊦ ∀f p. parseStream (map f p) = map f ∘ parseStream p
⊦ ∀p e l.
inverse p e ⇒ parseStream p (fromList (concat (map e l))) = fromList l
⊦ ∀p e x s.
inverse p e ⇒ parseStream p (append (e x) s) = cons x (parseStream p s)
⊦ ∀p e s.
strongInverse p e ⇒
case toList (parseStream p s) of
none → ⊤
| some l → toList s = some (concat (map e l))
External Type Operators
- →
- bool
- Data
- List
- list
- Option
- option
- Pair
- ×
- List
- Number
- Natural
- natural
- Natural
- Parser
- parser
- Stream
- stream
External Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∨
- ¬
- ⊥
- ⊤
- List
- ::
- @
- []
- concat
- map
- Option
- case
- none
- some
- Pair
- ,
- Bool
- Function
- ∘
- Number
- Natural
- ≤
- suc
- zero
- Natural
- Parser
- destParser
- inverse
- map
- parse
- parseStream
- strongInverse
- Stream
- append
- cons
- eof
- error
- fromList
- isProperSuffix
- isSuffix
- length
- map
- toList
Assumptions
⊦ ⊤
⊦ length eof = 0
⊦ length error = 0
⊦ concat [] = []
⊦ toList error = none
⊦ ∀t. t ⇒ t
⊦ ∀n. 0 ≤ n
⊦ ∀n. n ≤ n
⊦ ⊥ ⇔ ∀p. p
⊦ toList eof = some []
⊦ ∀x. ¬isProperSuffix x x
⊦ (¬) = λp. p ⇒ ⊥
⊦ ∀t. (λx. t x) = t
⊦ (∀) = λp. p = λx. ⊤
⊦ ∀a. ¬(some a = none)
⊦ ∀t. ⊥ ⇒ t ⇔ ⊤
⊦ ∀t. ⊤ ⇒ t ⇔ t
⊦ ∀t. t ⇒ ⊤ ⇔ ⊤
⊦ ∀s. append [] s = s
⊦ ∀f. map f [] = []
⊦ ∀f. map f eof = eof
⊦ ∀f. map f error = error
⊦ ∀p. parseStream p eof = eof
⊦ ∀p. parseStream p error = error
⊦ ∀p. parse p eof = none
⊦ ∀p. parse p error = none
⊦ ∀l. fromList l = append l eof
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀b f. case b f none = b
⊦ ∀p x. p x ⇒ p ((select) p)
⊦ ∀x y. x = y ⇔ y = x
⊦ ∀a s. length (cons a s) = suc (length s)
⊦ ∀x. x = none ∨ ∃a. x = some a
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀a a'. some a = some a' ⇔ a = a'
⊦ ∀m n. suc m ≤ suc n ⇔ m ≤ n
⊦ ∀h t. concat (h :: t) = h @ concat t
⊦ ∀x y. isSuffix x y ⇒ length x ≤ length y
⊦ ∀b f a. case b f (some a) = f a
⊦ ∀f g x. (f ∘ g) x = f (g x)
⊦ ∀l. l = [] ∨ ∃h t. l = h :: t
⊦ ∀f g. (∀x. f x = g x) ⇔ f = g
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀s s'. isSuffix s s' ⇔ s = s' ∨ isProperSuffix s s'
⊦ ∀f. ∃fn. ∀a b. fn (a, b) = f a b
⊦ ∀p a s. parse p (cons a s) = destParser p a s
⊦ ∀h t s. append (h :: t) s = cons h (append t s)
⊦ ∀m n p. m ≤ n ∧ n ≤ p ⇒ m ≤ p
⊦ ∀x y z. append (x @ y) z = append x (append y z)
⊦ ∀a s.
toList (cons a s) =
case toList s of none → none | some l → some (a :: l)
⊦ ∀l s.
toList (append l s) =
case toList s of none → none | some ls → some (l @ ls)
⊦ ∀f h t. map f (h :: t) = f h :: map f t
⊦ ∀f a s. map f (cons a s) = cons (f a) (map f s)
⊦ ∀s a s'. isProperSuffix s (cons a s') ⇔ s = s' ∨ isProperSuffix s s'
⊦ ∀x. x = error ∨ x = eof ∨ ∃a0 a1. x = cons a0 a1
⊦ ∀p. (∀x. (∀y. isProperSuffix y x ⇒ p y) ⇒ p x) ⇒ ∀x. p x
⊦ ∀p q. (∀x. p x ∧ q x) ⇔ (∀x. p x) ∧ ∀x. q x
⊦ ∀p. p [] ∧ (∀h t. p t ⇒ p (h :: t)) ⇒ ∀l. p l
⊦ ∀a b a' b'. (a, b) = (a', b') ⇔ a = a' ∧ b = b'
⊦ ∀p e. inverse p e ⇔ ∀x s. parse p (append (e x) s) = some (x, s)
⊦ ∀p s.
parse p s = none ∨
∃b s'. parse p s = some (b, s') ∧ isProperSuffix s' s
⊦ ∀p a s.
destParser p a s = none ∨
∃b s'. destParser p a s = some (b, s') ∧ isSuffix s' s
⊦ ∀p e.
strongInverse p e ⇔
inverse p e ∧ ∀s x s'. parse p s = some (x, s') ⇒ s = append (e x) s'
⊦ ∀p a s.
parseStream p (cons a s) =
case destParser p a s of
none → error
| some (b, s') → cons b (parseStream p s')
⊦ ∀f p a s.
destParser (map f p) a s =
case destParser p a s of none → none | some (b, s') → some (f b, s')