AFTD Auto-Formalizing Theoretical Domains

TreeRotation

inductive

The inductive relation TreeRotation on BinTree relating two trees that differ by a single rotation: rotating right at the root replacing ((U, V), W) by (U, (V, W)), rotating left at the root replacing (U, (V, W)) by ((U, V), W), or rotating recursively in the left child or the right child.

Statement

inductive TreeRotation : BinTree → BinTree → Prop
Defined in
arXiv:2611.19659, Section 2
Verified
20 Nov 2026
Axioms
none listed
Built on 1
  • BinTreeThe inductive type BinTree of ordered full binary trees with constructors leaf and node left right.
Used by 1
  • associahedronGraphFor each natural number n, the associahedron graph associahedronGraph n is the simple graph whose vertices are ordered full binary trees T…

Read back from the Lean

An inductively defined binary relation TreeRotation on binary trees (BinTree), specifying that one tree can be transformed into another by a single tree rotation anywhere in the tree. The relation is generated by four constructors: 1. rot_right: For all trees U, V, and W, TreeRotation (BinTree.node (BinTree.node U V) W) (BinTree.node U (BinTree.node V W)) holds. 2. rot_left: For all trees U, V, and W, TreeRotation (BinTree.node U (BinTree.node V W)) (BinTree.node (BinTree.node U V) W) holds. 3. node_left: For all trees l, l', and r, if TreeRotation l l' holds, then TreeRotation (BinTree.node l r) (BinTree.node l' r) holds. 4. node_right: For all trees l, r, and r', if TreeRotation r r' holds, then TreeRotation (BinTree.node l r) (BinTree.node l r') holds.

Written by a model that saw only the Lean, never the English above. If the two disagree, that is worth a challenge.

Lean source view module on GitHub

/-- Single tree rotation relation on ordered full binary trees. -/
inductive TreeRotation : BinTree → BinTree → Prop | rot_right (U V W : BinTree) :
      TreeRotation (BinTree.node (BinTree.node U V) W) (BinTree.node U (BinTree.node V W))
  | rot_left (U V W : BinTree) :
      TreeRotation (BinTree.node U (BinTree.node V W)) (BinTree.node (BinTree.node U V) W)
  | node_left {l l' r : BinTree} (h : TreeRotation l l') :
      TreeRotation (BinTree.node l r) (BinTree.node l' r)
  | node_right {l r r' : BinTree} (h : TreeRotation r r') :
      TreeRotation (BinTree.node l r) (BinTree.node l r')
See it in the graphDiscuss this resultChallenge it