(************************************************************************)
(*         *      The Rocq Prover / The Rocq Development Team           *)
(*  v      *         Copyright INRIA, CNRS and contributors             *)
(* <O___,, * (see version control and CREDITS file for authors & dates) *)
(*   \VV/  **************************************************************)
(*    //   *    This file is distributed under the terms of the         *)
(*         *     GNU Lesser General Public License Version 2.1          *)
(*         *     (see LICENSE file for the text of the license)         *)
(************************************************************************)
(** * FMapPositive : an implementation of FMapInterface for [positive] keys. *)
Set Implicit Arguments.
Local Open Scope positive_scope.
Local Unset Elimination Schemes.
(** This file is an adaptation to the [FMap] framework of a work by Xavier Leroy and Sandrine Blazy (used for building certified compilers). Keys are of type [positive], and maps are binary trees: the sequence of binary digits of a positive number corresponds to a path in such a tree. This is quite similar to the [IntMap] library, except that no path compression is implemented, and that the current file is simple enough to be self-contained. *)
(** First, some stuff about [positive] *)
Fixpoint append (i j : positive) : positive :=
match i with
| xH => j
| xI ii => xI (append ii j)
| xO ii => xO (append ii j)
end.

Lemma append_assoc_0 :
forall (i j : positive), append i (xO j) = append (append i (xO xH)) j.