(* fonctions réciproques gauche et droite de iad_conv *)

Inductive ad_couple : Set :=
    cpla : ad -> ad -> ad_couple.(* fonctions réciproques gauche et droite de iad_conv *)

Inductive ad_couple : Set :=
    cpla : ad -> ad -> ad_couple.Fixpoint iad_conv_inv_0 (p : positive) : ad_couple :=
  match p with
  | xH => cpla (Npos 1) N0
  | xO xH => cpla N0 (Npos 1)
  | xI xH => cpla (Npos 1) (Npos 1)
  | xO (xO p') =>
      match iad_conv_inv_0 p' with
      | cpla N0 N0 => cpla N0 N0
      | cpla N0 (Npos p1) => cpla N0 (Npos (xO p1))
      | cpla (Npos p0) N0 => cpla (Npos (xO p0)) N0
      | cpla (Npos p0) (Npos p1) => cpla (Npos (xO p0)) (Npos (xO p1))
      end
  | xO (xI p') =>
      match iad_conv_inv_0 p' with
      | cpla N0 N0 => cpla N0 (Npos 1)
      | cpla N0 (Npos p1) => cpla N0 (Npos (xI p1))
      | cpla (Npos p0) N0 => cpla (Npos (xO p0)) (Npos 1)
      | cpla (Npos p0) (Npos p1) => cpla (Npos (xO p0)) (Npos (xI p1))
      end
  | xI (xO p') =>
      match iad_conv_inv_0 p' with
      | cpla N0 N0 => cpla (Npos 1) N0
      | cpla N0 (Npos p1) => cpla (Npos 1) (Npos (xO p1))
      | cpla (Npos p0) N0 => cpla (Npos (xI p0)) N0
      | cpla (Npos p0) (Npos p1) => cpla (Npos (xI p0)) (Npos (xO p1))
      end
  | xI (xI p') =>
      match iad_conv_inv_0 p' with
      | cpla N0 N0 => cpla (Npos 1) (Npos 1)
      | cpla N0 (Npos p1) => cpla (Npos 1) (Npos (xI p1))
      | cpla (Npos p0) N0 => cpla (Npos (xI p0)) (Npos 1)
      | cpla (Npos p0) (Npos p1) => cpla (Npos (xI p0)) (Npos (xI p1))
      end
  end.Definition iad_conv_inv (a : ad) : ad_couple :=
  match a with
  | N0 => cpla N0 N0
  | Npos p => iad_conv_inv_0 p
  end.

Lemma iad_inv_1 : forall p : positive, iad_conv_inv_0 (iad_conv_aux_1 p) = cpla (Npos p) N0.