Documentation

Linglib.Syntax.WordOrder

Word order #

The order of a head relative to one of its dependents, and the linear arrangement of a finite set of constituents, in particular of the subject, object and verb of a clause.

HeadDirection is the two-valued order of a head and a dependent, head-initial when the head precedes; HeadDirection.swap is the opposite direction, HeadDirection.ofLT the direction read off two positions, HeadDirection.dependentEdge the side of the head on which its dependents lie, and HeadDirection.nearest picks, from dependents in linear order on one side of their head, the one next to it. WordOrder.Arrangement α n is a linear arrangement of the elements of α over n ranks, a bijection onto Fin n, so that precedence, adjacency, the head direction of any pair, the ends and the mirror image are read off the ranks. Arrangement Constituent 3 arranges the three clausal constituents, and its six values are the basic word orders of the typological literature, Arrangement.sov and its siblings, each labelled by its list of constituents.

Main declarations #

Implementation notes #

The WALS classification of a language's dominant orders, with its "no dominant order" value, is data (WALS Feature 81A and its siblings). A fragment records the arrangements a language admits as a Finset (Arrangement Constituent 3); the pairwise orders the language fixes are the ones every member agrees on, so no separate consistency invariant is needed. The rank count is a parameter rather than Fintype.card α, so that numerals and decide reduce, and the ends are defined by rank for the same reason.

References #

inductive HeadDirection :

The order of a head and one of its dependents, head-initial when the head precedes, as a verb precedes its object in VO order and a preposition its noun phrase, head-final otherwise.

