Documentation

Linglib.Comparisons.CommandRelations

Abstract tree with dominance relation (B&P Definition 1)

Enhanced with the Connected Ancestor Condition (CAC) needed for Embeddability (Theorem 8): ancestors are linearly ordered in a tree.

  • nodes : Set Node
  • dom : NodeNodeProp
  • root : Node
  • dom_refl (a : Node) : a self.nodesself.dom a a
  • dom_antisymm (a b : Node) : self.dom a bself.dom b aa = b
  • dom_trans (a b c : Node) : self.dom a bself.dom b cself.dom a c
  • root_dom_all (a : Node) : a self.nodesself.dom self.root a
  • root_in_nodes : self.root self.nodes
  • ancestor_connected (x y z : Node) : self.dom x zself.dom y zself.dom x y self.dom y x

    Connected Ancestor Condition (CAC): If both x and y dominate z, then either x dominates y or y dominates x. This captures that ancestors in a tree are linearly ordered.

  • nodes_closed (x y : Node) : x self.nodesself.dom x yy self.nodes

    Nodes closed under dominance

Instances For

    Proper dominance: a properly dominates b iff a dominates b and a ≠ b

    Equations
    Instances For
      def Comparisons.CommandRelations.upperBounds {Node : Type} (T : AbstractTree Node) (a : Node) (P : Set Node) :
      Set Node

      Upper bounds of a node with respect to property P (B&P Definition 2). UB(a, P) = {b | b properly dominates a ∧ b ∈ P}

      Equations
      Instances For
        def Comparisons.CommandRelations.commandRelation {Node : Type} (T : AbstractTree Node) (P : Set Node) :
        Set (Node × Node)

        Command relation generated by property P (B&P Definition 3). C_P = {(a,b) | ∀x ∈ UB(a,P). x dominates b}

        a P-commands b iff every P-node that properly dominates a also dominates b.

        Equations
        Instances For

          Theorem 1 (Intersection Theorem): C_P ∩ C_Q = C_{P∪Q}

          This is the central algebraic result: union of properties gives intersection of command relations.

          theorem Comparisons.CommandRelations.command_antitone {Node : Type} (T : AbstractTree Node) (P Q : Set Node) (hPQ : P Q) :

          Corollary: The map P ↦ C_P is antitone (order-reversing)

          Maximal property: all nodes

          Equations
          Instances For
            def Comparisons.CommandRelations.idcCommand {Node : Type} (T : AbstractTree Node) :
            Set (Node × Node)

            IDc-command: C_{all nodes} — the most restrictive command relation

            Equations
            Instances For

              Universal command: C_∅ — the least restrictive (everything commands everything)

              Equations
              Instances For
                theorem Comparisons.CommandRelations.idc_is_bottom {Node : Type} (T : AbstractTree Node) (P : Set Node) (hP : P T.nodes) :

                IDc-command is the bottom of the lattice: IDc ⊆ C_P for all P

                Universal command is the top: C_P ⊆ Universal for all P

                theorem Comparisons.CommandRelations.command_reflexive {Node : Type} (T : AbstractTree Node) (P : Set Node) (a : Node) :

                All command relations are reflexive

                theorem Comparisons.CommandRelations.command_descent {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b c : Node) :
                (a, b) commandRelation T PT.dom b c(a, c) commandRelation T P

                All command relations satisfy constituency/descent

                theorem Comparisons.CommandRelations.configurational_equivalence {Node : Type} (T : AbstractTree Node) (P Q : Set Node) (a : Node) :
                upperBounds T a P = upperBounds T a Q∀ (b : Node), (a, b) commandRelation T P (a, b) commandRelation T Q

                Configurational Equivalence Corollary: If the upper bounds of node a are the same for properties P and Q, then C_P and C_Q agree on all pairs starting from a.

                This formalizes the configurational assumption: different theories (using different P's) agree when their upper bounds coincide.

                theorem Comparisons.CommandRelations.same_upper_bounds_same_command {Node : Type} (T : AbstractTree Node) (P Q : Set Node) (a b : Node) (hub : upperBounds T a P = upperBounds T a Q) :

                Corollary: If P and Q have the same nodes above a, C_P(a,-) = C_Q(a,-)

                theorem Comparisons.CommandRelations.unique_upper_bound_equivalence {Node : Type} (T : AbstractTree Node) (P Q : Set Node) (s x : Node) (h_unique : ∀ (y : Node), T.properDom y s y = x) (h_equiv : x P x Q) (b : Node) :

                Configurational Clause Condition: For subject position s, if there is exactly one node x that properly dominates s, and x ∈ P ↔ x ∈ Q, then C_P and C_Q agree on pairs from s.

                In a standard clause [S [NP_subj] [VP...]], the only node properly dominating the subject NP is S. So any P containing S agrees with any Q containing S.

                A minimal binary tree for phrase structure

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

                    Directions in a binary tree

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

                        Does address a dominate b? (a is prefix of b)

                        Equations
                        Instances For

                          C-command: A c-commands B iff A's sister dominates B (or equals B).

                          This is the standard definition for binary branching trees.

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

                            Argument structure: ordered list by obliqueness (less oblique first)

                            Instances For
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Comparisons.CommandRelations.oCommand {α : Type} [DecidableEq α] (argSt : ArgSt α) (a b : α) :

                                O-command: A o-commands B iff A precedes B in the argument structure.

                                Position in arg-st = obliqueness rank. Earlier = less oblique.

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

                                  A labeled dependency edge

                                  • dependent : α
                                  • head : α
                                  • label : String
                                  Instances For
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Dependency graph = list of edges

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

                                          Is a a dependent of h?

                                          Equations
                                          Instances For

                                            Get label for dependency

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

                                              D-command: A d-commands B iff A and B are co-dependents of the same head, and A bears the "subj" relation (designated binder).

                                              Equations
                                              Instances For

                                                A configurational transitive clause bundles aligned representations.

                                                The key invariants capture what it means for a structure to be configurational:

                                                • Tree has subject external to VP, object internal
                                                • Arg-st has subject before object (less oblique)
                                                • Dep-graph has both as dependents of verb, subject labeled "subj"

                                                When these hold, the three command relations must agree.

                                                Instances For

                                                  Helper: c-command holds for standard configurational addresses

                                                  theorem Comparisons.CommandRelations.oCommand_john_himself :
                                                  oCommand { args := ["John", "himself"] } "John" "himself" = true

                                                  Helper: o-command holds for "John" before "himself"

                                                  The ConfigurationalClause structure constraints ensure command equivalence.

                                                  Rather than proving this for arbitrary instances (which requires metaprogramming), the key insight is demonstrated by the concrete example johnSeesHimself_commands.

                                                  The structural constraints (subjAddr = [L], objAddr = [R,R], argSt = [subj, obj], dependency labels) force all three command notions to agree for any valid instance.

                                                  "John sees himself" as a configurational clause

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

                                                    The key test sentences

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

                                                      Total minimal pairs tested

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

                                                        Category labels for labeled trees

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

                                                              Labeled tree extends abstract tree with category labels

                                                              Instances For

                                                                Branching nodes

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

                                                                  Maximal projections (simplified)

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

                                                                    S-command ∩ NP-command = command by {S} ∪ {NP}

                                                                    If S ⊆ MaxProj, then MAX-command ⊆ S-command

                                                                    def Comparisons.CommandRelations.CommandRels {Node : Type} (T : AbstractTree Node) :
                                                                    Set (Set (Node × Node))

                                                                    The set of command relations on a tree

                                                                    Equations
                                                                    Instances For

                                                                      The Intersection Theorem restated: P ↦ C_P converts ⊔ to ⊓

                                                                      theorem Comparisons.CommandRelations.command_sInter {Node : Type} (T : AbstractTree Node) (S : Set (Set Node)) :
                                                                      commandRelation T (⋃₀ S) = ⋂₀ {C : Set (Node × Node) | PS, C = commandRelation T P}

                                                                      Generalized intersection theorem for arbitrary unions

                                                                      def Comparisons.CommandRelations.commandMap {Node : Type} (T : AbstractTree Node) :
                                                                      Set Node →o (Set (Node × Node))ᵒᵈ

                                                                      OrderDual for the powerset ordered by superset

                                                                      Equations
                                                                      Instances For

                                                                        The command map is order-reversing (stated directly)

                                                                        theorem Comparisons.CommandRelations.command_ambidextrous {Node : Type} (T : AbstractTree Node) (P : Set Node) (a : Node) :
                                                                        (∃ (x : Node), x upperBounds T a P) ∀ (b : Node), (a, b) commandRelation T P

                                                                        A command relation C_P is ambidextrous iff for all a: either ∃x. x ∈ UB(a,P) or (a,b) ∈ C_P for all b.

                                                                        B&P Theorem 3: All command relations are ambidextrous.

                                                                        theorem Comparisons.CommandRelations.command_bounded {Node : Type} (T : AbstractTree Node) (P : Set Node) (hb : ∀ (a b : Node), (a, b) commandRelation T Pb T.nodes) :

                                                                        Boundedness (B&P Theorem 4): Adding a root node to the generating property does not alter the command relation.

                                                                        C_P = C_{P ∪ {r}} when r is the root.

                                                                        Proof: C_P ⊇ C_{P∪{r}} by the Intersection Theorem (antitone). For the reverse: if (a,b) ∈ C_P but (a,b) ∉ C_{P∪{r}}, there must be some c ∈ P ∪ {r} \ P that properly dominates a but doesn't dominate b. The only such c is the root. But the root dominates everything, contradiction.

                                                                        theorem Comparisons.CommandRelations.root_upper_bound_trivial {Node : Type} (T : AbstractTree Node) (a b : Node) (hb : b T.nodes) (hprop : T.properDom T.root a) :
                                                                        T.dom T.root b

                                                                        Simpler Boundedness: The root is not a proper dominator of any node.

                                                                        This is because the root dominates everything, so if root properly dominates a, then root ≠ a, which is possible. But the key point for command relations is that adding root to P doesn't change which pairs command each other.

                                                                        theorem Comparisons.CommandRelations.command_bounded_witness {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b : Node) (h : (a, b) commandRelation T P) (hub : ∃ (x : Node), x upperBounds T a P) :
                                                                        xupperBounds T a P, T.dom x b

                                                                        Alternative Boundedness: If UB(a,P) is nonempty and (a,b) ∈ C_P, then ∃x ∈ UB(a,P). x dom b.

                                                                        This is immediate from the definition but useful as a lemma.

                                                                        theorem Comparisons.CommandRelations.command_noncommand_witness {Node : Type} (T : AbstractTree Node) (P : Set Node) (a c : Node) (hnac : (a, c)commandRelation T P) :
                                                                        xupperBounds T a P, ¬T.dom x c

                                                                        Fairness witness: ¬(a C_P c) implies ∃x ∈ UB(a,P). ¬(x dom c).

                                                                        This is the contrapositive of the command definition.

                                                                        theorem Comparisons.CommandRelations.command_fair {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b c : Node) (hab : (a, b) commandRelation T P) (hbc : (b, c) commandRelation T P) (hnac : (a, c)commandRelation T P) (d : Node) :
                                                                        (a, d) commandRelation T PT.dom b d

                                                                        Fairness (B&P Theorem 6): (aCb ∧ bCc ∧ ¬aCc) → (aCd → b dominates d).

                                                                        If a commands b, b commands c, but a doesn't command c, then every node that a commands is dominated by b.

                                                                        Proof: Let x be the witness from ¬aCc (x ∈ UB(a,P), x doesn't dominate c). From aCb, x dominates b. If x ≠ b, then x properly dominates b, so x ∈ UB(b,P). From bCc, x would dominate c - contradiction. So x = b. Then from aCd, x dominates d, i.e., b dominates d.

                                                                        def Comparisons.CommandRelations.mateRelation {Node : Type} (T : AbstractTree Node) (P : Set Node) :
                                                                        Set (Node × Node)

                                                                        Mate relation: M_P = C_P ∩ (C_P)⁻¹

                                                                        Two nodes are P-mates iff they mutually P-command each other. Examples: clause-mates (S-command), co-arguments (NP-command).

                                                                        Equations
                                                                        • One or more equations did not get rendered due to their size.
                                                                        Instances For
                                                                          theorem Comparisons.CommandRelations.mate_symmetric {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b : Node) :

                                                                          Mate relations are symmetric

                                                                          theorem Comparisons.CommandRelations.mate_reflexive {Node : Type} (T : AbstractTree Node) (P : Set Node) (a : Node) (ha : a T.nodes) :

                                                                          Mate relations are reflexive on nodes in C_P

                                                                          def Comparisons.CommandRelations.sMates {Node : Type} (T : LabeledTree Node) :
                                                                          Set (Node × Node)

                                                                          S-mates (clausemates): nodes that mutually S-command

                                                                          Equations
                                                                          Instances For
                                                                            def Comparisons.CommandRelations.npMates {Node : Type} (T : LabeledTree Node) :
                                                                            Set (Node × Node)

                                                                            NP-mates (co-arguments): nodes that mutually NP-command

                                                                            Equations
                                                                            Instances For

                                                                              Intersection theorem for mate relations

                                                                              theorem Comparisons.CommandRelations.command_constituency {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b c : Node) :
                                                                              (a, b) commandRelation T PT.dom b c(a, c) commandRelation T P

                                                                              Constituency/Descent (stronger form): If a commands b and b dominates c, then a commands c.

                                                                              B&P Theorem 7: C_P is closed under descent on the second argument.

                                                                              This is already proved as command_descent above. Here we restate it in the standard form.

                                                                              theorem Comparisons.CommandRelations.command_embeddable_simple {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b c : Node) (hdom : T.properDom a b) (hac : (a, c) commandRelation T P) (x : Node) :
                                                                              x upperBounds T b PT.properDom x aT.dom x c

                                                                              Embeddability (B&P Theorem 8): Command relations are preserved under graph embedding.

                                                                              B&P's actual Theorem 8 is about embedding one graph G₁ into another G₂: "A node a commands b in G₁ if and only if a commands b in G₂" when G₁ is rooted, G₂ satisfies CAC, and the embedding obeys Integrity.

                                                                              Here we prove a simpler internal version using CAC: If x properly dominates b (with x ∈ P), and either x dominates a (giving x ∈ UB(a,P)) or a dominates x, then we can transfer command from a to b.

                                                                              The key insight: in a tree with CAC, any upper bound of b is comparable to a.

                                                                              theorem Comparisons.CommandRelations.command_embeddable_cac {Node : Type} (T : AbstractTree Node) (P : Set Node) (a b c : Node) (hdom : T.properDom a b) (hac : (a, c) commandRelation T P) (h_upper_bounds_above : xupperBounds T b P, T.properDom x a T.dom a x T.dom x c) :

                                                                              Embeddability corollary: If every upper bound of b that properly dominates b also properly dominates a, then a commanding c implies b commands c.

                                                                              This requires: UB(b,P) ⊆ {x | x properly dominates a} ∪ {x | a dominates x ∧ x dom c}

                                                                              In a tree with CAC, the first disjunct covers most cases.

                                                                              def Comparisons.CommandRelations.commandByRelation {Node : Type} (T : AbstractTree Node) (R : NodeNodeProp) :
                                                                              Set (Node × Node)

                                                                              A command relation generated by a binary relation R rather than a property.

                                                                              C_R(a,b) iff ∀x. (a R x) → (x dominates b)

                                                                              This generalizes the property-based definition: C_P = C_{R_P} where (a R_P x) iff x properly dominates a and x ∈ P.

                                                                              Equations
                                                                              Instances For
                                                                                theorem Comparisons.CommandRelations.command_as_relation {Node : Type} (T : AbstractTree Node) (P : Set Node) :
                                                                                commandRelation T P = commandByRelation T fun (a x : Node) => T.properDom x a x P

                                                                                The property-based command is a special case of relation-based

                                                                                def Comparisons.CommandRelations.commandEquivalent {Node : Type} (T : AbstractTree Node) (R S : NodeNodeProp) :

                                                                                Command equivalence (B&P Definition 20): R ~ S iff C_R = C_S

                                                                                Equations
                                                                                Instances For
                                                                                  def Comparisons.CommandRelations.maximalGenerator {Node : Type} (T : AbstractTree Node) (R : NodeNodeProp) :
                                                                                  NodeNodeProp

                                                                                  Maximal generator (B&P Definition 21): R̂ = ∪{S | S ⊇ R ∧ S ~ R}

                                                                                  The largest relation that generates the same command relation as R.

                                                                                  Key insight: if c dominates some upper bound b for a, then (c,a) can be added to R without changing C_R (non-minimal upper bounds don't affect command).

                                                                                  Equations
                                                                                  Instances For
                                                                                    theorem Comparisons.CommandRelations.maximalGenerator_contains {Node : Type} (T : AbstractTree Node) (R : NodeNodeProp) (a x : Node) :
                                                                                    R a xmaximalGenerator T R a x

                                                                                    Maximal generator contains the original relation

                                                                                    theorem Comparisons.CommandRelations.nonminimal_in_maximalGenerator {Node : Type} (T : AbstractTree Node) (R : NodeNodeProp) (a c d : Node) (hRad : R a d) (hcd : T.dom c d) (hcpropa : T.properDom c a) (hR_proper : ∀ (a' x' : Node), R a' x'T.properDom x' a') :

                                                                                    Key Lemma for Union Theorem: Non-minimal upper bounds are in the maximal generator.

                                                                                    If c dominates d, and (d, a) ∈ R (meaning d is an upper bound for a in R), then (c, a) ∈ R̂ (the maximal generator).

                                                                                    Proof: Adding (c, a) to R doesn't change C_R because any node that needed to be dominated by c would already be dominated by d (by transitivity).

                                                                                    Maximal generator is command-equivalent to original

                                                                                    theorem Comparisons.CommandRelations.relation_intersection_theorem {Node : Type} (T : AbstractTree Node) (R S : NodeNodeProp) :
                                                                                    commandByRelation T R commandByRelation T S = commandByRelation T fun (a x : Node) => R a x S a x

                                                                                    Intersection Theorem for Relations: C_R ∩ C_S = C_{R ∪ S}

                                                                                    Analogous to property-based intersection theorem.

                                                                                    theorem Comparisons.CommandRelations.relation_union_theorem {Node : Type} (T : AbstractTree Node) (R S : NodeNodeProp) :

                                                                                    Union Theorem (B&P Theorem 9): C_R ∪ C_S = C_{R̂ ∩ Ŝ}

                                                                                    Union over command relations corresponds to intersection over maximal generators.

                                                                                    The proof relies on CAC: if (a,b) ∈ C_{R̂∩Ŝ} but (a,b) ∉ C_R ∪ C_S, then there exist c with (c,a) ∈ R and d with (d,a) ∈ S, both properly dominating a but neither dominating b. By CAC, either c dom d or d dom c. Say c dom d. Then c is a non-minimal upper bound for a via S, so (c,a) ∈ Ŝ. And (c,a) ∈ R̂ since R̂ ⊇ R. So (c,a) ∈ R̂ ∩ Ŝ, contradicting (a,b) ∈ C_{R̂∩Ŝ}.

                                                                                    theorem Comparisons.CommandRelations.relation_union_theorem_reverse {Node : Type} (T : AbstractTree Node) (R S : NodeNodeProp) (hR_proper : ∀ (a x : Node), R a xT.properDom x a) (hS_proper : ∀ (a x : Node), S a xT.properDom x a) :

                                                                                    The reverse inclusion requires CAC.

                                                                                    This is B&P's Theorem 9 reverse direction: C_{R̂∩Ŝ} ⊆ C_R ∪ C_S.

                                                                                    Proof sketch: If (a,b) ∈ C_{R̂∩Ŝ} but (a,b) ∉ C_R ∪ C_S, then there exist witnesses c with (c,a) ∈ R and d with (d,a) ∈ S, both properly dominating a but neither dominating b. By CAC, either c dom d or d dom c. Say c dom d. Then c is a non-minimal upper bound via d for S, so (c,a) ∈ Ŝ. And (c,a) ∈ R̂ since R̂ ⊇ R. So (c,a) ∈ R̂ ∩ Ŝ, meaning (a,b) ∈ C_{R̂∩Ŝ} implies c dom b. Contradiction.

                                                                                    The full proof requires showing that non-minimal upper bounds are in Ŝ, which needs the precise characterization of maximal generators.

                                                                                    def Comparisons.CommandRelations.commandImage {Node : Type} (T : AbstractTree Node) :
                                                                                    Set (Set (Node × Node))

                                                                                    The image of the command map: all command relations

                                                                                    Equations
                                                                                    Instances For
                                                                                      theorem Comparisons.CommandRelations.commandImage_closed_under_sInter {Node : Type} (T : AbstractTree Node) (S : Set (Set (Node × Node))) (hS : S commandImage T) (_hne : S.Nonempty) :

                                                                                      Command relations are closed under arbitrary intersection

                                                                                      The command relations form a closure system

                                                                                      @cite{barker-pullum-1990} Formalization Coverage #

                                                                                      @cite{barker-pullum-1990} @cite{hudson-1990} @cite{pollard-sag-1994} @cite{reinhart-1976}

                                                                                      Fully Proved Theorems #

                                                                                      B&P ReferenceNameLean Theorem
                                                                                      Definition 1Abstract TreeAbstractTree
                                                                                      Definition 2Upper BoundsupperBounds
                                                                                      Definition 3Command RelationcommandRelation
                                                                                      Theorem 1Intersection Theoremintersection_theorem
                                                                                      CorollaryAntitone Mapcommand_antitone, command_converts_sup_to_inf
                                                                                      Theorem 2Reflexivitycommand_reflexive
                                                                                      Theorem 3Ambidextrousnesscommand_ambidextrous
                                                                                      Theorem 5Descent/Constituencycommand_descent, command_constituency
                                                                                      Theorem 6Fairnesscommand_fair
                                                                                      Section 3Mate RelationsmateRelation, mate_symmetric, mate_reflexive, mate_intersection
                                                                                      -Generalized Intersectioncommand_sInter
                                                                                      -Closure Systemcommand_closure_system
                                                                                      -IDc-command is bottomidc_is_bottom
                                                                                      -Universal command is topuniversal_is_top
                                                                                      Theorem 4Boundednesscommand_bounded
                                                                                      Theorem 8Embeddabilitycommand_embeddable_simple, command_embeddable_cac
                                                                                      -Configurational Equivalenceconfigurational_equivalence, unique_upper_bound_equivalence
                                                                                      G.9Command EquivalencecommandEquivalent, maximalGenerator, maximalGenerator_equivalent
                                                                                      G.9Relation Intersectionrelation_intersection_theorem
                                                                                      G.9Union Theorem (both directions)relation_union_theorem, relation_union_theorem_reverse
                                                                                      G.9Non-minimal Upper Boundsnonminimal_in_maximalGenerator

                                                                                      Theorems with sorry (Kracht Infrastructure) #

                                                                                      ReferenceIssue
                                                                                      Kracht Prop 6command_comp_inter_left_rev - composition distributivity reverse
                                                                                      Kracht Thm 2tight_implies_fair - tight → fair (partial)
                                                                                      Kracht Thm 2fair_implies_tight_exists - fair → tight (needs choice)

                                                                                      Note: Theorem 4 (Boundedness), Theorem 8 (Embeddability) are now fully proved using the Connected Ancestor Condition (CAC) added to AbstractTree.

                                                                                      B&P Theorem 9 (Union Theorem) is now fully proved using nonminimal_in_maximalGenerator, which shows that non-minimal upper bounds can be added to a relation without changing the generated command relation.

                                                                                      Not Yet Formalized #

                                                                                      B&P ReferenceNotes
                                                                                      Section 4 (Government)Would require m-command, barriers theory
                                                                                      Full Galois ConnectionCould use GaloisInsertion from Mathlib
                                                                                      Lattice as Complete LatticeImage forms a complete sub-lattice

                                                                                      Linguistic Applications Proved #

                                                                                      Insight #

                                                                                      The formalization shows that grammar comparison can be made mathematically precise: theories that seem to differ in mechanism (tree geometry vs obliqueness vs dependency paths) are unified through B&P's algebraic framework. When the structural assumptions align (configurational languages), the theories necessarily agree by the Intersection Theorem.

                                                                                      @cite{kracht-1993} "Mathematical Aspects of Command Relations" #

                                                                                      Kracht shows that command relations have richer algebraic structure than B&P identified:

                                                                                      1. Associated Functions: Each command relation C has an associated function f_C : T → T where C_x = ↓f_C(x) (downward closure)

                                                                                      2. Tight Relations: Relations satisfying: x < f(y) → f(x) ≤ f(y)

                                                                                      3. Fair = Tight (Theorem 2): The "fair" relations of B&P are exactly the "tight" relations defined by the associated function property.

                                                                                      4. Distributoid Structure: (Cr(T), ∩, ∪, ∘) where ∘ is relational composition. Composition distributes over both ∩ and ∪.

                                                                                      5. Union Elimination: ∪ can be expressed using ∩ and ∘ alone: C_P ∪ C_Q = (C_P ∘ C_Q) ∩ (C_Q ∘ C_P) ∩ (C_P • C_Q)

                                                                                      Insight #

                                                                                      Working with associated functions f : T → T (monotone, bounded) is more elegant than working with the relations directly. The composition of command relations corresponds to ordinary function composition:

                                                                                      f_{R∘S} = f_S ∘ f_R
                                                                                      

                                                                                      This reversal is because command relations are "upper-bound based" - the generator x dominates the commanded element b.

                                                                                      Associated function for a command relation.

                                                                                      For command relation C = C_P, the associated function f : T → T maps each node a to the infimum (meet) of its P-upper-bounds.

                                                                                      In a tree, this is the "minimal P-dominator" of a (if it exists).

                                                                                      Properties (Kracht Conditions 1-5):

                                                                                      1. f(r) = r (root maps to itself)
                                                                                      2. f(x) dominates x (f(x) is an upper bound)
                                                                                      3. f is monotone: x dom y → f(x) dom f(y)
                                                                                      4. f(f(x)) = f(x) (idempotent on range)
                                                                                      5. (Tightness) x < f(y) → f(x) ≤ f(y)
                                                                                      • f : NodeNode

                                                                                        The function mapping each node to its "minimal P-dominator"

                                                                                      • root_fixed : self.f T.root = T.root

                                                                                        Root maps to itself (Condition 1)

                                                                                      • dominates_arg (x : Node) : x T.nodesT.dom (self.f x) x

                                                                                        f(x) dominates x (Condition 2)

                                                                                      • monotone (x y : Node) : T.dom x yT.dom (self.f x) (self.f y)

                                                                                        Monotonicity (Condition 3)

                                                                                      • idempotent (x : Node) : x T.nodesself.f (self.f x) = self.f x

                                                                                        Idempotent on range (Condition 4)

                                                                                      Instances For

                                                                                        Tightness condition (Kracht Condition 5): If x is strictly below f(y), then f(x) ≤ f(y).

                                                                                        This captures that command relations are "fair" in B&P's sense: the generating property P determines a consistent boundary.

                                                                                        Equations
                                                                                        Instances For

                                                                                          A tight associated function satisfies all five Kracht conditions

                                                                                          Instances For

                                                                                            The command relation determined by an associated function.

                                                                                            C_f = {(a,b) | f(a) dominates b}

                                                                                            This is equivalent to the property-based definition when P = {x | f(x) = x} (the fixed points of f).

                                                                                            Equations
                                                                                            Instances For

                                                                                              The command relation from a tight function is reflexive

                                                                                              The command relation from a tight function satisfies descent

                                                                                              def Comparisons.CommandRelations.composeRel {Node : Type} (R S : Set (Node × Node)) :
                                                                                              Set (Node × Node)

                                                                                              Relational composition of command relations.

                                                                                              (C ∘ D)(a,c) iff ∃b. C(a,b) ∧ D(b,c)

                                                                                              For command relations from associated functions: C_f ∘ C_g corresponds to C_{g∘f} (note the reversal!)

                                                                                              Equations
                                                                                              Instances For
                                                                                                theorem Comparisons.CommandRelations.composeRel_assoc {Node : Type} (R S U : Set (Node × Node)) :

                                                                                                Composition is associative

                                                                                                theorem Comparisons.CommandRelations.compose_associated_functions {Node : Type} (T : AbstractTree Node) (af ag : AssociatedFunction T) :
                                                                                                composeRel (commandFromFunction T af) (commandFromFunction T ag) {ac : Node × Node | T.dom (ag.f (af.f ac.1)) ac.2}

                                                                                                For associated functions, composition reverses: C_f ∘ C_g ⊆ C_{g ∘ f}

                                                                                                This is because if f(a) dom b and g(b) dom c, then g(f(a)) dom g(b) dom c (by monotonicity and transitivity).

                                                                                                Note: We prove containment rather than equality since the composed function g ∘ f may not satisfy all AssociatedFunction conditions without additional assumptions (specifically, idempotence).

                                                                                                A Distributoid is an algebraic structure (D, ∩, ∪, ∘) where:

                                                                                                • (D, ∩, ∪) is a distributive lattice
                                                                                                • ∘ is an associative operation
                                                                                                • ∘ distributes over both ∩ and ∪

                                                                                                Command relations form a distributoid (Kracht Theorem 8).

                                                                                                Instances

                                                                                                  Composition distributes over intersection for command relations (one direction)

                                                                                                  Composition distributes over intersection (reverse direction).

                                                                                                  This direction is more subtle: we have potentially different witnesses b1, b2. The proof uses the fact that if one witness properly dominates the other, the upper bounds are nested, allowing us to transfer the command relation.

                                                                                                  Key insight: If b1 properly dominates b2 (b1 dom b2, b1 ≠ b2), then UB(b1, R) ⊆ UB(b2, R), so (b2, c) ∈ C_R implies (b1, c) ∈ C_R.

                                                                                                  The general case when b1 and b2 are incomparable requires additional structure (e.g., using CAC to find a common dominator).

                                                                                                  def Comparisons.CommandRelations.isFair {Node : Type} (T : AbstractTree Node) (C : Set (Node × Node)) :

                                                                                                  A relation R is fair in B&P's sense if it satisfies: (a R b) ∧ (b R c) ∧ ¬(a R c) → ∀d. (a R d) → (b dom d)

                                                                                                  This is B&P's Theorem 6 condition.

                                                                                                  Equations
                                                                                                  Instances For

                                                                                                    All property-generated command relations are fair (B&P Theorem 6)

                                                                                                    Kracht Theorem 2: For tight associated functions, the generated command relation is fair, and conversely, every fair command relation comes from a tight associated function.

                                                                                                    First direction: tight → fair

                                                                                                    theorem Comparisons.CommandRelations.fair_implies_tight_exists {Node : Type} (T : AbstractTree Node) (C : Set (Node × Node)) (hC_refl : aT.nodes, (a, a) C) (hC_desc : ∀ (a b c : Node), (a, b) CT.dom b c(a, c) C) (hC_fair : isFair T C) (hC_from_prop : ∃ (P : Set Node), C = commandRelation T P) :

                                                                                                    Kracht Theorem 2 (converse sketch): Every fair command relation comes from a tight associated function.

                                                                                                    Proof idea: Given a fair relation C, define f(x) = minimal y s.t. (x,y) ∈ C. The fairness condition ensures this f is well-defined and tight.

                                                                                                    def Comparisons.CommandRelations.antecedentInter {Node : Type} (T : AbstractTree Node) (R S : Set (Node × Node)) :
                                                                                                    Set (Node × Node)

                                                                                                    The antecedent intersection of two relations: R • S = {(a,c) | ∃b. (a,b) ∈ R ∧ (a,b) ∈ S ∧ (b dom c)}

                                                                                                    This captures "common antecedents" between R and S.

                                                                                                    Equations
                                                                                                    Instances For

                                                                                                      Union Elimination (Kracht Lemma 10-11): C_P ∪ C_Q = (C_P ∘ C_Q) ∩ (C_Q ∘ C_P) ∩ (C_P • C_Q)

                                                                                                      Union can be expressed using only ∩ and ∘ (plus antecedent intersection).

                                                                                                      This shows that ∪ is "eliminable" in the distributoid structure, meaning the theory can be developed using ∩ and ∘ alone.

                                                                                                      First inclusion: C_P ∪ C_Q ⊆ (C_P ∘ C_Q) ∩ (C_Q ∘ C_P) ∩ (C_P • C_Q)

                                                                                                      Note: Requires both a, c ∈ T.nodes for reflexivity. The antecedent intersection part also requires a dom c, which holds when a ∈ P or a ∈ Q (so UB(a,_) = ∅ and a commands everything below it).

                                                                                                      Union Elimination (reverse direction): (C_P ∘ C_Q) ∩ (C_Q ∘ C_P) ∩ (C_P • C_Q) ⊆ C_P ∪ C_Q

                                                                                                      This is the harder direction - it relies on the specific structure of command relations.

                                                                                                      Heyting Algebra via Mathlib #

                                                                                                      Set α is a CompleteAtomicBooleanAlgebra and hence a HeytingAlgebra. The Heyting implication for sets is: A ⇨ B = Aᶜ ∪ B

                                                                                                      @cite{kracht-1993} shows command relations form a Heyting algebra. Since command relations are a subset of Set (Node × Node), and the latter is already a Heyting algebra, we show:

                                                                                                      1. The standard Heyting implication satisfies the adjunction property
                                                                                                      2. Our explicit definition agrees with Mathlib's
                                                                                                      3. Command relations are closed under Heyting operations (sub-Heyting-algebra)
                                                                                                      def Comparisons.CommandRelations.commandImplication {Node : Type} (_T : AbstractTree Node) (C D : Set (Node × Node)) :
                                                                                                      Set (Node × Node)

                                                                                                      The Heyting implication on sets: A ⇨ B = Aᶜ ∪ B

                                                                                                      This can also be characterized as: A ⇨ B = ⋃₀ {E | E ∩ A ⊆ B} (the largest set E such that E ∩ A ⊆ B).

                                                                                                      Equations
                                                                                                      Instances For
                                                                                                        theorem Comparisons.CommandRelations.commandImplication_eq_sUnion {Node : Type} (_T : AbstractTree Node) (C D : Set (Node × Node)) :
                                                                                                        commandImplication _T C D = ⋃₀ {E : Set (Node × Node) | E C D}

                                                                                                        Our explicit union definition equals Mathlib's Heyting implication.

                                                                                                        For sets, A ⇨ B = Aᶜ ∪ B, which is exactly the largest E with E ∩ A ⊆ B.

                                                                                                        theorem Comparisons.CommandRelations.command_heyting {Node : Type} (_T : AbstractTree Node) (C D E : Set (Node × Node)) :
                                                                                                        E C D E C D

                                                                                                        The Heyting adjunction: E ∩ C ⊆ D ↔ E ⊆ (C ⇨ D)

                                                                                                        This is the defining property of Heyting implication. In Mathlib, this is le_himp_iff.

                                                                                                        theorem Comparisons.CommandRelations.command_modus_ponens {Node : Type} (_T : AbstractTree Node) (C D : Set (Node × Node)) :
                                                                                                        (C D) C D

                                                                                                        Modus ponens for command relations: (C ⇨ D) ∩ C ⊆ D

                                                                                                        theorem Comparisons.CommandRelations.command_himp_trans {Node : Type} (_T : AbstractTree Node) (A B C : Set (Node × Node)) :
                                                                                                        (A B) (B C) A C

                                                                                                        Transitivity of Heyting implication: (A ⇨ B) ∩ (B ⇨ C) ⊆ (A ⇨ C)

                                                                                                        Uses Mathlib's himp_le_himp_himp_himp: b ⇨ c ≤ (a ⇨ b) ⇨ a ⇨ c

                                                                                                        theorem Comparisons.CommandRelations.command_rels_complete_heyting {Node : Type} (_T : AbstractTree Node) (C D : Set (Node × Node)) :
                                                                                                        (C D) C D

                                                                                                        Command relations form a closure system, hence a complete Heyting algebra.

                                                                                                        The key property is that arbitrary intersections of command relations are command relations (proved in commandImage_closed_under_sInter).

                                                                                                        Combined with the lattice structure, this gives us a complete Heyting algebra on the set of command relations.

                                                                                                        theorem Comparisons.CommandRelations.command_inf_sup_distrib {Node : Type} (_T : AbstractTree Node) (C D E : Set (Node × Node)) :
                                                                                                        C (D E) = C D C E

                                                                                                        Distributive lattice: Heyting algebras are distributive. This gives us: C ∩ (D ∪ E) = (C ∩ D) ∪ (C ∩ E)

                                                                                                        theorem Comparisons.CommandRelations.command_compl_eq_himp_bot {Node : Type} (_T : AbstractTree Node) (C : Set (Node × Node)) :

                                                                                                        Pseudo-complement: In a Heyting algebra, the complement is Cᶜ = C ⇨ ⊥

                                                                                                        For sets, Cᶜ is the set-theoretic complement.

                                                                                                        theorem Comparisons.CommandRelations.command_inf_compl {Node : Type} (_T : AbstractTree Node) (C : Set (Node × Node)) :

                                                                                                        Pseudo-complement property: C ∩ Cᶜ = ∅

                                                                                                        B&P's Open Question Answered: Command relations do NOT form a Boolean algebra.

                                                                                                        In a Boolean algebra, we would have C ∪ Cᶜ = ⊤ (law of excluded middle). In a Heyting algebra, this fails in general.

                                                                                                        For Set α, this actually DOES hold (sets form a Boolean algebra), but the subtype of command relations may not be closed under complement.

                                                                                                        The key insight from Kracht: complement of a command relation is generally NOT a command relation. Hence command relations form a Heyting algebra but not a Boolean algebra.

                                                                                                        theorem Comparisons.CommandRelations.command_himp_curry {Node : Type} (_T : AbstractTree Node) (A B C : Set (Node × Node)) :
                                                                                                        A B C = A B C

                                                                                                        Currying via Heyting implication: (A ∩ B) ⇨ C = A ⇨ (B ⇨ C)

                                                                                                        This is the "currying" property of Heyting algebras. This follows directly from Mathlib's himp_himp.

                                                                                                        theorem Comparisons.CommandRelations.command_himp_mono_right {Node : Type} (_T : AbstractTree Node) (A B C : Set (Node × Node)) (h : A B) :
                                                                                                        C A C B

                                                                                                        Weakening: A ⊆ B → (C ⇨ A) ⊆ (C ⇨ B)

                                                                                                        theorem Comparisons.CommandRelations.command_compl_anti {Node : Type} (_T : AbstractTree Node) (A B : Set (Node × Node)) (h : A B) :

                                                                                                        Contraposition (weak): A ⊆ B → Bᶜ ⊆ Aᶜ

                                                                                                        A command relation expression in normal form uses only:

                                                                                                        • Base relations C_P (for properties P)
                                                                                                        • Meet (∩)
                                                                                                        • Composition (∘)

                                                                                                        Union is eliminable by J.6. Join is eliminable because for command relations, join = intersection of generators (by the Intersection Theorem).

                                                                                                        Kracht Theorem 9: Every command relation expression has a normal form using only ∩ and ∘.

                                                                                                        Instances For

                                                                                                          Meet in normal form corresponds to union of generators

                                                                                                          @cite{kracht-1993} Coverage Summary #

                                                                                                          Kracht ReferenceNameStatus
                                                                                                          Definition 1Associated FunctionsAssociatedFunction, TightAssociatedFunction
                                                                                                          Theorem 2Fair = Tighttight_implies_fair (partial), fair_implies_tight_exists (sorry)
                                                                                                          Proposition 6Composition Distributivitycommand_comp_inter_left ✓, command_comp_inter_left_rev (sorry)
                                                                                                          Theorem 8Distributoid StructureDistributoid typeclass
                                                                                                          Theorem 9Normal FormsNormalForm, normalForm_meet_is_union
                                                                                                          Lemma 10-11Union Eliminationunion_elimination_forward ✓, union_elimination_reverse
                                                                                                          Theorem 10Heyting AlgebraUses Mathlib's HeytingAlgebra

                                                                                                          Mathlib Integration #

                                                                                                          The Heyting algebra structure now uses Mathlib's HeytingAlgebra typeclass:

                                                                                                          Insights #

                                                                                                          1. Associated functions provide a cleaner interface than relations. The map f : T → T replaces the "minimal P-upper-bound" concept.

                                                                                                          2. Tightness is the key condition ensuring command relations behave well under composition. It's equivalent to B&P's fairness.

                                                                                                          3. Union is eliminable: the full theory can be developed using only ∩ and ∘, which simplifies algebraic manipulations.

                                                                                                          4. Not a Boolean algebra: B&P's open question is answered negatively. Complement doesn't work because command relations lack negation. But they do form a Heyting algebra (intuitionistic logic), which is formalized via Mathlib's HeytingAlgebra typeclass.

                                                                                                          5. Distributoid structure enables representing complex binding conditions (e.g., "commands and doesn't dominate") as compositions and intersections of basic command relations.