Documentation

Linglib.Core.Tree

Trees #

Unified tree type parameterized by node labels (C) and terminal content (W).

Tree C W — The Y-Model Tree #

N-ary branching with categories on every node. Supports both:

Parameterized by category type C (UD tags, CCG categories, feature bundles, Unit for unlabeled, ...) and terminal type W.

Instantiations #

Cat — Default Category System #

Grounded in Universal Dependencies UPOS. Word-level categories via head : UPOS → Cat, phrasal via proj : UPOS → Cat, plus S and CP.

inductive Core.Tree.Cat :

Default syntactic category system grounded in Universal Dependencies UPOS (@cite{de-marneffe-zeman-2021}).

  • head pos — word-level (terminal): wraps a UPOS tag directly
  • proj pos — maximal X-bar projection of a UPOS head
  • S — sentence/clause (not a projection of a single lexical head)
  • CP — complementizer phrase

Phrasal categories are derived systematically: NP = proj .NOUN, VP = proj .VERB, DP = proj .DET, ConjP = proj .CCONJ, etc.

This is one possible instantiation of Tree's C parameter. Framework-specific category systems (CCG functors, Minimalist feature bundles, etc.) can be used instead.

Instances For
    def Core.Tree.instDecidableEqCat.decEq (x✝ x✝¹ : Cat) :
    Decidable (x✝ = x✝¹)
    Equations
    Instances For
      Equations
      Instances For
        Equations
        @[reducible, match_pattern, inline]
        Equations
        Instances For
          @[reducible, match_pattern, inline]
          Equations
          Instances For
            @[reducible, match_pattern, inline]
            Equations
            Instances For
              @[reducible, match_pattern, inline]
              Equations
              Instances For
                @[reducible, match_pattern, inline]
                Equations
                Instances For
                  @[reducible, match_pattern, inline]
                  Equations
                  Instances For
                    @[reducible, match_pattern, inline]
                    Equations
                    Instances For
                      @[reducible, match_pattern, inline]
                      Equations
                      Instances For
                        @[reducible, match_pattern, inline]
                        Equations
                        Instances For
                          @[reducible, match_pattern, inline]
                          Equations
                          Instances For
                            @[reducible, match_pattern, inline]
                            Equations
                            Instances For
                              @[reducible, match_pattern, inline]
                              Equations
                              Instances For
                                @[reducible, match_pattern, inline]
                                Equations
                                Instances For
                                  @[reducible, match_pattern, inline]
                                  Equations
                                  Instances For
                                    @[reducible, match_pattern, inline]
                                    Equations
                                    Instances For
                                      @[reducible, match_pattern, inline]
                                      Equations
                                      Instances For
                                        @[reducible, match_pattern, inline]
                                        Equations
                                        Instances For
                                          @[reducible, match_pattern, inline]
                                          Equations
                                          Instances For
                                            @[reducible, match_pattern, inline]
                                            Equations
                                            Instances For
                                              @[reducible, match_pattern, inline]
                                              Equations
                                              Instances For
                                                @[reducible, match_pattern, inline]
                                                Equations
                                                Instances For
                                                  inductive Core.Tree.Tree (C W : Type) :

                                                  Framework-neutral tree, parameterized by node label type C and terminal word type W.

                                                  • terminal c w — leaf carrying category c and word w
                                                  • node c cs — internal node with category c and children cs
                                                  • trace n c — movement trace with index n and category c
                                                  • bind n c body — λ-abstraction with index n, category c, scope body

                                                  The node constructor takes a List of children, subsuming both binary branching (for Heim & Kratzer composition) and n-ary structure (for Katzir's deletion operation). Binary nodes are node c [l, r].

                                                  trace and bind support Quantifier Raising and variable binding. Frameworks without movement (CCG, HPSG) simply never construct these.

                                                  For category-free trees (C = Unit), use the convenience constructors leaf, bin, un, tr, binder which hide the Unit parameter.

                                                  Instances For
                                                    partial def Core.Tree.instReprTree.repr {C✝ W✝ : Type} [Repr C✝] [Repr W✝] :
                                                    Tree C✝ W✝NatStd.Format
                                                    instance Core.Tree.instReprTree {C✝ W✝ : Type} [Repr C✝] [Repr W✝] :
                                                    Repr (Tree C✝ W✝)
                                                    Equations
                                                    @[reducible, match_pattern, inline]
                                                    abbrev Core.Tree.Tree.leaf {W : Type} (w : W) :
                                                    Equations
                                                    Instances For
                                                      @[reducible, match_pattern, inline]
                                                      abbrev Core.Tree.Tree.un {W : Type} (t : Tree Unit W) :
                                                      Equations
                                                      Instances For
                                                        @[reducible, match_pattern, inline]
                                                        abbrev Core.Tree.Tree.bin {W : Type} (t1 t2 : Tree Unit W) :
                                                        Equations
                                                        Instances For
                                                          @[reducible, match_pattern, inline]
                                                          abbrev Core.Tree.Tree.tr {W : Type} (n : Nat) :
                                                          Equations
                                                          Instances For
                                                            @[reducible, match_pattern, inline]
                                                            abbrev Core.Tree.Tree.binder {W : Type} (n : Nat) (body : Tree Unit W) :
                                                            Equations
                                                            Instances For
                                                              def Core.Tree.Tree.cat {C W : Type} :
                                                              Tree C WC

                                                              Category label of the root node. Total: every constructor carries a category (including bind, where it labels the result of PA).

                                                              Equations
                                                              Instances For
                                                                def Core.Tree.Tree.beq {C W : Type} [BEq C] [BEq W] :
                                                                Tree C WTree C WBool

                                                                Structural equality for trees (mutual recursion through List).

                                                                Equations
                                                                Instances For
                                                                  def Core.Tree.Tree.size {C W : Type} :
                                                                  Tree C WNat

                                                                  Number of nodes in the tree.

                                                                  Equations
                                                                  Instances For
                                                                    def Core.Tree.Tree.containsCat {C W : Type} [BEq C] (target : C) :
                                                                    Tree C WBool

                                                                    Whether a category appears anywhere in the tree.

                                                                    Equations
                                                                    Instances For
                                                                      def Core.Tree.Tree.leafSubst {C W : Type} [BEq C] [BEq W] (target replacement : W) (c : C) :
                                                                      Tree C WTree C W

                                                                      Substitute all terminals of category c carrying word target with replacement. This is the most common structural operation: replacing one scalar item with another of the same category.

                                                                      Equations
                                                                      Instances For
                                                                        def Core.Tree.Tree.leafSubst.leafSubstList {C W : Type} [BEq C] [BEq W] (target replacement : W) (c : C) :
                                                                        List (Tree C W)List (Tree C W)
                                                                        Equations
                                                                        Instances For