Section EqShiftL.
(** After killing [n] bits at the left, are the numbers equal ?*)
Definition EqShiftL n x y :=
nshiftl x n = nshiftl y n.
(** * From int31 to list of digits. *)
(** Lower (=rightmost) bits comes first. *)
Definition i2l := recrbis _ nil (fun d _ rec => d::rec).
Fixpoint lshiftl l x :=
match l with
| nil => x
| d::l => sneakl d (lshiftl l x)
end.
Definition l2i l := lshiftl l On.
Fixpoint cstlist (A:Type)(a:A) n :=
match n with
| O => nil
| S n => a::cstlist _ a n
end.
(** [i2l] can be used to define a relation equivalent to [EqShiftL] *)
(** This equivalence allows proving easily the following delicate result *)
End EqShiftL.
(** * More equations about [incr] *)
(** * Conversion from [Z] : the [phi_inv] function *)
(** First, recursive equations *)
(** [phi_inv o inv], the always-exact and easy-to-prove trip : from int31 to Z and then back to int31. *)

Lemma phi_inv_phi_aux :
forall n x, n <= size ->
phi_inv (phibis_aux n (nshiftr x (size-n))) =
nshiftr x (size-n).