FLOC 2018: FEDERATED LOGIC CONFERENCE 2018
Proof Pearl: Constructive Extraction of Cycle Finding Algorithms

Author: Dominique Larchey-Wendling

Paper Information

Title:Proof Pearl: Constructive Extraction of Cycle Finding Algorithms
Authors:Dominique Larchey-Wendling
Proceedings:ITP Papers
Editors: Jeremy Avigad and Assia Mahboubi
Keywords:Cycle finding, Bar inductive predicates, Partial algorithms in Coq, Correctness by extraction
Abstract:

ABSTRACT. We present a short implementation of the well-known Tortoise and Hare cycle finding algorithm attributed to Robert W. Floyd in the constructive setting of axiom-free Coq. This algorithm is interesting from a constructive perspective because it is both very simple and potentially non-terminating (depending on the input). To overcome potential non-termination, we encode the given termination argument (there exists a cycle) into a bar inductive predicate that we use as termination certificate for the Coq implementation. From this development, we extract the standard OCaml implementation of this algorithm. We generalize the method to the full Floyd's algorithm that computes the entry point and the period of the cycle of the iterated sequence, when they do exist. We also consider the case of the more efficient Brent's algorithm for computing the period only. Again, the extracted codes correspond to the standard OCaml implementations of these algorithms.

Pages:17
Talk:Jul 12 12:00 (Session 74C)
Paper: