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