Package parser-comb-def: Definition of stream parser combinators

Information

nameparser-comb-def
version1.90
descriptionDefinition of stream parser combinators
authorJoe Leslie-Hurd <joe@gilith.com>
licenseMIT
provenanceHOL Light theory extracted on 2015-03-05
checksume7480a2a14977821a61f6629f6cd3ba5e6efbe0e
requiresbase
parser-stream
showData.Bool
Data.List
Data.Option
Data.Pair
Parser
Parser.Stream

Files

Defined Type Operator

Defined Constants

Theorems

any = some (Function.const )

none = token (Function.const none)

a. mk (dest a) = a

p. apply p eof = none

p. apply p error = none

f. token f = mk (token.prs f)

p. sequence p = mk (sequence.prs p)

r. invariant r dest (mk r) = r

p1 p2. orelse p1 p2 = mk (orelse.prs p1 p2)

p f. mapPartial p f = mk (mapPartial.prs p f)

p. some p = token (λx. if p x then some x else none)

p f. map p f = mapPartial p (λx. some (f x))

p x xs. apply p (cons x xs) = dest p x xs

p f. filter p f = mapPartial p (λx. if f x then some x else none)

p1 p2. pair p1 p2 = sequence (map p1 (λx. map p2 (λy. (x, y))))

f x xs.
    token.prs f x xs = case f x of none none | some y some (y, xs)

p e. inverse p e x xs. apply p (append (e x) xs) = some (x, xs)

p1 p2 x xs.
    orelse.prs p1 p2 x xs =
    case dest p1 x xs of none dest p2 x xs | some yys some yys

p.
    invariant p
    x xs. case p x xs of none | some (y, ys) isSuffix ys xs

p x xs.
    sequence.prs p x xs =
    case dest p x xs of none none | some (q, ys) apply q ys

p e.
    strongInverse p e
    inverse p e
    xs y ys. apply p xs = some (y, ys) xs = append (e y) ys

p f x xs.
    mapPartial.prs p f x xs =
    case dest p x xs of
      none none
    | some (y, ys) case f y of none none | some z some (z, ys)

External Type Operators

External Constants

Assumptions

() = λp. p ((select) p)

t. (x. t) t

() = λp. p = λx.

() = λp q. p q p

b f. case b f none = b

() = λp q. (λf. f p q) = λf. f

() = λp. q. (x. p x q) q

e b f.
    fn. fn error = e fn eof = b x xs. fn (cons x xs) = f x xs (fn xs)