Instances For
    @[instance_reducible]
    Equations
    @[instance_reducible]
    Equations
    def instReprHeadDirection.repr :
    HeadDirection → ℕ → Std.Format
    Equations
    Instances For
      @[instance_reducible]
      Equations
      theorem HeadDirection.swap_involutive :
      Function.Involutive swap
      theorem HeadDirection.swap_injective :
      Function.Injective swap
      theorem HeadDirection.eq_or_eq_swap (d e : HeadDirection) :
      e = d ∨ e = d.swap

      A direction is a given one or its opposite.

      def HeadDirection.ofLT {α : Type u_1} [LT α] [DecidableLT α] (head dep : α) :

      The direction of a head at position head with a dependent at position dep.

      Equations
      Instances For
        @[simp]
        theorem HeadDirection.ofLT_eq_headInitial {α : Type u_1} [LT α] [DecidableLT α] {head dep : α} :
        ofLT head dep = headInitial ↔ head < dep
        @[simp]
        theorem HeadDirection.ofLT_eq_headFinal {α : Type u_1} [LT α] [DecidableLT α] {head dep : α} :
        ofLT head dep = headFinal ↔ ¬head < dep
        theorem HeadDirection.ofLT_swap {α : Type u_1} [LinearOrder α] {head dep : α} (h : head ≠ dep) :
        ofLT dep head = (ofLT head dep).swap

        Exchanging the positions of a head and a dependent reverses the direction.

        The edge of a head on which its dependents lie, the right one for a head-initial head.

        Equations
        Instances For
          @[simp]

          The opposite direction puts the dependents on the other edge.

          def HeadDirection.Orders {α : Type u_1} [LT α] :
          HeadDirection → α → α → Prop

          d.Orders head dep holds when the dependent at dep lies in direction d of the head at head, after it for a head-initial head and before it for a head-final one. Unlike ofLT, it fails when the two positions coincide.

          Equations
          Instances For
            @[simp]
            theorem HeadDirection.headInitial_orders {α : Type u_1} {head dep : α} [LT α] :
            headInitial.Orders head dep ↔ head < dep
            @[simp]
            theorem HeadDirection.headFinal_orders {α : Type u_1} {head dep : α} [LT α] :
            headFinal.Orders head dep ↔ dep < head
            theorem HeadDirection.orders_iff_ofLT {α : Type u_1} {d : HeadDirection} {head dep : α} [LinearOrder α] :
            d.Orders head dep ↔ head ≠ dep ∧ ofLT head dep = d

            Orders is ofLT on distinct positions.

            def HeadDirection.nearest {α : Type u_1} :
            HeadDirection → List α → Option α

            d.nearest l is the element of l, dependents in linear order on one side of their head, that is next to the head, the first when the head precedes them and the last when it follows.

            Equations
            Instances For
              @[simp]
              theorem HeadDirection.nearest_headInitial {α : Type u_1} (l : List α) :
              headInitial.nearest l = l.head?
              @[simp]
              theorem HeadDirection.nearest_headFinal {α : Type u_1} (l : List α) :
              headFinal.nearest l = l.getLast?
              theorem HeadDirection.mem_of_mem_nearest {α : Type u_1} {d : HeadDirection} {l : List α} {a : α} (h : a ∈ d.nearest l) :
              a ∈ l
              theorem HeadDirection.nearest_swap_reverse {α : Type u_1} (d : HeadDirection) (l : List α) :
              d.swap.nearest l.reverse = d.nearest l

              Reversing the dependents and the side of the head picks out the same one.

              theorem HeadDirection.nearest_eq_head?_iff {α : Type u_1} [Nontrivial α] {d : HeadDirection} :
              (∀ (l : List α), d.nearest l = l.head?) ↔ d = headInitial

              The dependent next to the head is the first on every list exactly when the head precedes.

              theorem HeadDirection.rel_nearest {α : Type u_1} {β : Type u_2} {R : α → β → Prop} {l₁ : List α} {l₂ : List β} (h : List.Forall₂ R l₁ l₂) (d : HeadDirection) :
              Option.Rel R (d.nearest l₁) (d.nearest l₂)

              Lists related pointwise have related nearest elements.

              @[reducible, inline]
              abbrev WordOrder.Arrangement (α : Type u_1) (n : ℕ) :
              Type u_1

              A linear arrangement of the elements of α over n ranks, each element sent to its rank.

              Equations
              Instances For
                def WordOrder.Arrangement.Precedes {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x y : α) :

                x precedes y.

                Equations
                Instances For
                  @[instance_reducible]
                  instance WordOrder.Arrangement.instDecidablePrecedes {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x y : α) :
                  Decidable (a.Precedes x y)
                  Equations
                  def WordOrder.Arrangement.Adjacent {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x y : α) :

                  x and y stand next to each other, one rank covering the other.

                  Equations
                  • a.Adjacent x y = (a x ⋖ a y ∨ a y ⋖ a x)
                  Instances For
                    def WordOrder.Arrangement.headDirection {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x y : α) :

                    The direction of the head x with respect to its dependent y.

                    Equations
                    Instances For
                      def WordOrder.Arrangement.mirror {α : Type u_1} {n : ℕ} (a : Arrangement α n) :

                      The mirror image, every rank reversed.

                      Equations
                      • a.mirror = Equiv.trans a Fin.revPerm
                      Instances For
                        def WordOrder.Arrangement.IsEnd {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :

                        a.IsEnd x d holds when x is a head in direction d of every other element: x stands first when d is head-initial and last when it is head-final.

                        Equations
                        Instances For
                          @[reducible, inline]
                          abbrev WordOrder.Arrangement.IsInitial {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :

                          x stands first.

                          Equations
                          Instances For
                            @[reducible, inline]
                            abbrev WordOrder.Arrangement.IsFinal {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :

                            x stands last.

                            Equations
                            Instances For
                              def WordOrder.Arrangement.IsMedial {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :

                              x stands neither first nor last.

                              Equations
                              Instances For
                                @[instance_reducible]
                                instance WordOrder.Arrangement.instDecidableIsEnd {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) (d : HeadDirection) :
                                Decidable (a.IsEnd x d)
                                Equations
                                @[instance_reducible]
                                instance WordOrder.Arrangement.instDecidableIsMedial {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :
                                Decidable (a.IsMedial x)
                                Equations
                                @[simp]
                                theorem WordOrder.Arrangement.headDirection_eq_headInitial {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                @[simp]
                                theorem WordOrder.Arrangement.headDirection_eq_headFinal {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                theorem WordOrder.Arrangement.Precedes.trans {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y z : α} (h₁ : a.Precedes x y) (h₂ : a.Precedes y z) :
                                a.Precedes x z
                                theorem WordOrder.Arrangement.Precedes.asymm {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} (h : a.Precedes x y) :
                                ¬a.Precedes y x

                                The mirror image #

                                @[simp]
                                theorem WordOrder.Arrangement.mirror_apply {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                a.mirror x = (a x).rev
                                @[simp]
                                theorem WordOrder.Arrangement.mirror_mirror {α : Type u_1} {n : ℕ} (a : Arrangement α n) :
                                theorem WordOrder.Arrangement.mirror_involutive {α : Type u_1} {n : ℕ} :
                                Function.Involutive mirror
                                theorem WordOrder.Arrangement.precedes_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                a.mirror.Precedes x y ↔ a.Precedes y x

                                The mirror image reverses every precedence.

                                theorem WordOrder.Arrangement.headDirection_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} (h : x ≠ y) :

                                The mirror image reverses the direction of every head with respect to a distinct dependent.

                                Adjacency #

                                theorem WordOrder.Arrangement.adjacent_iff_val {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                a.Adjacent x y ↔ ↑(a x) + 1 = ↑(a y) ∨ ↑(a y) + 1 = ↑(a x)
                                @[instance_reducible]
                                instance WordOrder.Arrangement.instDecidableAdjacent {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                Decidable (a.Adjacent x y)
                                Equations
                                theorem WordOrder.Arrangement.adjacent_comm {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                a.Adjacent x y ↔ a.Adjacent y x
                                theorem WordOrder.Arrangement.Adjacent.ne {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} (h : a.Adjacent x y) :
                                x ≠ y
                                @[simp]
                                theorem WordOrder.Arrangement.adjacent_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x y : α} :
                                a.mirror.Adjacent x y ↔ a.Adjacent x y

                                The mirror image keeps every adjacency.

                                Ends #

                                theorem WordOrder.Arrangement.isInitial_iff_val {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                a.IsInitial x ↔ ↑(a x) = 0
                                theorem WordOrder.Arrangement.isFinal_iff_val {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                a.IsFinal x ↔ ↑(a x) + 1 = n
                                theorem WordOrder.Arrangement.isInitial_iff {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                a.IsInitial x ↔ ∀ (y : α), y ≠ x → a.Precedes x y

                                The first element precedes every other.

                                theorem WordOrder.Arrangement.isFinal_iff {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                a.IsFinal x ↔ ∀ (y : α), y ≠ x → a.Precedes y x

                                The last element follows every other.

                                theorem WordOrder.Arrangement.isEnd_iff {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} {d : HeadDirection} :
                                a.IsEnd x d ↔ ∀ (y : α), y ≠ x → a.headDirection x y = d

                                x stands at the d end exactly when it is a d-head of every other element.

                                theorem WordOrder.Arrangement.isEnd_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} {d : HeadDirection} :
                                a.mirror.IsEnd x d ↔ a.IsEnd x d.swap

                                The mirror image exchanges the two ends.

                                theorem WordOrder.Arrangement.isInitial_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                theorem WordOrder.Arrangement.isFinal_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                theorem WordOrder.Arrangement.isMedial_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} :
                                theorem WordOrder.Arrangement.adjacent_iff_not_isMedial {α : Type u_1} {a : Arrangement α 3} {x y z : α} (hxy : x ≠ y) (hxz : x ≠ z) (hyz : y ≠ z) :
                                a.Adjacent x y ↔ ¬a.IsMedial z

                                Of three elements over three ranks, two are adjacent exactly when the third is not medial.

                                The elements before and after an element #

                                def WordOrder.Arrangement.after {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) [Fintype α] :
                                Finset α

                                The elements after x.

                                Equations
                                Instances For
                                  def WordOrder.Arrangement.before {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) [Fintype α] :
                                  Finset α

                                  The elements before x.

                                  Equations
                                  Instances For
                                    @[simp]
                                    theorem WordOrder.Arrangement.mem_after {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} [Fintype α] {c : α} :
                                    c ∈ a.after x ↔ a.Precedes x c
                                    @[simp]
                                    theorem WordOrder.Arrangement.mem_before {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} [Fintype α] {c : α} :
                                    c ∈ a.before x ↔ a.Precedes c x
                                    theorem WordOrder.Arrangement.notMem_after_self {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} [Fintype α] :
                                    x ∉ a.after x
                                    theorem WordOrder.Arrangement.before_eq_after_mirror {α : Type u_1} {n : ℕ} {a : Arrangement α n} {x : α} [Fintype α] :
                                    a.before x = a.mirror.after x

                                    Lists #

                                    def WordOrder.Arrangement.toList {α : Type u_1} {n : ℕ} (a : Arrangement α n) :
                                    List α

                                    The elements in their order.

                                    Equations
                                    • a.toList = List.map (⇑(Equiv.symm a)) (List.finRange n)
                                    Instances For
                                      @[simp]
                                      theorem WordOrder.Arrangement.length_toList {α : Type u_1} {n : ℕ} (a : Arrangement α n) :
                                      a.toList.length = n
                                      theorem WordOrder.Arrangement.toList_nodup {α : Type u_1} {n : ℕ} (a : Arrangement α n) :
                                      a.toList.Nodup
                                      theorem WordOrder.Arrangement.mem_toList {α : Type u_1} {n : ℕ} (a : Arrangement α n) (x : α) :
                                      x ∈ a.toList

                                      The three constituents of a transitive clause.

                                      Instances For
                                        @[instance_reducible]
                                        Equations
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For

                                          The letter of a constituent in the labels "SOV", "SVO", … of the typological literature.

                                          Equations
                                          Instances For

                                            Subject, object, verb.

                                            Equations
                                            • One or more equations did not get rendered due to their size.
                                            Instances For

                                              Subject, verb, object.

                                              Equations
                                              • One or more equations did not get rendered due to their size.
                                              Instances For

                                                Verb, subject, object.

                                                Equations
                                                • One or more equations did not get rendered due to their size.
                                                Instances For

                                                  Verb, object, subject.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For

                                                    Object, verb, subject.

                                                    Equations
                                                    • One or more equations did not get rendered due to their size.
                                                    Instances For

                                                      Object, subject, verb.

                                                      Equations
                                                      • One or more equations did not get rendered due to their size.
                                                      Instances For

                                                        The six basic orders.

                                                        Equations
                                                        • One or more equations did not get rendered due to their size.
                                                        Instances For

                                                          Every arrangement of the three constituents is a basic order.

                                                          The label of an arrangement of the three constituents, "SOV" for sov.

                                                          Equations
                                                          Instances For

                                                            The basic order with the label s, if any.

                                                            Equations
                                                            Instances For