Constituency trees #
A constituency tree over a category type C and a word type W is a rose tree whose nodes carry
labels: a terminal carries a category and a word, an internal node a category, the mother of an
adjunction a category too, marking it a further segment of its host's category rather than a
projection above it, and the two nodes of Heim and Kratzer's trace theory of movement, an indexed
trace and an indexed binder over a body, carry a category each. Type-driven interpretation reads the
tree with C = Unit; structural operations on parse trees read it with a category system such as
PhraseStructure.Cat. Positions, subtrees, replacement and the frontier are those of the rose tree.
Main declarations #
PhraseStructure.Tree.Label,PhraseStructure.Tree: the node labels and the trees over them, with the pattern-matchable constructorsterminal,node,adjoin,trace,bindand the category-freeleaf,bin,tr,binder.PhraseStructure.Tree.Label.Licenses,PhraseStructure.Tree.IsWellFormed: terminals and traces are leaves and binders have one body.PhraseStructure.Tree.rec': induction over the five shapes, with a case for ill-formed nodes.PhraseStructure.Tree.terminals,yield,cats,map,freeIndices,leafSubst.PhraseStructure.Tree.positionedTerminals: the terminals with their positions, in the order of the yield, which is precedence (pairwise_precedes_positionedTerminals).
Implementation notes #
Daughters are a List, so a node is binary or n-ary by its list and sibling order is linear
precedence. Only the trace theory of movement is expressible: a copy or a multidominance
representation is not a tree over these labels. Ill-formed label and arity combinations, such as a
terminal with daughters, are expressible; IsWellFormed excludes them where a theorem needs it, and
the interpreter denotes them none. The mark on the mother of an adjunction follows May's and
Chomsky's segment theory, in which adjunction extends its host's category rather than projecting a
new one, and bare phrase structure labels the adjunction structure apart from a projection. That
each binder binds a trace of its index is a property of a tree, not a guarantee of the type, and
interpretation does not read the category on a binder.
Tree C W abbreviates RoseTree (Label C W), so the rose tree's navigation (children,
subtreeAt) returns RoseTree (Label C W). Dot notation for this file's operations does not
resolve on those results, so write Tree.cat s, and write constructor patterns on them as
Tree.node: an anonymous .node would elaborate as RoseTree.node, which matches any label.
References #
A node of a constituency tree carries a terminal's category and word, an internal node's category, the category of an adjunction structure, or a trace's or binder's index and category.
- terminal {C : Type u_1} {W : Type u_2} : C → W → Label C W
- node {C : Type u_1} {W : Type u_2} : C → Label C W
- segment
{C : Type u_1}
{W : Type u_2}
: C → Label C W
segment clabels the mother of an adjunction, a segment of the categorycof its host daughter, not a projection above it. - trace {C : Type u_1} {W : Type u_2} : ℕ → C → Label C W
- bind {C : Type u_1} {W : Type u_2} : ℕ → C → Label C W
Instances For
Equations
- One or more equations did not get rendered due to their size.
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.terminal a a_1) (PhraseStructure.Tree.Label.node a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.terminal a a_1) (PhraseStructure.Tree.Label.segment a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.terminal a a_1) (PhraseStructure.Tree.Label.trace a_2 a_3) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.terminal a a_1) (PhraseStructure.Tree.Label.bind a_2 a_3) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.node a) (PhraseStructure.Tree.Label.terminal a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.node a) (PhraseStructure.Tree.Label.node b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.node a) (PhraseStructure.Tree.Label.segment a_1) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.node a) (PhraseStructure.Tree.Label.trace a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.node a) (PhraseStructure.Tree.Label.bind a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.segment a) (PhraseStructure.Tree.Label.terminal a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.segment a) (PhraseStructure.Tree.Label.node a_1) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.segment a) (PhraseStructure.Tree.Label.segment b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.segment a) (PhraseStructure.Tree.Label.trace a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.segment a) (PhraseStructure.Tree.Label.bind a_1 a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.trace a a_1) (PhraseStructure.Tree.Label.terminal a_2 a_3) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.trace a a_1) (PhraseStructure.Tree.Label.node a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.trace a a_1) (PhraseStructure.Tree.Label.segment a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.trace a a_1) (PhraseStructure.Tree.Label.bind a_2 a_3) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.bind a a_1) (PhraseStructure.Tree.Label.terminal a_2 a_3) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.bind a a_1) (PhraseStructure.Tree.Label.node a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.bind a a_1) (PhraseStructure.Tree.Label.segment a_2) = isFalse ⋯
- PhraseStructure.Tree.instDecidableEqLabel.decEq (PhraseStructure.Tree.Label.bind a a_1) (PhraseStructure.Tree.Label.trace a_2 a_3) = isFalse ⋯
Instances For
Equations
- PhraseStructure.Tree.instReprLabel = { reprPrec := PhraseStructure.Tree.instReprLabel.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
The category a label carries.
Equations
- (PhraseStructure.Tree.Label.terminal c a).cat = c
- (PhraseStructure.Tree.Label.node c).cat = c
- (PhraseStructure.Tree.Label.segment c).cat = c
- (PhraseStructure.Tree.Label.trace a c).cat = c
- (PhraseStructure.Tree.Label.bind a c).cat = c
Instances For
A terminal label carries a category and a word; other labels carry none.
Equations
- (PhraseStructure.Tree.Label.terminal c w).terminal? = some (c, w)
- x✝.terminal? = none
Instances For
mapWord f relabels the word of a terminal label.
Equations
- PhraseStructure.Tree.Label.mapWord f (PhraseStructure.Tree.Label.terminal c a) = PhraseStructure.Tree.Label.terminal c (f a)
- PhraseStructure.Tree.Label.mapWord f (PhraseStructure.Tree.Label.node c) = PhraseStructure.Tree.Label.node c
- PhraseStructure.Tree.Label.mapWord f (PhraseStructure.Tree.Label.segment c) = PhraseStructure.Tree.Label.segment c
- PhraseStructure.Tree.Label.mapWord f (PhraseStructure.Tree.Label.trace a c) = PhraseStructure.Tree.Label.trace a c
- PhraseStructure.Tree.Label.mapWord f (PhraseStructure.Tree.Label.bind a c) = PhraseStructure.Tree.Label.bind a c
Instances For
A label licenses its daughters when a terminal or a trace has none and a binder has one.
Equations
- (PhraseStructure.Tree.Label.terminal a a_1).Licenses x✝ = (x✝ = [])
- (PhraseStructure.Tree.Label.node a).Licenses x✝ = True
- (PhraseStructure.Tree.Label.segment a).Licenses x✝ = True
- (PhraseStructure.Tree.Label.trace a a_1).Licenses x✝ = (x✝ = [])
- (PhraseStructure.Tree.Label.bind a a_1).Licenses x✝ = (x✝.length = 1)
Instances For
Equations
- (PhraseStructure.Tree.Label.terminal a a_1).instDecidableLicenses x✝ = PhraseStructure.Tree.Label.instDecidableLicenses._aux_1 a a_1 x✝
- (PhraseStructure.Tree.Label.node a).instDecidableLicenses x✝ = { decide := true, reflects_decide := ⋯ }
- (PhraseStructure.Tree.Label.segment a).instDecidableLicenses x✝ = { decide := true, reflects_decide := ⋯ }
- (PhraseStructure.Tree.Label.trace a a_1).instDecidableLicenses x✝ = PhraseStructure.Tree.Label.instDecidableLicenses._aux_5 a a_1 x✝
- (PhraseStructure.Tree.Label.bind a a_1).instDecidableLicenses x✝ = { decide := x✝.length.beq 1, reflects_decide := ⋯ }
A label is phrasal when it puts a category over daughters, as a node's or an adjunction mother's does.
Equations
- (PhraseStructure.Tree.Label.node a).IsPhrase = True
- (PhraseStructure.Tree.Label.segment a).IsPhrase = True
- x✝.IsPhrase = False
Instances For
Equations
- One or more equations did not get rendered due to their size.
A label is a segment label when it marks the mother of an adjunction.
Equations
- (PhraseStructure.Tree.Label.segment a).IsSegment = True
- x✝.IsSegment = False
Instances For
Equations
- One or more equations did not get rendered due to their size.
In a constituency tree each node is labelled by a Tree.Label.
Equations
- PhraseStructure.Tree C W = RoseTree (PhraseStructure.Tree.Label C W)
Instances For
The shapes #
terminal c w is the word w under category c.
Equations
Instances For
bind n c t is a binder of index n over t.
Equations
- PhraseStructure.Tree.bind n c t = RoseTree.node (PhraseStructure.Tree.Label.bind n c) [t]
Instances For
Equations
Instances For
Equations
- t₁.bin t₂ = PhraseStructure.Tree.node () [t₁, t₂]
Instances For
Equations
Instances For
Equations
- PhraseStructure.Tree.binder n t = PhraseStructure.Tree.bind n () t
Instances For
A tree is well formed when every node has the daughters its label licenses.
Equations
Instances For
Equations
- t.instDecidableIsWellFormed = { decide := decide (∀ e ∈ RoseTree.localTrees t, e.1.Licenses e.2), reflects_decide := ⋯ }
Induction #
Induction over the five shapes, with the hypothesis at every daughter, and a case for the nodes whose daughters their label does not license.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Relabelling the words #
The frontier #
The terminals, left to right, each with its category, are the word-bearing leaves.
Equations
- t.terminals = List.filterMap PhraseStructure.Tree.Label.terminal? (RoseTree.leafList t)
Instances For
Categories and subtrees #
The categories at the nodes, in pre-order.
Equations
- t.cats = List.map PhraseStructure.Tree.Label.cat (RoseTree.values t)
Instances For
Free traces #
The free indices of a tree are the indices of its traces, less those a dominating binder of the same index binds.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- t.instDecidableClosedOfDecidableEq = { decide := decide (t.freeIndices.val = ∅.val), reflects_decide := ⋯ }
Word substitution #
Positions #
A tree takes Gorn addresses as a rose tree, and with them the dominance order on its positions
and, in Syntax/Command.lean, the command relations.
Positions of the terminals #
The terminals, paired with their positions, are the word-bearing leaves, so the order of the
yield is precedence (RoseTree.pairwise_precedes_positionedLeaves).
The terminals, left to right, each paired with its position.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Forgetting the positions leaves the terminals.
Each listed position holds its terminal.
Every terminal position is listed.
The terminal positions, in the order of the yield, ascend in precedence.