Documentation

LeanPool.PureNock.Tree

Nouns #

Inductive proper binary trees with Nat atoms (main.tex:318–349).

inductive Nock.Noun :

Def:noun (main.tex:347–349). n := (t, dt) ∈ L_dk^{2·(λ−1)} × DT(F)^λ := N^λ(F) is a noun of size λ over field F. (paper: field F; Lean: Nat leaves.)

Instances For
    @[instance_reducible]
    Equations
    Equations
    • One or more equations did not get rendered due to their size.
    Instances For
      def Nock.instDecidableEqNoun.decEq (x✝ x✝¹ : Noun) :
      Decidable (x✝ = x✝¹)
      Equations
      Instances For

        ? in Nock terms: is this noun a cell?

        Equations
        Instances For

          Test whether a noun is an atomic value rather than a cell.

          Equations
          Instances For

            Def:tree_nodes (main.tex:329–331). Given t ∈ L_full_BT, a node with no children is a leaf; a non-leaf is an internal node.

            Equations
            Instances For

              Total node count.

              Equations
              Instances For

                Def:tree_nodes (main.tex:329–331). Given t ∈ L_full_BT, a node with no children is a leaf; a non-leaf is an internal node.

                Equations
                Instances For

                  Lem:pbt_size (main.tex:333–335) #

                  theorem Nock.Noun.pbt_size (n : Noun) :
                  n.size = 2 * n.leaves - 1 ∧ n.internal = n.leaves - 1

                  Lem:pbt_size (main.tex:333–335). A tree t ∈ L_full_BT^{2λ−1} has λ−1 internal and λ leaf nodes.

                  theorem Nock.Noun.pbt_size_of_size {n : Noun} {lam : Nat} (hlam : 1 ≤ lam) (h : n.size = 2 * lam - 1) :
                  n.leaves = lam ∧ n.internal = lam - 1

                  Lem:pbt_size (main.tex:333–335). A tree t ∈ L_full_BT^{2λ−1} has λ−1 internal and λ leaf nodes.

                  Every node of a proper binary tree is a leaf or an internal node: size = leaves + internal.

                  Every noun has at least one leaf (atoms contribute 1; cells sum positive leaf counts).

                  The circular S-expression object at main.tex:305–312 is out of scope: the paper restricts subsequent use to proper binary trees.

                  Proper n-ary trees (main.tex:351–364) #

                  The paper includes this unused generalization for completeness.

                  inductive Nock.NAryTree (k : Nat) :

                  Def proper n-ary (main.tex:355–363). L_full_T,n = { t ∈ T^n | (size(t)=1) ∪ ((⋂_{1≤i≤n} child_i(t) ∈ L_full_T^n) ∩ (∅ = ⋂_{1≤i≤n} child_i(t))) }; L^λ_full_T,n = { t ∈ L_full_T^n | size(t)=λ }. Unused in paper body.

                  Instances For
                    def Nock.NAryTree.childi {k : Nat} (i : Fin k) :

                    Return the indexed child of an internal n-ary tree, or none at a leaf.

                    Equations
                    Instances For