# The Stern-Brocot Tree

 Title: The Stern-Brocot Tree Authors: Peter Gammie and Andreas Lochbihler Submission date: 2015-12-22 Abstract: The Stern-Brocot tree contains all rational numbers exactly once and in their lowest terms. We formalise the Stern-Brocot tree as a coinductive tree using recursive and iterative specifications, which we have proven equivalent, and show that it indeed contains all the numbers as stated. Following Hinze, we prove that the Stern-Brocot tree can be linearised looplessly into Stern's diatonic sequence (also known as Dijkstra's fusc function) and that it is a permutation of the Bird tree. The reasoning stays at an abstract level by appealing to the uniqueness of solutions of guarded recursive equations and lifting algebraic laws point-wise to trees and streams using applicative functors. BibTeX: @article{Stern_Brocot-AFP, author = {Peter Gammie and Andreas Lochbihler}, title = {The Stern-Brocot Tree}, journal = {Archive of Formal Proofs}, month = dec, year = 2015, note = {\url{http://isa-afp.org/entries/Stern_Brocot.html}, Formal proof development}, ISSN = {2150-914x}, } License: BSD License Depends on: Applicative_Lifting