CCG categories #
The categories of combinatory categorial grammar are built from atoms by a rightward and a
leftward slash, each slash carrying one of Baldridge's modalities. Every category is uniquely an
atom, its target, followed by a sequence of arguments, slash–category pairs; Kuhlmann, Koller
and Satta write it A|ₘXₘ ⋯ |₁X₁, and the composition rules of every CCG formalism have the
form X/Y Yβ ⇒ Xβ over an argument sequence β. Categories are stated over an arbitrary type
α of atoms, so a grammar with featured atoms instantiates its own inventory.
Main definitions #
CCG.Modality: the slash modalities, a bounded order withdot = ⊥,star = ⊤, anddiamondandcrossincomparable.CCG.Cat: categories over a typeαof atoms.CCG.Cat.Arg,CCG.Cat.pushArgs: an argument, and the categoryxβ.CCG.Cat.target,CCG.Cat.args: the target and the arguments of a category.CCG.Cat.equivTargetArgs: a category is its target together with its arguments.CCG.Cat.count: the count of an atom.
Main statements #
CCG.Cat.atom_pushArgs_eq_iff: a category isaβexactly whenais its target andβits arguments.
Notation #
X / Y,X \ Y: slashes with the unrestricted modalitydot, written unannotated as in Steedman's presentation.X /⋄ Y,X \⋄ Y,X /× Y,X \× Y,X /⋆ Y,X \⋆ Y: slashes with the annotated modality.
All are scoped to the CCG namespace. Because / overloads division, categories are written
fully parenthesized ((S \ NP) / NP).
References #
Slash modalities #
The modality a slash carries, determining which rule classes it licenses. The order is
reverse inclusion of licenses, s ≤ m iff s licenses every rule class m does, so composition
gates on s ≤ diamond (harmonic) and s ≤ cross (crossing), while application is licensed by
every modality (s ≤ ⊤).
- dot : Modality
The unrestricted modality, written as an unannotated slash, combining by any rule.
- diamond : Modality
The order-preserving
⋄, licensing application and harmonic composition. - cross : Modality
The permuting
×, licensing application and crossing composition. - star : Modality
The modality
⋆, licensing application only.
Instances For
Equations
- CCG.instDecidableEqModality x✝ y✝ = if h : x✝.ctorIdx = y✝.ctorIdx then isTrue ⋯ else isFalse ⋯
Equations
- CCG.instReprModality.repr CCG.Modality.dot prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "CCG.Modality.dot")).group prec✝
- CCG.instReprModality.repr CCG.Modality.diamond prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "CCG.Modality.diamond")).group prec✝
- CCG.instReprModality.repr CCG.Modality.cross prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "CCG.Modality.cross")).group prec✝
- CCG.instReprModality.repr CCG.Modality.star prec✝ = Repr.addAppParen (Std.Format.nest (if prec✝ ≥ 1024 then 1 else 2) (Std.Format.text "CCG.Modality.star")).group prec✝
Instances For
Equations
- CCG.instReprModality = { reprPrec := CCG.instReprModality.repr }
Equations
- CCG.instFintypeModality = { elems := { val := ↑CCG.Modality.enumList, nodup := CCG.Modality.enumList_nodup }, complete := CCG.instFintypeModality._proof_1 }
Equations
- CCG.Modality.instLE = { le := fun (a b : CCG.Modality) => a = CCG.Modality.dot ∨ a = b ∨ b = CCG.Modality.star }
Equations
- a.instDecidableLE b = { decide := decide (a = CCG.Modality.dot) || decide (a = b ∨ b = CCG.Modality.star), reflects_decide := ⋯ }
Equations
- One or more equations did not get rendered due to their size.
Equations
- CCG.Modality.instBoundedOrder = { top := CCG.Modality.star, le_top := CCG.Modality.instBoundedOrder._proof_1, bot := CCG.Modality.dot, bot_le := CCG.Modality.instBoundedOrder._proof_2 }
The unrestricted modality licenses every rule class.
Categories #
CCG categories over a type α of atomic categories, built from atoms by directional
slashes that each carry a Modality.
- atom
{α : Type u_1}
: α → Cat α
An atomic category.
- rslash
{α : Type u_1}
: Cat α → Modality → Cat α → Cat α
X/ₘYlooks right for aYto give anX, at modalitym. - lslash
{α : Type u_1}
: Cat α → Modality → Cat α → Cat α
X\ₘYlooks left for aYto give anX, at modalitym.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- CCG.instReprCat = { reprPrec := CCG.instReprCat.repr }
Equations
- One or more equations did not get rendered due to their size.
- CCG.instDecidableEqCat.decEq (CCG.Cat.atom a) (CCG.Cat.atom b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- CCG.instDecidableEqCat.decEq (CCG.Cat.atom a) (a_1.rslash a_2 a_3) = isFalse ⋯
- CCG.instDecidableEqCat.decEq (CCG.Cat.atom a) (a_1.lslash a_2 a_3) = isFalse ⋯
- CCG.instDecidableEqCat.decEq (a.rslash a_1 a_2) (CCG.Cat.atom a_3) = isFalse ⋯
- CCG.instDecidableEqCat.decEq (a.rslash a_1 a_2) (a_3.lslash a_4 a_5) = isFalse ⋯
- CCG.instDecidableEqCat.decEq (a.lslash a_1 a_2) (CCG.Cat.atom a_3) = isFalse ⋯
- CCG.instDecidableEqCat.decEq (a.lslash a_1 a_2) (a_3.rslash a_4 a_5) = isFalse ⋯
Instances For
Equations
- CCG.«term_/_» = Lean.ParserDescr.trailingNode `CCG.«term_/_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "/") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_\_» = Lean.ParserDescr.trailingNode `CCG.«term_\_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "\\") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_/⋄_» = Lean.ParserDescr.trailingNode `CCG.«term_/⋄_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "/⋄") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_\⋄_» = Lean.ParserDescr.trailingNode `CCG.«term_\⋄_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "\\⋄") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_/×_» = Lean.ParserDescr.trailingNode `CCG.«term_/×_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "/×") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_\×_» = Lean.ParserDescr.trailingNode `CCG.«term_\×_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "\\×") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_/⋆_» = Lean.ParserDescr.trailingNode `CCG.«term_/⋆_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "/⋆") (Lean.ParserDescr.cat `term 0))
Instances For
Equations
- CCG.«term_\⋆_» = Lean.ParserDescr.trailingNode `CCG.«term_\⋆_» 60 0 (Lean.ParserDescr.binary `andthen (Lean.ParserDescr.symbol "\\⋆") (Lean.ParserDescr.cat `term 0))
Instances For
Targets and arguments #
Equations
- CCG.Cat.instReprArg = { reprPrec := CCG.Cat.instReprArg.repr }
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
x.pushArgs β is the category xβ, which adds the arguments β to x innermost first, so
that x.pushArgs [a₁, a₂] has a₂ as its outermost argument.
Equations
- x.pushArgs β = List.foldl CCG.Cat.push x β
Instances For
The arguments of a category, innermost first.
Equations
Instances For
Every category is uniquely its target followed by its arguments.
Equations
- CCG.Cat.equivTargetArgs = { toFun := fun (c : CCG.Cat α) => (c.target, c.args), invFun := fun (p : α × List (CCG.Cat.Arg α)) => (CCG.Cat.atom p.1).pushArgs p.2, left_inv := ⋯, right_inv := ⋯ }
Instances For
Type-raising #
Type-raising is morpholexical in [Ste19], the work of case morphemes rather than a syntactic rule, so these build the categories that raised lexical entries carry.
forwardTypeRaise x t is t / (t \ x), the forward-raised (>T) category of x at
target t.
Equations
- x.forwardTypeRaise t = t.rslash CCG.Modality.dot (t.lslash CCG.Modality.dot x)
Instances For
backwardTypeRaise x t is t \ (t / x), the backward-raised (<T) category of x at
target t.
Equations
- x.backwardTypeRaise t = t.lslash CCG.Modality.dot (t.rslash CCG.Modality.dot x)
Instances For
The count invariant #
The count of the atom a in a category ([vB86]) adds 1 for each occurrence in
result position and subtracts 1 for each occurrence in argument position, so that every
combinatory rule preserves it (CCG.Rule.count_eq).
Equations
- CCG.Cat.count a (CCG.Cat.atom a_1) = if a_1 = a then 1 else 0
- CCG.Cat.count a (x_1.rslash a_1 a_2) = CCG.Cat.count a x_1 - CCG.Cat.count a a_2
- CCG.Cat.count a (x_1.lslash a_1 a_2) = CCG.Cat.count a x_1 - CCG.Cat.count a a_2