The derivation measure of a probabilistic context-free grammar #
A PCFG is a multitype Galton–Watson process whose types are the symbols: a terminal has no
offspring, and a nonterminal's offspring is the right-hand side of a rule at it chosen with its
weight. The law of the family tree is the law of the derivation tree, and the product of rule
weights PCFG.derivProb is the Galton–Watson weight of the tree, so it is derived from the
generation process rather than stipulated. Total mass one is tightness in the sense of
[BT73] and [Chi99], consistency in older terminology: the grammar almost surely
produces a finite derivation from every symbol.
Main definitions #
PCFG.galtonWatson: the offspring kernel of a PCFG.PCFG.derivationMeasure: the law of the derivation tree at each symbol, as a kernel.PCFG.IsTight: total mass one at every symbol.
Main results #
PCFG.galtonWatson_weight: the Galton–Watson weight of a tree isderivProb.PCFG.isMarkovKernel_galtonWatson: when every nonterminal has a rule, the offspring kernel is Markov.PCFG.derivationMeasure_singleton: a tree rooted atshas probabilityderivProbunder the derivation measure ats, and trees rooted elsewhere have probability0.PCFG.derivationMeasure_apply_univ_le_one: the derivation measure is a sub-probability kernel;PCFG.isTight_iffsays it is Markov exactly when the grammar is tight.
References #
Equations
Equations
The rule distribution at nonterminal A, as a measure on rules.
Equations
- W.ruleMeasure A = ∑ r ∈ G.rules with r.input = A, W.weight r • MeasureTheory.Measure.dirac r
Instances For
The offspring of a symbol: none at a terminal, and at a nonterminal the right-hand side of a rule chosen with its weight.
Equations
- W.offspring (Symbol.terminal t) = MeasureTheory.Measure.dirac []
- W.offspring (Symbol.nonterminal A) = MeasureTheory.Measure.map ContextFreeRule.output (W.ruleMeasure A)
Instances For
The branching process of a PCFG: the offspring kernel on symbols.
Equations
- W.galtonWatson = ProbabilityTheory.Kernel.ofFunOfCountable W.offspring
Instances For
A grammar with a rule at every nonterminal has a Markov offspring kernel.
The Galton–Watson weight of a derivation tree is the product of its rule weights.
The law of the derivation tree at each symbol: the law of the family tree of the grammar's branching process.
Equations
Instances For
Under the derivation measure at s, a tree has probability derivProb when rooted at s
and 0 otherwise.
The derivation measure is a sub-probability measure at every symbol.
A PCFG is tight when the derivation measure has total mass one at every symbol: the grammar almost surely produces a finite derivation from every nonterminal. Booth and Thompson call this consistency.
Equations
- W.IsTight = ∀ (s : Symbol T G.NT), ProbabilityTheory.GaltonWatson.extinctionProb W.galtonWatson s = 1