Documentation

Linglib.Core.Inheritance

Inheritance Networks #

Hudson's Word Grammar organizes all linguistic knowledge as networks of nodes connected by labeled directed links. @cite{hudson-2010}

Properties in WG are not key-value pairs attached to nodes — they ARE links between nodes. "Bird has wing" is a link labeled front-limb from bird to wing. IsA links form a taxonomy; properties flow down the taxonomy by default inheritance. The Best Fit Principle (§3.5) resolves conflicts: the most specific value (nearest ancestor in the isA chain) wins.

Hudson's five primitive relations (§3.2.5) #

(Hudson also lists argument and value as primitives for defining relational concepts; these are modeled here as prop links with appropriate labels.)

Key definitions #

Distinguished link types in a WG network. @cite{hudson-2010} §3.2. IsA and or are separated from general property links because the inheritance algorithm must traverse isA links and choice-set resolution uses or links.

Instances For
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Core.Inheritance.instReprLink.repr {α✝ R✝ : Type} [Repr α✝] [Repr R✝] :
      Link α✝ R✝NatStd.Format
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For
        def Core.Inheritance.instDecidableEqLink.decEq {α✝ R✝ : Type} [DecidableEq α✝] [DecidableEq R✝] (x✝ x✝¹ : Link α✝ R✝) :
        Decidable (x✝ = x✝¹)
        Equations
        • One or more equations did not get rendered due to their size.
        Instances For
          def Core.Inheritance.instBEqLink.beq {α✝ R✝ : Type} [BEq α✝] [BEq R✝] :
          Link α✝ R✝Link α✝ R✝Bool
          Equations
          Instances For

            A WG inheritance network: nodes connected by labeled directed links. Parameterized over node type α and relation-label type R.

            Instances For
              def Core.Inheritance.parents {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) :
              List α

              Direct isA parents of a node.

              Equations
              • One or more equations did not get rendered due to their size.
              Instances For
                def Core.Inheritance.ancestors {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) (fuel : Nat := 100) :
                List α

                Ancestors: transitive closure of parents, with fuel for termination.

                Equations
                Instances For
                  def Core.Inheritance.isA {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (a b : α) (fuel : Nat := 100) :

                  Reflexive-transitive isA: does a inherit from b?

                  Equations
                  Instances For
                    def Core.Inheritance.choiceSet {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) :
                    List α

                    OR-alternatives of a node (§3.3): mutually exclusive choices. E.g., choiceSet net gender returns [male, female] if the network contains male --or--> gender and female --or--> gender.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Core.Inheritance.localProps {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) (r : R) :
                      List α

                      Local property values: targets of .prop links from node with label r. A node may have multiple values for the same relation (e.g., a bird has two wings).

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For
                        def Core.Inheritance.inherited {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) (r : R) (fuel : Nat := 100) :
                        List α

                        Inherited property values for relation r, resolved by the Best Fit Principle (§3.5): the most specific (nearest ancestor in the isA chain) wins. Breadth-first walk up the taxonomy; returns the first non-empty result found.

                        Equations
                        Instances For
                          theorem Core.Inheritance.isA_refl {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (a : α) :
                          isA net a a = true

                          Every node isA itself.

                          theorem Core.Inheritance.bestFit_local {α R : Type} [DecidableEq α] [DecidableEq R] (net : Network α R) (node : α) (r : R) (h : localProps net node r []) :
                          inherited net node r = localProps net node r

                          If a node has local properties for r, inherited returns them directly (the Best Fit Principle: local overrides inherited).

                          A prototype: a category with graded typicality over instances. Higher values = more prototypical. @cite{hudson-2010} Ch 2: categories have graded membership; the prototype is the best exemplar.

                          • category : α
                          • typicality : αNat
                          Instances For

                            Whether a is at least as typical as b in a prototype.

                            Equations
                            Instances For
                              def Core.Inheritance.Prototype.moreTypical {α : Type} (proto : Prototype α) (a b : α) :

                              Whether a is strictly more typical than b in a prototype.

                              Equations
                              Instances For
                                theorem Core.Inheritance.Prototype.atLeastAsTypical_trans {α : Type} (proto : Prototype α) (a b c : α) (hab : proto.atLeastAsTypical a b = true) (hbc : proto.atLeastAsTypical b c = true) :

                                atLeastAsTypical is transitive.