(************************************************************************)
(*         *      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)         *)
(************************************************************************)
(** * Circular Shifts (aka Cyclic Permutations) *)
(** The main inductive [CPermutation] relates lists up to circular shifts of their elements.  For example: [CPermutation [a1;a2;a3;a4;a5] [a4;a5;a1;a2;a3]]  Note: Terminology does not seem to be strongly fixed in English. For the record, it is "permutations circulaires" in French. *)
Set Implicit Arguments.
Local Ltac Tauto.intuition_solver ::= auto with datatypes.
Section CPermutation.
Variable A:Type.
(** Definition *)
Inductive CPermutation : list A -> list A -> Prop :=
| cperm : forall l1 l2, CPermutation (l1 ++ l2) (l2 ++ l1).
Instance CPermutation_Permutation : Proper (CPermutation ==> (@Permutation A)) id.

Lemma CPermutation_split : forall l1 l2,
CPermutation l1 l2 <-> exists n, l2 = skipn n l1 ++ firstn n l1.