Package parser-fold-thm: Properties of the fold parsers
Information
name | parser-fold-thm |
version | 1.3 |
description | Properties of the fold parsers |
author | Joe Leslie-Hurd <joe@gilith.com> |
license | MIT |
provenance | HOL Light theory extracted on 2015-03-06 |
checksum | cfb4489e563ba9182bc6dba93ec3e74907d9bdb3 |
requires | base parser-comb parser-fold-def parser-stream |
show | Data.Bool Data.Option Data.Pair Data.Sum Parser Parser.Stream |
Files
- Package tarball parser-fold-thm-1.3.tgz
- Theory source file parser-fold-thm.thy (included in the package tarball)
Theorems
⊦ ∀f s. invariant (fold.prs f s)
⊦ ∀f. fold f = Function.∘ mk (fold.prs f)
⊦ ∀f s. dest (fold f s) = fold.prs f s
⊦ ∀f s. apply (fold f s) = case none none (λx xs. fold.prs f s x xs)
External Type Operators
- →
- bool
- Data
- Option
- option
- Pair
- ×
- Sum
- +
- Option
- Parser
- parser
- Stream
- stream
External Constants
- =
- select
- Data
- Bool
- ∀
- ∧
- ⇒
- ∃
- ∨
- ⊤
- Option
- case
- none
- some
- Pair
- ,
- Sum
- case
- left
- right
- Bool
- Function
- Function.∘
- Parser
- apply
- dest
- fold
- fold.prs
- invariant
- mk
- Stream
- case
- cons
- eof
- error
- isProperSuffix
- isSuffix
Assumptions
⊦ ⊤
⊦ ∀xs. isSuffix xs xs
⊦ ∀t. (∀x. t) ⇔ t
⊦ ∀t. (λx. t x) = t
⊦ (∀) = λp. p = λx. ⊤
⊦ ∀t. ⊤ ⇒ t ⇔ t
⊦ ∀t. t ⇒ ⊤ ⇔ ⊤
⊦ ∀p. apply p eof = none
⊦ ∀p. apply p error = none
⊦ (⇒) = λp q. p ∧ q ⇔ p
⊦ ∀b f. case b f none = b
⊦ ∀p x. p x ⇒ p ((select) p)
⊦ ∀x. ∃a b. x = (a, b)
⊦ ∀r. invariant r ⇔ dest (mk r) = r
⊦ ∀x y. x = y ⇔ y = x
⊦ ∀xs ys. isProperSuffix xs ys ⇒ isSuffix xs ys
⊦ ∀x. x = none ∨ ∃a. x = some a
⊦ ∀f s. fold f s = mk (fold.prs f s)
⊦ (∧) = λp q. (λf. f p q) = λf. f ⊤ ⊤
⊦ (∃) = λp. ∀q. (∀x. p x ⇒ q) ⇒ q
⊦ ∀b f a. case b f (some a) = f a
⊦ ∀f g a. case f g (left a) = f a
⊦ ∀f g b. case f g (right b) = g b
⊦ ∀f g x. Function.∘ f g x = f (g x)
⊦ ∀xs y ys. isProperSuffix xs (cons y ys) ⇔ isSuffix xs ys
⊦ ∀f g. (∀x. f x = g x) ⇔ f = g
⊦ ∀x. (∃a. x = left a) ∨ ∃b. x = right b
⊦ (∨) = λp q. ∀r. (p ⇒ r) ⇒ (q ⇒ r) ⇒ r
⊦ ∀f. ∃fn. ∀a b. fn (a, b) = f a b
⊦ ∀p x xs. apply p (cons x xs) = dest p x xs
⊦ ∀xs. xs = error ∨ xs = eof ∨ ∃x xt. xs = cons x xt
⊦ ∀p q. (∀x. p x ∧ q x) ⇔ (∀x. p x) ∧ ∀x. q x
⊦ ∀p. p error ∧ p eof ∧ (∀x xs. p xs ⇒ p (cons x xs)) ⇒ ∀xs. p xs
⊦ ∀p.
invariant p ⇔
∀x xs. case p x xs of none → ⊤ | some (y, ys) → isSuffix ys xs
⊦ ∀f s x xs.
fold.prs f s x xs =
case f x s of
none → none
| some y →
case y of
left z → some (z, xs)
| right t →
case xs of
error → none
| eof → none
| cons z zs → fold.prs f t z zs
⊦ (∀e b f. case e b f error = e) ∧ (∀e b f. case e b f eof = b) ∧
∀e b f x xs. case e b f (cons x xs) = f x xs