(* This file is generated by Why3's Coq driver *)
(* Beware! Only edit allowed sections below    *)
Require Import BuiltIn.
Require BuiltIn.
Require HighOrd.
Require int.Int.
Require int.Abs.
Require int.MinMax.
Require int.EuclideanDivision.
Require real.Real.

Axiom t : Type.
Parameter t_WhyType : WhyType t.
Existing Instance t_WhyType.

Parameter teq: t -> t -> Prop.

Axiom teq_spec : forall (x:t) (y:t), (teq x y) -> (x = y).

Axiom teq_spec1 : forall (x:t) (y:t), (x = y) -> teq x y.

Parameter tzero: t.

Parameter tone: t.

Parameter prefix_mndt: t -> t.

Parameter infix_pldt: t -> t -> t.

Parameter infix_asdt: t -> t -> t.

Axiom Assoc :
  forall (x:t) (y:t) (z:t),
  ((infix_pldt (infix_pldt x y) z) = (infix_pldt x (infix_pldt y z))).

Axiom Unit_def_l : forall (x:t), ((infix_pldt tzero x) = x).

Axiom Unit_def_r : forall (x:t), ((infix_pldt x tzero) = x).

Axiom Inv_def_l : forall (x:t), ((infix_pldt (prefix_mndt x) x) = tzero).

Axiom Inv_def_r : forall (x:t), ((infix_pldt x (prefix_mndt x)) = tzero).

Axiom Comm : forall (x:t) (y:t), ((infix_pldt x y) = (infix_pldt y x)).

Axiom Assoc1 :
  forall (x:t) (y:t) (z:t),
  ((infix_asdt (infix_asdt x y) z) = (infix_asdt x (infix_asdt y z))).

Axiom Mul_distr_l :
  forall (x:t) (y:t) (z:t),
  ((infix_asdt x (infix_pldt y z)) =
   (infix_pldt (infix_asdt x y) (infix_asdt x z))).

Axiom Mul_distr_r :
  forall (x:t) (y:t) (z:t),
  ((infix_asdt (infix_pldt y z) x) =
   (infix_pldt (infix_asdt y x) (infix_asdt z x))).

Axiom Comm1 : forall (x:t) (y:t), ((infix_asdt x y) = (infix_asdt y x)).

Axiom Unitary : forall (x:t), ((infix_asdt tone x) = x).

Axiom NonTrivialRing : ~ (tzero = tone).

Parameter inv: t -> t.

Axiom Inverse :
  forall (x:t), ~ (x = tzero) -> ((infix_asdt x (inv x)) = tone).

(* Why3 assumption *)
Definition infix_mn (x:t) (y:t) : t := infix_pldt x (prefix_mndt y).

(* Why3 assumption *)
Definition infix_sl (x:t) (y:t) : t := infix_asdt x (inv y).

Axiom add_div :
  forall (x:t) (y:t) (z:t), ~ (z = tzero) ->
  ((infix_sl (infix_pldt x y) z) =
   (infix_pldt (infix_sl x z) (infix_sl y z))).

Axiom sub_div :
  forall (x:t) (y:t) (z:t), ~ (z = tzero) ->
  ((infix_sl (infix_mn x y) z) = (infix_mn (infix_sl x z) (infix_sl y z))).

Axiom neg_div :
  forall (x:t) (y:t), ~ (y = tzero) ->
  ((infix_sl (prefix_mndt x) y) = (prefix_mndt (infix_sl x y))).

Axiom assoc_mul_div :
  forall (x:t) (y:t) (z:t), ~ (z = tzero) ->
  ((infix_sl (infix_asdt x y) z) = (infix_asdt x (infix_sl y z))).

Axiom assoc_div_mul :
  forall (x:t) (y:t) (z:t), (~ (y = tzero) /\ ~ (z = tzero)) ->
  ((infix_sl (infix_sl x y) z) = (infix_sl x (infix_asdt y z))).

Axiom assoc_div_div :
  forall (x:t) (y:t) (z:t), (~ (y = tzero) /\ ~ (z = tzero)) ->
  ((infix_sl x (infix_sl y z)) = (infix_sl (infix_asdt x z) y)).

(* Why3 assumption *)
Definition infix_mndt (x:t) (y:t) : t := infix_pldt x (prefix_mndt y).

Parameter infix_sldt: t -> t -> t.

Axiom infix_sldt_spec :
  forall (x:t) (y:t), ~ (y = tzero) ->
  ((infix_sldt x y) = (infix_asdt x (inv y))).

Parameter infix_slas: R -> R -> R.

Axiom infix_slas_def :
  forall (x:R) (y:R), ~ (y = 0%R) -> ((infix_slas x y) = (x / y)%R).

Parameter infix_eqas: R -> R -> Prop.

Axiom infix_eqas_spec : forall (x:R) (y:R), (infix_eqas x y) -> (x = y).

Axiom infix_eqas_spec1 : forall (x:R) (y:R), (x = y) -> infix_eqas x y.

Parameter infix_lsgtas: R -> R -> Prop.

Axiom infix_lsgtas_spec :
  forall (x:R) (y:R), (infix_lsgtas x y) -> ~ (x = y).

Axiom infix_lsgtas_spec1 : forall (x:R) (y:R), ~ (x = y) -> infix_lsgtas x y.

(* Why3 assumption *)
Definition infix_mnas (x:R) (y:R) : R := (x + (-y)%R)%R.

(* Why3 assumption *)
Definition infix_lsas (x:R) (y:R) : Prop := (x <= y)%R /\ (infix_lsgtas x y).

Parameter from_int: Z -> R.

Axiom Zero : ((from_int 0%Z) = 0%R).

Axiom One : ((from_int 1%Z) = 1%R).

Axiom Add :
  forall (x:Z) (y:Z),
  ((from_int (x + y)%Z) = ((from_int x) + (from_int y))%R).

Axiom Sub :
  forall (x:Z) (y:Z),
  ((from_int (x - y)%Z) = (infix_mnas (from_int x) (from_int y))).

Axiom Mul :
  forall (x:Z) (y:Z),
  ((from_int (x * y)%Z) = ((from_int x) * (from_int y))%R).

Axiom Neg : forall (x:Z), ((from_int (-x)%Z) = (-(from_int x))%R).

Axiom Injective :
  forall (x:Z) (y:Z), ((from_int x) = (from_int y)) -> (x = y).

Axiom Monotonic :
  forall (x:Z) (y:Z), (x <= y)%Z -> ((from_int x) <= (from_int y))%R.

Axiom r_zeroLessOne : (0%R <= 1%R)%R.

Axiom r_compatOrderAdd :
  forall (x:R) (y:R) (z:R), (x <= y)%R -> ((x + z)%R <= (y + z)%R)%R.

Axiom r_compatOrderMult :
  forall (x:R) (y:R) (z:R), (x <= y)%R -> (0%R <= z)%R ->
  ((x * z)%R <= (y * z)%R)%R.

Axiom Absorbing_zero :
  forall (a:t) (b:t), ((infix_asdt a b) = tzero) -> ~ (a = tzero) ->
  (b = tzero).

Axiom Absorbing_zero1 :
  forall (a:t) (b:t), (a = tzero) -> ((infix_asdt a b) = tzero).

Axiom Absorbing_zero2 :
  forall (a:t) (b:t), (b = tzero) -> ((infix_asdt a b) = tzero).

Axiom absorbing_zero :
  forall (a:t) (b:t), ((infix_asdt a b) = tzero) -> ~ (a = tzero) ->
  (b = tzero).

Axiom absorbing_zero1 :
  forall (a:t) (b:t), ((infix_asdt a b) = tzero) -> ~ (b = tzero) ->
  (a = tzero).

Axiom invol_neg : forall (a:t), ((prefix_mndt (prefix_mndt a)) = a).

Axiom mult_num :
  forall (a:t) (b:t) (c:t), ~ (c = tzero) ->
  ((infix_sldt (infix_asdt a b) c) = (infix_asdt a (infix_sldt b c))).

Axiom mult_denom :
  forall (a:t) (b:t) (c:t), ~ (c = tzero) -> ~ (b = tzero) ->
  ((infix_sldt a (infix_asdt b c)) =
   (infix_asdt (infix_sldt a b) (infix_sldt tone c))).

Axiom mult_simpl :
  forall (a:t) (b:t) (c:t), ~ (c = tzero) -> ~ (b = tzero) ->
  ((infix_sldt (infix_asdt a b) (infix_asdt c b)) = (infix_sldt a c)).

Axiom non_zero_prod :
  forall (a:t) (b:t), ~ (a = tzero) -> ~ (b = tzero) ->
  ~ ((infix_asdt a b) = tzero).

Axiom minus_tone :
  forall (a:t), ((prefix_mndt a) = (infix_asdt (prefix_mndt tone) a)).

Axiom mult_neg_l :
  forall (a:t) (b:t),
  ((infix_asdt (prefix_mndt a) b) = (prefix_mndt (infix_asdt a b))).

Axiom mult_neg_r :
  forall (a:t) (b:t),
  ((infix_asdt a (prefix_mndt b)) = (prefix_mndt (infix_asdt a b))).

Axiom invadd :
  forall (i:t), ((prefix_mndt i) = (infix_asdt (prefix_mndt tone) i)).

Axiom notZeroAdd :
  forall (x:t) (y:t), ~ (x = tzero) -> ~ ((infix_pldt x y) = y).

Parameter im: t.

Axiom im_Def : ((infix_asdt im im) = (prefix_mndt tone)).

Parameter r_to_t: R -> t.

Axiom r_to_t_zero : ((r_to_t 0%R) = tzero).

Axiom r_to_t_one : ((r_to_t 1%R) = tone).

Axiom r_to_t_add :
  forall (i:R) (j:R),
  ((infix_pldt (r_to_t i) (r_to_t j)) = (r_to_t (i + j)%R)).

Axiom r_to_t_mult :
  forall (i:R) (j:R),
  ((infix_asdt (r_to_t i) (r_to_t j)) = (r_to_t (i * j)%R)).

Axiom r_to_t_sub :
  forall (i:R) (j:R),
  ((infix_mndt (r_to_t i) (r_to_t j)) = (r_to_t (infix_mnas i j))).

Axiom r_to_t_div :
  forall (i:R) (j:R), ~ (j = 0%R) ->
  ((infix_sldt (r_to_t i) (r_to_t j)) = (r_to_t (infix_slas i j))).

Parameter real_part: t -> R.

Parameter im_part: t -> R.

Axiom Real_part_add :
  forall (i:t) (j:t),
  ((real_part (infix_pldt i j)) = ((real_part i) + (real_part j))%R).

Axiom Im_part_add :
  forall (i:t) (j:t),
  ((im_part (infix_pldt i j)) = ((im_part i) + (im_part j))%R).

Axiom real_part_add :
  forall (i:t) (j:t),
  ((real_part (infix_pldt i j)) = ((real_part i) + (real_part j))%R).

Axiom im_part_add :
  forall (i:t) (j:t),
  ((im_part (infix_pldt i j)) = ((im_part i) + (im_part j))%R).

Axiom Complex_decomp :
  forall (i:t),
  (i =
   (infix_pldt (r_to_t (real_part i)) (infix_asdt im (r_to_t (im_part i))))).

Axiom Unic_decomp :
  forall (i:t), forall (x:R) (y:R),
  (i = (infix_pldt (r_to_t x) (infix_asdt im (r_to_t y)))) ->
  (x = (real_part i)).

Axiom Unic_decomp1 :
  forall (i:t), forall (x:R) (y:R),
  (i = (infix_pldt (r_to_t x) (infix_asdt im (r_to_t y)))) ->
  (y = (im_part i)).

Axiom injective_real_part :
  forall (i:t) (j:t), ~ ((real_part i) = (real_part j)) -> ~ (i = j).

Axiom injective_im_part :
  forall (i:t) (j:t), ~ ((im_part i) = (im_part j)) -> ~ (i = j).

Axiom complex_decomp :
  forall (i:t),
  (i =
   (infix_pldt (r_to_t (real_part i)) (infix_asdt im (r_to_t (im_part i))))).

Axiom unic_decomp :
  forall (i:t) (x:R) (y:R),
  (i = (infix_pldt (r_to_t x) (infix_asdt im (r_to_t y)))) ->
  (x = (real_part i)).

Axiom unic_decomp1 :
  forall (i:t) (x:R) (y:R),
  (i = (infix_pldt (r_to_t x) (infix_asdt im (r_to_t y)))) ->
  (y = (im_part i)).

(* Why3 assumption *)
Definition real_ (x:t) : Prop := ((im_part x) = 0%R).

(* Why3 assumption *)
Definition pure_im_ (x:t) : Prop := ((real_part x) = 0%R).

Parameter pi: t.

Axiom pi_def : real_ pi.

Axiom r_to_t_real : forall (x:t), (real_ x) -> (x = (r_to_t (real_part x))).

Axiom real_r_to_t : forall (x:R), real_ (r_to_t x).

Axiom r_to_t_pure_im :
  forall (x:t), (pure_im_ x) -> (x = (infix_asdt im (r_to_t (im_part x)))).

Axiom simpl_frac :
  forall (x:t) (y:t), ~ (y = tzero) -> ((infix_sldt (infix_asdt x y) y) = x).

Axiom simpl_frac_ :
  forall (x:t) (y:t) (z:t), ~ (y = tzero) -> ~ (z = tzero) ->
  ((infix_sldt (infix_asdt x y) (infix_asdt z y)) = (infix_sldt x z)).

Axiom fact_frac :
  forall (x:t) (y:t) (z:t), ~ (z = tzero) ->
  ((infix_sldt (infix_asdt x y) z) = (infix_asdt x (infix_sldt y z))).

Axiom fact_frac_rev :
  forall (x:t) (y:t) (z:t), ~ (z = tzero) ->
  ((infix_asdt x (infix_sldt y z)) = (infix_sldt (infix_asdt x y) z)).

Axiom inv_mult :
  forall (x:t) (y:t), ~ (x = tzero) -> ~ (y = tzero) ->
  ((infix_asdt (infix_sldt tone x) (infix_sldt tone y)) =
   (infix_sldt tone (infix_asdt x y))).

Axiom div_div :
  forall (x:t) (y:t) (z:t), ~ (y = tzero) -> ~ (z = tzero) ->
  ((infix_sldt (infix_sldt x y) z) = (infix_sldt x (infix_asdt y z))).

Axiom div_div_rev :
  forall (x:t) (y:t) (z:t), ~ (y = tzero) -> ~ (z = tzero) ->
  ((infix_sldt x (infix_asdt y z)) = (infix_sldt (infix_sldt x y) z)).

Axiom involutive_inv :
  forall (a:t), ~ (a = tzero) -> ((infix_sldt tone (infix_sldt tone a)) = a).

Parameter infix_lseqdt: t -> t -> Prop.

Axiom Inf_eq_def :
  forall (x:t) (y:t), (infix_lseqdt x y) -> (real_ x) \/ (x = y).

Axiom Inf_eq_def1 :
  forall (x:t) (y:t), (infix_lseqdt x y) -> (real_ y) \/ (x = y).

Axiom Inf_eq_def2 :
  forall (x:t) (y:t), (infix_lseqdt x y) ->
  ((real_part x) <= (real_part y))%R \/ (x = y).

Axiom Inf_eq_def3 :
  forall (x:t) (y:t),
  ((real_ x) /\ ((real_ y) /\ ((real_part x) <= (real_part y))%R)) ->
  infix_lseqdt x y.

Axiom Inf_eq_def4 : forall (x:t) (y:t), (x = y) -> infix_lseqdt x y.

Parameter infix_lsdt: t -> t -> Prop.

Parameter infix_gteqdt: t -> t -> Prop.

Parameter infix_gtdt: t -> t -> Prop.

Axiom inf_st : forall (x:t) (y:t), (infix_lsdt x y) -> infix_lseqdt x y.

Axiom inf_st1 : forall (x:t) (y:t), (infix_lsdt x y) -> ~ (x = y).

Axiom inf_st2 :
  forall (x:t) (y:t), ((infix_lseqdt x y) /\ ~ (x = y)) -> infix_lsdt x y.

Axiom sup_eq : forall (x:t) (y:t), (infix_gteqdt x y) -> infix_lseqdt y x.

Axiom sup_eq1 : forall (x:t) (y:t), (infix_lseqdt y x) -> infix_gteqdt x y.

Axiom sup_st : forall (x:t) (y:t), (infix_gtdt x y) -> infix_gteqdt x y.

Axiom sup_st1 : forall (x:t) (y:t), (infix_gtdt x y) -> ~ (x = y).

Axiom sup_st2 :
  forall (x:t) (y:t), ((infix_gteqdt x y) /\ ~ (x = y)) -> infix_gtdt x y.

Axiom Refl : forall (x:t), infix_lseqdt x x.

Axiom Trans :
  forall (x:t) (y:t) (z:t), (infix_lseqdt x y) -> (infix_lseqdt y z) ->
  infix_lseqdt x z.

Axiom Antisymm :
  forall (x:t) (y:t), (infix_lseqdt x y) -> (infix_lseqdt y x) -> (x = y).

Axiom Refl1 : forall (x:t), infix_gteqdt x x.

Axiom Trans1 :
  forall (x:t) (y:t) (z:t), (infix_gteqdt x y) -> (infix_gteqdt y z) ->
  infix_gteqdt x z.

Axiom Antisymm1 :
  forall (x:t) (y:t), (infix_gteqdt x y) -> (infix_gteqdt y x) -> (x = y).

Axiom Trans2 :
  forall (x:t) (y:t) (z:t), (infix_lsdt x y) -> (infix_lsdt y z) ->
  infix_lsdt x z.

Axiom Asymm : forall (x:t) (y:t), (infix_lsdt x y) -> ~ (infix_lsdt y x).

Axiom Trans3 :
  forall (x:t) (y:t) (z:t), (infix_gtdt x y) -> (infix_gtdt y z) ->
  infix_gtdt x z.

Axiom Asymm1 : forall (x:t) (y:t), (infix_gtdt x y) -> ~ (infix_gtdt y x).

Axiom r_to_t_inf :
  forall (i:R) (j:R), (infix_lseqdt (r_to_t i) (r_to_t j)) -> (i <= j)%R.

Axiom r_to_t_inf1 :
  forall (i:R) (j:R), (i <= j)%R -> infix_lseqdt (r_to_t i) (r_to_t j).

Axiom inf_eq_def :
  forall (x:t) (y:t), (infix_lseqdt x y) -> (real_ x) \/ (x = y).

Axiom inf_eq_def1 :
  forall (x:t) (y:t), (infix_lseqdt x y) -> (real_ y) \/ (x = y).

Axiom inf_eq_def2 :
  forall (x:t) (y:t), (infix_lseqdt x y) ->
  ((real_part x) <= (real_part y))%R \/ (x = y).

Axiom inf_eq_def3 :
  forall (x:t) (y:t),
  ((real_ x) /\ ((real_ y) /\ ((real_part x) <= (real_part y))%R)) ->
  infix_lseqdt x y.

Axiom inf_eq_def4 : forall (x:t) (y:t), (x = y) -> infix_lseqdt x y.

Axiom inf_def : forall (x:t) (y:t), (infix_lsdt x y) -> real_ x.

Axiom inf_def1 : forall (x:t) (y:t), (infix_lsdt x y) -> real_ y.

Axiom inf_def2 :
  forall (x:t) (y:t), (infix_lsdt x y) ->
  infix_lsas (real_part x) (real_part y).

Axiom inf_def3 :
  forall (x:t) (y:t),
  ((real_ x) /\ ((real_ y) /\ (infix_lsas (real_part x) (real_part y)))) ->
  infix_lsdt x y.

Axiom sup_eq_def :
  forall (x:t) (y:t), (infix_gteqdt x y) -> (real_ x) \/ (x = y).

Axiom sup_eq_def1 :
  forall (x:t) (y:t), (infix_gteqdt x y) -> (real_ y) \/ (x = y).

Axiom sup_eq_def2 :
  forall (x:t) (y:t), (infix_gteqdt x y) ->
  ((real_part y) <= (real_part x))%R \/ (x = y).

Axiom sup_eq_def3 :
  forall (x:t) (y:t),
  ((real_ x) /\ ((real_ y) /\ ((real_part y) <= (real_part x))%R)) ->
  infix_gteqdt x y.

Axiom sup_eq_def4 : forall (x:t) (y:t), (x = y) -> infix_gteqdt x y.

Axiom sup_def : forall (x:t) (y:t), (infix_gtdt x y) -> real_ x.

Axiom sup_def1 : forall (x:t) (y:t), (infix_gtdt x y) -> real_ y.

Axiom sup_def2 :
  forall (x:t) (y:t), (infix_gtdt x y) ->
  infix_lsas (real_part y) (real_part x).

Axiom sup_def3 :
  forall (x:t) (y:t),
  ((real_ x) /\ ((real_ y) /\ (infix_lsas (real_part y) (real_part x)))) ->
  infix_gtdt x y.

Axiom decomp_mult :
  forall (a:t) (b:t),
  ((infix_asdt a b) =
   (infix_pldt
    (infix_mndt (infix_asdt (r_to_t (real_part a)) (r_to_t (real_part b)))
     (infix_asdt (r_to_t (im_part a)) (r_to_t (im_part b))))
    (infix_asdt im
     (infix_pldt (infix_asdt (r_to_t (real_part a)) (r_to_t (im_part b)))
      (infix_asdt (r_to_t (real_part b)) (r_to_t (im_part a))))))).

Axiom decomp_mult_real_part :
  forall (a:t) (b:t),
  ((real_part (infix_asdt a b)) =
   (infix_mnas ((real_part a) * (real_part b))%R
    ((im_part a) * (im_part b))%R)).

Axiom decomp_mult_im_part :
  forall (a:t) (b:t),
  ((im_part (infix_asdt a b)) =
   (((real_part a) * (im_part b))%R + ((real_part b) * (im_part a))%R)%R).

(* Why3 assumption *)
Definition t_real_part (x:t) : t := r_to_t (real_part x).

Axiom t_real_part_spec : forall (x:t), real_ (t_real_part x).

(* Why3 assumption *)
Definition t_im_part (x:t) : t := r_to_t (im_part x).

Axiom t_im_part_spec : forall (x:t), real_ (t_im_part x).

Axiom t_mult_real :
  forall (a:t) (b:t),
  ((t_real_part (infix_asdt a b)) =
   (infix_mndt (infix_asdt (t_real_part a) (t_real_part b))
    (infix_asdt (t_im_part a) (t_im_part b)))).

Axiom t_im_real :
  forall (a:t) (b:t),
  ((t_im_part (infix_asdt a b)) =
   (infix_pldt (infix_asdt (t_real_part a) (t_im_part b))
    (infix_asdt (t_im_part a) (t_real_part b)))).

Axiom t_decomp_mult :
  forall (a:t) (b:t),
  ((infix_asdt a b) =
   (infix_pldt
    (infix_mndt (infix_asdt (t_real_part a) (t_real_part b))
     (infix_asdt (t_im_part a) (t_im_part b)))
    (infix_asdt im
     (infix_pldt (infix_asdt (t_real_part a) (t_im_part b))
      (infix_asdt (t_im_part a) (t_real_part b)))))).

Axiom t_complex_decomp :
  forall (i:t),
  (i = (infix_pldt (t_real_part i) (infix_asdt im (t_im_part i)))).

Axiom t_unic_decomp :
  forall (i:t) (a:t) (b:t), (real_ a) -> (real_ b) ->
  (i = (infix_pldt a (infix_asdt im b))) -> (a = (t_real_part i)).

Axiom t_unic_decomp1 :
  forall (i:t) (a:t) (b:t), (real_ a) -> (real_ b) ->
  (i = (infix_pldt a (infix_asdt im b))) -> (b = (t_im_part i)).

Axiom real_sum :
  forall (x:t) (y:t), (real_ x) -> (real_ y) -> real_ (infix_pldt x y).

Axiom real_diff :
  forall (x:t) (y:t), (real_ x) -> (real_ y) -> real_ (infix_mndt x y).

Axiom pure_im_sum :
  forall (x:t) (y:t), (pure_im_ x) -> (pure_im_ y) ->
  pure_im_ (infix_pldt x y).

Axiom pure_im_diff :
  forall (x:t) (y:t), (pure_im_ x) -> (pure_im_ y) ->
  pure_im_ (infix_mndt x y).

Axiom real_mult :
  forall (x:t) (y:t), (real_ x) -> (real_ y) -> real_ (infix_asdt x y).

Axiom real_inv :
  forall (x:t), (real_ x) -> ~ (x = tzero) -> real_ (infix_sldt tone x).

Axiom real_div :
  forall (x:t) (y:t), (real_ x) -> ~ (y = tzero) -> (real_ y) ->
  real_ (infix_sldt x y).

Axiom mult_real_real :
  forall (a:t) (b:t), (real_ a) -> (real_ b) ->
  ((infix_asdt a b) =
   (infix_asdt (r_to_t (real_part a)) (r_to_t (real_part b)))).

Axiom mult_real_real1 :
  forall (a:t) (b:t), (real_ a) -> (real_ b) ->
  ((infix_asdt (r_to_t (real_part a)) (r_to_t (real_part b))) =
   (r_to_t ((real_part a) * (real_part b))%R)).

Axiom mult_real_real2 :
  forall (a:t) (b:t), (real_ a) -> (real_ b) ->
  ((real_part (infix_asdt a b)) = ((real_part a) * (real_part b))%R).

Axiom mult_real_real3 :
  forall (a:t) (b:t), (real_ a) -> (real_ b) ->
  ((im_part (infix_asdt a b)) = 0%R).

Axiom mult_im_im :
  forall (a:t) (b:t), (pure_im_ a) -> (pure_im_ b) ->
  ((infix_asdt a b) =
   (infix_asdt (infix_asdt im im)
    (infix_asdt (r_to_t (im_part a)) (r_to_t (im_part b))))).

Axiom mult_im_im1 :
  forall (a:t) (b:t), (pure_im_ a) -> (pure_im_ b) ->
  ((infix_asdt a b) = (prefix_mndt (r_to_t ((im_part a) * (im_part b))%R))).

Axiom mult_im_im2 :
  forall (a:t) (b:t), (pure_im_ a) -> (pure_im_ b) ->
  ((real_part (infix_asdt a b)) = (-((im_part a) * (im_part b))%R)%R).

Axiom mult_im_im3 :
  forall (a:t) (b:t), (pure_im_ a) -> (pure_im_ b) ->
  ((im_part (infix_asdt a b)) = 0%R).

Axiom mult_real_im :
  forall (a:t) (b:t), (real_ a) -> (pure_im_ b) ->
  ((infix_asdt a b) =
   (infix_asdt im (infix_asdt (r_to_t (real_part a)) (r_to_t (im_part b))))).

Axiom mult_real_im1 :
  forall (a:t) (b:t), (real_ a) -> (pure_im_ b) ->
  ((infix_asdt a b) =
   (infix_asdt im (r_to_t ((real_part a) * (im_part b))%R))).

Axiom mult_real_im2 :
  forall (a:t) (b:t), (real_ a) -> (pure_im_ b) ->
  ((real_part (infix_asdt a b)) = 0%R).

Axiom mult_real_im3 :
  forall (a:t) (b:t), (real_ a) -> (pure_im_ b) ->
  ((im_part (infix_asdt a b)) = ((real_part a) * (im_part b))%R).

Axiom mult_im_real :
  forall (a:t) (b:t), (pure_im_ a) -> (real_ b) ->
  ((infix_asdt a b) =
   (infix_asdt im (infix_asdt (r_to_t (im_part a)) (r_to_t (real_part b))))).

Axiom mult_im_real1 :
  forall (a:t) (b:t), (pure_im_ a) -> (real_ b) ->
  ((infix_asdt a b) =
   (infix_asdt im (r_to_t ((im_part a) * (real_part b))%R))).

Axiom mult_im_real2 :
  forall (a:t) (b:t), (pure_im_ a) -> (real_ b) ->
  ((real_part (infix_asdt a b)) = 0%R).

Axiom mult_im_real3 :
  forall (a:t) (b:t), (pure_im_ a) -> (real_ b) ->
  ((im_part (infix_asdt a b)) = ((im_part a) * (real_part b))%R).

Axiom decomp_mult_gen :
  forall (a:t) (b:t),
  ((real_part (infix_asdt a b)) =
   (infix_mnas ((real_part a) * (real_part b))%R
    ((im_part a) * (im_part b))%R)).

Axiom decomp_mult_gen1 :
  forall (a:t) (b:t),
  ((im_part (infix_asdt a b)) =
   (((real_part a) * (im_part b))%R + ((im_part a) * (real_part b))%R)%R).

Axiom inv_real :
  forall (a:t), ~ (a = tzero) -> (real_ a) ->
  ((real_part (infix_sldt tone a)) = (infix_slas 1%R (real_part a))).

Axiom inv_real1 :
  forall (a:t), ~ (a = tzero) -> (real_ a) -> real_ (infix_sldt tone a).

Axiom zeroLessOne : infix_lseqdt tzero tone.

Axiom compatOrderAdd :
  forall (x:t) (y:t) (z:t), (infix_lseqdt x y) -> (real_ x) -> (real_ y) ->
  (real_ z) -> infix_lseqdt (infix_pldt x z) (infix_pldt y z).

Axiom compat_order_mult :
  forall (x:t) (y:t) (z:t), (infix_lseqdt x y) -> (real_ x) -> (real_ y) ->
  (real_ z) -> (infix_lseqdt tzero z) ->
  infix_lseqdt (infix_asdt x z) (infix_asdt y z).

Axiom strict_compat_order_mult :
  forall (x:t) (y:t) (z:t), (infix_lsdt x y) -> (real_ x) -> (real_ y) ->
  (real_ z) -> (infix_lsdt tzero z) ->
  infix_lsdt (infix_asdt x z) (infix_asdt y z).

Axiom inv_eqinf :
  forall (x:t) (y:t), (real_ x) -> (real_ y) ->
  ((infix_lsdt tzero x) /\ (infix_lseqdt x y)) ->
  infix_gteqdt (infix_sldt tone x) (infix_sldt tone y).

Axiom inv_inf :
  forall (x:t) (y:t), (real_ x) -> (real_ y) ->
  ((infix_lsdt tzero x) /\ (infix_lsdt x y)) ->
  infix_gtdt (infix_sldt tone x) (infix_sldt tone y).

Axiom inv_eqsup :
  forall (x:t) (y:t), (real_ x) -> (real_ y) ->
  ((infix_gteqdt x y) /\ (infix_gtdt y tzero)) ->
  infix_lseqdt (infix_sldt tone x) (infix_sldt tone y).

Axiom inv_sup :
  forall (x:t) (y:t), (real_ x) -> (real_ y) ->
  ((infix_gtdt x y) /\ (infix_gtdt y tzero)) ->
  infix_lsdt (infix_sldt tone x) (infix_sldt tone y).

Axiom inv_pos :
  forall (x:t), (real_ x) -> (infix_lsdt tzero x) ->
  infix_gtdt (infix_sldt tone x) tzero.

Axiom inv_neg :
  forall (x:t), (real_ x) -> (infix_gtdt tzero x) ->
  infix_lsdt (infix_sldt tone x) tzero.

Axiom zero_add_t :
  forall (a1:t) (a2:t), (a1 = tzero) -> ((infix_pldt a1 a2) = a2).

Axiom add_zero_t :
  forall (a1:t) (a2:t), (a2 = tzero) -> ((infix_pldt a1 a2) = a1).

Axiom one_mult_t :
  forall (a1:t) (a2:t), (a1 = tone) -> ((infix_asdt a1 a2) = a2).

Axiom one_mult_t_const : forall (a:t), ((infix_asdt tone a) = a).

Axiom zero_mult_t_const : forall (a:t), ((infix_asdt tzero a) = tzero).

Axiom mult_zero_t_const : forall (a:t), ((infix_asdt a tzero) = tzero).

Axiom zero_mult_t :
  forall (a1:t) (a2:t), (a1 = tzero) -> ((infix_asdt a1 a2) = tzero).

Axiom mult_zero_t :
  forall (a1:t) (a2:t), (a1 = tzero) -> ((infix_asdt a2 a1) = tzero).

Axiom mult_one_t :
  forall (a1:t) (a2:t), (a2 = tone) -> ((infix_asdt a1 a2) = a1).

Axiom add_eq_t :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_pldt a1 b1) = (infix_pldt a2 b2)).

Axiom add_eq_t_rev :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_pldt a1 b1) = (infix_pldt b2 a2)).

Axiom mult_eq_t :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_asdt a1 b1) = (infix_asdt a2 b2)).

Axiom mult_eq_t_rev :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_asdt a1 b1) = (infix_asdt b2 a2)).

Axiom mult_comm : forall (a:t) (b:t), ((infix_asdt a b) = (infix_asdt b a)).

Axiom mult_assoc :
  forall (a:t) (b:t) (c:t),
  ((infix_asdt (infix_asdt a b) c) = (infix_asdt a (infix_asdt b c))).

Axiom mult_assoc_rev :
  forall (a:t) (b:t) (c:t),
  ((infix_asdt a (infix_asdt b c)) = (infix_asdt (infix_asdt a b) c)).

Axiom div_mult :
  forall (a:t) (b:t) (c:t), ~ (c = tzero) ->
  ((infix_asdt a (infix_sldt b c)) = (infix_sldt (infix_asdt a b) c)).

Axiom div_mult_rev :
  forall (a:t) (b:t) (c:t), ~ (c = tzero) ->
  ((infix_sldt (infix_asdt a b) c) = (infix_asdt a (infix_sldt b c))).

Axiom div_eq :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ~ (b1 = tzero) -> ((infix_sldt a1 b1) = (infix_sldt a2 b2)).

Axiom add_eq_inv_t :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_pldt a1 b1) = (infix_pldt b2 a2)).

Axiom mult_eq_inv_t :
  forall (a1:t) (a2:t) (b1:t) (b2:t), (a1 = a2) -> (b1 = b2) ->
  ((infix_asdt a1 b1) = (infix_asdt b2 a2)).

Axiom sum_frac :
  forall (a1:t) (a2:t) (b:t), ~ (b = tzero) ->
  ((infix_pldt (infix_sldt a1 b) (infix_sldt a2 b)) =
   (infix_sldt (infix_pldt a1 a2) b)).

Axiom sum_frac_rev :
  forall (a1:t) (a2:t) (b:t), ~ (b = tzero) ->
  ((infix_sldt (infix_pldt a1 a2) b) =
   (infix_pldt (infix_sldt a1 b) (infix_sldt a2 b))).

Parameter fir:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a* b)%type ->
  a.

Parameter sec:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a* b)%type ->
  b.

Axiom projections :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (o:(a* b)%type), (o = (fir o, sec o)).

Axiom get_fir :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (b1:b), ((fir (a1, b1)) = a1).

Axiom get_sec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (b1:b), ((sec (a1, b1)) = b1).

Axiom real : forall (x:t), (real_ x) -> (x = (r_to_t (real_part x))).

Axiom pure_im :
  forall (x:t), (pure_im_ x) -> (x = (infix_asdt im (r_to_t (im_part x)))).

Axiom im_dec : ((real_part im) = 0%R).

Axiom im_dec1 : ((im_part im) = 1%R).

Axiom tone_dec : ((real_part tone) = 1%R).

Axiom tone_dec1 : ((im_part tone) = 0%R).

Axiom tzero_dec : ((real_part tzero) = 0%R).

Axiom tzero_dec1 : ((im_part tzero) = 0%R).

Axiom ttwo_dec : ((real_part (infix_pldt tone tone)) = 2%R).

Axiom ttwo_dec1 : ((im_part (infix_pldt tone tone)) = 0%R).

(* Why3 assumption *)
Definition i_to_t (i:Z) : t := r_to_t (from_int i).

Axiom i_to_t_spec : forall (i:Z), real_ (i_to_t i).

Axiom i_to_t_zero : ((i_to_t 0%Z) = tzero).

Axiom i_to_t_eq : forall (i:Z) (j:Z), (i = j) -> ((i_to_t i) = (i_to_t j)).

Axiom i_to_t_nzero : forall (i:Z), ~ (i = 0%Z) -> ~ ((i_to_t i) = tzero).

Axiom i_to_t_one : ((i_to_t 1%Z) = tone).

Axiom i_to_t_add :
  forall (i:Z) (j:Z),
  ((infix_pldt (i_to_t i) (i_to_t j)) = (i_to_t (i + j)%Z)).

Axiom i_to_t_add_rev :
  forall (i:Z) (j:Z),
  ((i_to_t (i + j)%Z) = (infix_pldt (i_to_t i) (i_to_t j))).

Axiom i_to_t_ttwo : ((i_to_t 2%Z) = (infix_pldt tone tone)).

Axiom i_to_t_mult :
  forall (i:Z) (j:Z),
  ((infix_asdt (i_to_t i) (i_to_t j)) = (i_to_t (i * j)%Z)).

Axiom i_to_t_mult_rev :
  forall (i:Z) (j:Z),
  ((i_to_t (i * j)%Z) = (infix_asdt (i_to_t i) (i_to_t j))).

Axiom i_to_t_sub :
  forall (i:Z) (j:Z),
  ((infix_mndt (i_to_t i) (i_to_t j)) = (i_to_t (i - j)%Z)).

Axiom i_to_t_opp :
  forall (i:Z), ((i_to_t (-i)%Z) = (prefix_mndt (i_to_t i))).

Axiom i_to_t_div :
  forall (i:Z) (j:Z), ~ (j = 0%Z) ->
  ((infix_sldt (i_to_t (i * j)%Z) (i_to_t j)) = (i_to_t i)).

Axiom set : forall (a:Type), Type.
Parameter set_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (set a).
Existing Instance set_WhyType.

Parameter mem: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> Prop.

Parameter infix_eqeq:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> Prop.

Axiom infix_eqeq_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (infix_eqeq s1 s2) -> forall (x:a),
  (mem x s1) -> mem x s2.

Axiom infix_eqeq_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (infix_eqeq s1 s2) -> forall (x:a),
  (mem x s2) -> mem x s1.

Axiom infix_eqeq_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (forall (x:a), (mem x s1) <-> (mem x s2)) ->
  infix_eqeq s1 s2.

Axiom extensionality :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (infix_eqeq s1 s2) -> (s1 = s2).

Parameter subset:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> Prop.

Axiom subset_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (subset s1 s2) -> forall (x:a), (mem x s1) ->
  mem x s2.

Axiom subset_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (forall (x:a), (mem x s1) -> mem x s2) ->
  subset s1 s2.

Axiom subset_refl :
  forall {a:Type} {a_WT:WhyType a}, forall (s:set a), subset s s.

Axiom subset_trans :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a) (s3:set a), (subset s1 s2) ->
  (subset s2 s3) -> subset s1 s3.

Parameter is_empty: forall {a:Type} {a_WT:WhyType a}, (set a) -> Prop.

Axiom is_empty_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (is_empty s) -> forall (x:a), ~ (mem x s).

Axiom is_empty_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (forall (x:a), ~ (mem x s)) -> is_empty s.

Parameter empty: forall {a:Type} {a_WT:WhyType a}, set a.

Axiom empty_def : forall {a:Type} {a_WT:WhyType a}, is_empty (empty : set a).

Parameter add: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> set a.

Axiom add_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (mem y (add x s)) ->
  (y = x) \/ (mem y s).

Axiom add_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (y = x) -> mem y (add x s).

Axiom add_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (mem y s) -> mem y (add x s).

Parameter remove: forall {a:Type} {a_WT:WhyType a}, a -> (set a) -> set a.

Axiom remove_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (mem y (remove x s)) -> ~ (y = x).

Axiom remove_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (mem y (remove x s)) -> mem y s.

Axiom remove_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), forall (y:a), (~ (y = x) /\ (mem y s)) ->
  mem y (remove x s).

Axiom add_remove :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), (mem x s) -> ((add x (remove x s)) = s).

Axiom remove_add :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), ((remove x (add x s)) = (remove x s)).

Axiom subset_remove :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a) (s:set a), subset (remove x s) s.

Parameter union:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a.

Axiom union_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x (union s1 s2)) ->
  (mem x s1) \/ (mem x s2).

Axiom union_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x s1) ->
  mem x (union s1 s2).

Axiom union_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x s2) ->
  mem x (union s1 s2).

Parameter inter:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a.

Axiom inter_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x (inter s1 s2)) ->
  mem x s1.

Axiom inter_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x (inter s1 s2)) ->
  mem x s2.

Axiom inter_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), ((mem x s1) /\ (mem x s2)) ->
  mem x (inter s1 s2).

Parameter diff:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a.

Axiom diff_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x (diff s1 s2)) ->
  mem x s1.

Axiom diff_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), (mem x (diff s1 s2)) ->
  ~ (mem x s2).

Axiom diff_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), forall (x:a), ((mem x s1) /\ ~ (mem x s2)) ->
  mem x (diff s1 s2).

Axiom subset_diff :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), subset (diff s1 s2) s1.

Parameter choose: forall {a:Type} {a_WT:WhyType a}, (set a) -> a.

Axiom choose_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ~ (is_empty s) -> mem (choose s) s.

Parameter cardinal: forall {a:Type} {a_WT:WhyType a}, (set a) -> Z.

Axiom cardinal_nonneg :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (0%Z <= (cardinal s))%Z.

Axiom cardinal_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ((cardinal s) = 0%Z) -> is_empty s.

Axiom cardinal_empty1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (is_empty s) -> ((cardinal s) = 0%Z).

Axiom cardinal_add :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a), forall (s:set a), ~ (mem x s) ->
  ((cardinal (add x s)) = (1%Z + (cardinal s))%Z).

Axiom cardinal_remove :
  forall {a:Type} {a_WT:WhyType a},
  forall (x:a), forall (s:set a), (mem x s) ->
  ((cardinal s) = (1%Z + (cardinal (remove x s)))%Z).

Axiom cardinal_subset :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (subset s1 s2) ->
  ((cardinal s1) <= (cardinal s2))%Z.

Axiom subset_eq :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a), (subset s1 s2) ->
  ((cardinal s1) = (cardinal s2)) -> infix_eqeq s1 s2.

Axiom cardinal1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ((cardinal s) = 1%Z) -> forall (x:a), (mem x s) ->
  (x = (choose s)).

Parameter filter:
  forall {a:Type} {a_WT:WhyType a}, (a -> bool) -> (set a) -> set a.

Axiom filter_def :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (u:set a), forall (x:a), (mem x (filter p u)) ->
  ((p x) = true).

Axiom filter_def1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (u:set a), forall (x:a), (mem x (filter p u)) ->
  mem x u.

Axiom filter_def2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (u:set a), forall (x:a),
  (((p x) = true) /\ (mem x u)) -> mem x (filter p u).

Axiom filter_cardinal :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (u:set a), ((cardinal (filter p u)) <= (cardinal u))%Z.

Parameter map:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) ->
  (set a) -> set b.

Axiom map_def1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (u:set a), forall (y:b), (mem y (map f u)) ->
  exists x:a, (mem x u) /\ (y = (f x)).

Axiom map_def11 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (u:set a), forall (y:b),
  (exists x:a, (mem x u) /\ (y = (f x))) -> mem y (map f u).

Axiom map_def2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (u:set a), forall (x:a), (mem x u) -> mem (f x) (map f u).

Axiom map_cardinal :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (u:set a), ((cardinal (map f u)) <= (cardinal u))%Z.

Axiom assert_equal : True.

Axiom goal_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (b:a), (a1 = b) -> (b = a1).

(* Why3 assumption *)
Inductive ref (a:Type) :=
  | mk_ref : a -> ref a.
Axiom ref_WhyType : forall (a:Type) {a_WT:WhyType a}, WhyType (ref a).
Existing Instance ref_WhyType.
Arguments mk_ref {a}.

(* Why3 assumption *)
Definition contents {a:Type} {a_WT:WhyType a} (v:ref a) : a :=
  match v with
  | mk_ref x => x
  end.

Axiom union_exchange :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), ~ (is_empty s') ->
  ((union (add (choose s') s) (remove (choose s') s')) = (union s s')).

Axiom get_filter :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (s:set a) (x:a), (mem x (filter p s)) ->
  ((p x) = true).

Axiom get_filter1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (s:set a) (x:a), (mem x (filter p s)) -> mem x s.

Axiom set_filter :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:a -> bool) (s:set a) (x:a), ((p x) = true) -> (mem x s) ->
  mem x (filter p s).

Axiom inter_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (is_empty s) -> is_empty (inter s s').

Axiom inter_empty_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (is_empty s') -> is_empty (inter s s').

Axiom union_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (is_empty s) -> ((union s s') = s').

Axiom union_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (is_empty s') -> ((union s s') = s).

Axiom union_members :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), forall (a1:a), (mem a1 (union s s')) ->
  ~ (mem a1 s) -> mem a1 s'.

Axiom union_members1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), forall (a1:a), (mem a1 (union s s')) ->
  ~ (mem a1 s') -> mem a1 s.

Axiom union_alt :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (e:a), (mem e (union s s')) -> ~ (mem e s) ->
  mem e s'.

Axiom union_empty_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (is_empty s') -> ((union s s') = s).

Axiom set_subset :
  forall {a:Type} {a_WT:WhyType a},
  forall (s':set a) (s:set a), (forall (e:a), (mem e s') -> mem e s) ->
  subset s' s.

Axiom set_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (forall (e:a), ~ (mem e s)) -> (s = (empty : set a)).

Axiom set_empty1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (forall (e:a), ~ (mem e s)) -> is_empty s.

Axiom set_equal :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (forall (e:a), (mem e s) -> mem e s') ->
  (forall (e:a), (mem e s') -> mem e s) -> (s = s').

Axiom get_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (s = (empty : set a)) -> forall (e:a), ~ (mem e s).

Axiom get_empty1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (s = (empty : set a)) -> is_empty s.

Axiom get_non_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ~ (is_empty s) -> exists e:a, mem e s.

Axiom set_non_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (exists e:a, mem e s) -> ~ (is_empty s).

Axiom set_non_empty1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (exists e:a, mem e s) -> (0%Z < (cardinal s))%Z.

Axiom set_pos_card_elt :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (a1:a), (mem a1 s) -> (0%Z < (cardinal s))%Z.

Axiom union_add :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (x:a), ~ (mem x s') ->
  ((union s (add x s')) = (add x (union s s'))).

Axiom union_add_mem :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (x:a) (y:a), (mem x (add y (union s s'))) ->
  ~ (mem x s') -> ~ (mem x s) -> (x = y).

Axiom union_add_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (x:a), ~ (mem x s') ->
  ((add x (union s s')) = (union s (add x s'))).

Axiom remove_add1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (x:a), ~ (mem x s) -> ((remove x (add x s)) = s).

Axiom add_remove1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (x:a), (mem x s) -> ((add x (remove x s)) = s).

(* Why3 assumption *)
Definition p_injective {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (f:a -> b) (s:set a) : Prop :=
  forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
  ~ ((f e) = (f e')).

Axiom set_map_mem :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (b1:b),
  (exists a1:a, (mem a1 s) /\ (b1 = (f a1))) -> mem b1 (map f s).

Axiom map_add :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (x:a), ~ (mem x s) ->
  ((map f (add x s)) = (add (f x) (map f s))).

Axiom map_eq :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (g:a -> b) (s:set a),
  (forall (e:a), (mem e s) -> ((f e) = (g e))) -> ((map f s) = (map g s)).

Axiom injective_map_cardinal :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), (p_injective f s) ->
  ((cardinal (map f s)) = (cardinal s)).

Axiom set_map_mem_el :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (b1:b) (a1:a), (mem a1 s) -> (b1 = (f a1)) ->
  mem b1 (map f s).

Axiom set_map_mem_el_gen :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (b1:b),
  (exists a1:a, (mem a1 s) /\ (b1 = (f a1))) -> mem b1 (map f s).

Axiom map_antec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (b1:b), (mem b1 (map f s)) ->
  exists a1:a, (mem a1 s) /\ (b1 = (f a1)).

Axiom map_antec_gen :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), forall (b1:b), (mem b1 (map f s)) ->
  exists a1:a, (mem a1 s) /\ (b1 = (f a1)).

Axiom map_remove_choose :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b), (p_injective f s) ->
  ((map f (remove (choose s) s)) = (remove (f (choose s)) (map f s))).

Parameter antec_set:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) ->
  (a -> b) -> b -> set a.

Parameter result:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (a -> b) ->
  b -> a -> bool.

Axiom result_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (b1:b) (e:a), (((result f b1) e) = true) <-> ((f e) = b1).

Axiom antec_set_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) ->
  ((antec_set s f b1) = (filter (result f b1) s)).

Parameter remove_s:
  forall {a:Type} {a_WT:WhyType a}, (set a) -> (set a) -> set a.

Parameter result1: forall {a:Type} {a_WT:WhyType a}, (set a) -> a -> bool.

Axiom result_def1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s':set a) (e:a), (((result1 s') e) = true) <-> ~ (mem e s').

Axiom remove_s_def :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (subset s' s) ->
  ((remove_s s s') = (filter (result1 s') s)).

Axiom remove_s_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (subset s' s) -> forall (e:a),
  (mem e (remove_s s s')) -> mem e s.

Axiom remove_s_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (subset s' s) -> forall (e:a),
  (mem e (remove_s s s')) -> ~ (mem e s').

Axiom remove_s_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), (subset s' s) -> forall (e:a),
  ((mem e s) /\ ~ (mem e s')) -> mem e (remove_s s s').

Parameter remove_antecs:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) ->
  (a -> b) -> b -> set a.

Axiom remove_antecs_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) ->
  ((remove_antecs s f b1) = (remove_s s (antec_set s f b1))).

Axiom remove_antecs_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a),
  (mem e (remove_antecs s f b1)) -> mem e s.

Axiom remove_antecs_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a),
  (mem e (remove_antecs s f b1)) -> ~ ((f e) = b1).

Axiom remove_antecs_spec2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) -> forall (e:a),
  ((mem e s) /\ ~ ((f e) = b1)) -> mem e (remove_antecs s f b1).

Axiom remove_antecs_spec3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) ->
  ((cardinal (remove_antecs s f b1)) < (cardinal s))%Z.

Axiom map_remove_antec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (f:a -> b) (b1:b), (mem b1 (map f s)) ->
  ((map f (remove_antecs s f b1)) = (remove b1 (map f s))).

Axiom map_non_empty :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), (0%Z < (cardinal s))%Z ->
  (0%Z < (cardinal (map f s)))%Z.

Axiom non_empty_map :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), (0%Z < (cardinal (map f s)))%Z ->
  (0%Z < (cardinal s))%Z.

Parameter right_injections:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, a -> (set b) ->
  set (a* b)%type.

Axiom right_injections_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), (is_empty s) ->
  ((right_injections a1 s) = (empty : set (a* b)%type)).

Axiom right_injections_def1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), ~ (is_empty s) ->
  ((right_injections a1 s) =
   (add (a1, choose s) (right_injections a1 (remove (choose s) s)))).

Axiom right_injections_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b),
  ((cardinal (right_injections a1 s)) = (cardinal s)).

Axiom right_injections_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  (mem (a', b1) (right_injections a1 s)) -> (a' = a1).

Axiom right_injections_spec2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  (mem (a', b1) (right_injections a1 s)) -> mem b1 s.

Axiom right_injections_spec3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  ((a' = a1) /\ (mem b1 s)) -> mem (a', b1) (right_injections a1 s).

Axiom right_injections_spec4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b),
  ((right_injections a1 s) = (map (fun (b1:b) => (a1, b1)) s)).

Parameter left_injections:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) -> b ->
  set (a* b)%type.

Axiom left_injections_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), (is_empty s) ->
  ((left_injections s b1) = (empty : set (a* b)%type)).

Axiom left_injections_def1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), ~ (is_empty s) ->
  ((left_injections s b1) =
   (add (choose s, b1) (left_injections (remove (choose s) s) b1))).

Axiom left_injections_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  (mem (a1, b') (left_injections s b1)) -> mem a1 s.

Axiom left_injections_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  (mem (a1, b') (left_injections s b1)) -> (b' = b1).

Axiom left_injections_spec2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  ((mem a1 s) /\ (b' = b1)) -> mem (a1, b') (left_injections s b1).

Axiom left_injections_spec3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), ((cardinal (left_injections s b1)) = (cardinal s)).

Axiom left_injections_spec4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b),
  ((left_injections s b1) = (map (fun (a1:a) => (a1, b1)) s)).

Axiom right_injections_l :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b),
  ((cardinal (right_injections a1 s)) = (cardinal s)).

Axiom right_injections_l1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  (mem (a', b1) (right_injections a1 s)) -> (a' = a1).

Axiom right_injections_l2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  (mem (a', b1) (right_injections a1 s)) -> mem b1 s.

Axiom right_injections_l3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b), forall (a':a), forall (b1:b),
  ((a' = a1) /\ (mem b1 s)) -> mem (a', b1) (right_injections a1 s).

Axiom right_injections_l4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (s:set b),
  ((right_injections a1 s) = (map (fun (b1:b) => (a1, b1)) s)).

Axiom left_injections_l :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  (mem (a1, b') (left_injections s b1)) -> mem a1 s.

Axiom left_injections_l1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  (mem (a1, b') (left_injections s b1)) -> (b' = b1).

Axiom left_injections_l2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), forall (a1:a), forall (b':b),
  ((mem a1 s) /\ (b' = b1)) -> mem (a1, b') (left_injections s b1).

Axiom left_injections_l3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b), ((cardinal (left_injections s b1)) = (cardinal s)).

Axiom left_injections_l4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b),
  ((left_injections s b1) = (map (fun (a1:a) => (a1, b1)) s)).

Axiom disjoint_injections :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b) (c:b), ~ (b1 = c) ->
  is_empty (inter (right_injections b1 s) (right_injections c s)).

Axiom disjoint_injections1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set a) (b1:b) (c:b), ~ (b1 = c) ->
  is_empty (inter (left_injections s b1) (left_injections s c)).

Axiom induction :
  forall {a:Type} {a_WT:WhyType a},
  forall (p:(set a) -> bool) (t1:set a),
  (forall (s:set a), (is_empty s) -> ((p s) = true)) ->
  (forall (s:set a), ((p s) = true) -> forall (t2:a), ~ (mem t2 s) ->
   ((p (add t2 s)) = true)) ->
  ((p t1) = true).

Axiom cardinal_sum :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a),
  ((cardinal (union s s')) =
   (((cardinal s) + (cardinal s'))%Z - (cardinal (inter s s')))%Z).

Axiom cardinal_sum_empty_inter :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a), ((inter s s') = (empty : set a)) ->
  ((cardinal (union s s')) = ((cardinal s) + (cardinal s'))%Z).

Parameter cartesian_product:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, (set a) ->
  (set b) -> set (a* b)%type.

Axiom cartesian_product_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b),
  ((cardinal (cartesian_product s1 s2)) = ((cardinal s1) * (cardinal s2))%Z).

Axiom cartesian_product_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b),
  (mem (a1, b1) (cartesian_product s1 s2)) -> mem a1 s1.

Axiom cartesian_product_spec2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b),
  (mem (a1, b1) (cartesian_product s1 s2)) -> mem b1 s2.

Axiom cartesian_product_spec3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (a1:a), forall (b1:b),
  ((mem a1 s1) /\ (mem b1 s2)) -> mem (a1, b1) (cartesian_product s1 s2).

Axiom cartesian_product_spec4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type),
  (mem o (cartesian_product s1 s2)) -> mem (fir o) s1.

Axiom cartesian_product_spec5 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type),
  (mem o (cartesian_product s1 s2)) -> mem (sec o) s2.

Axiom cartesian_product_spec6 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type),
  ((mem (fir o) s1) /\ (mem (sec o) s2)) -> mem o (cartesian_product s1 s2).

(* Why3 assumption *)
Definition commute {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (o:(a* b)%type) : (b* a)%type :=
  match o with
  | (a1, b1) => (b1, a1)
  end.

Axiom commute_inj :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b), ~ (a1 = a') ->
  ~ ((commute (a1, b1)) = (commute (a', b'))).

Axiom commute_inj1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b), ~ (b1 = b') ->
  ~ ((commute (a1, b1)) = (commute (a', b'))).

Axiom mem_cartesian_product :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b) (a1:a) (b1:b), (mem a1 s1) -> (mem b1 s2) ->
  mem (a1, b1) (cartesian_product s1 s2).

Axiom commute_inj_gen :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b),
  p_injective (fun (y0:(a* b)%type) => (commute y0))
  (cartesian_product s1 s2).

(* Why3 assumption *)
Definition commute_product {a:Type} {a_WT:WhyType a}
    {b:Type} {b_WT:WhyType b} (s1:set a) (s2:set b) : set (b* a)%type :=
  map (fun (y0:(a* b)%type) => (commute y0)) (cartesian_product s1 s2).

Axiom commute_product_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b),
  ((commute_product s1 s2) = (cartesian_product s2 s1)).

(* Why3 assumption *)
Definition commute_product_el {a:Type} {a_WT:WhyType a}
    {b:Type} {b_WT:WhyType b} (s1:set a) (s2:set b) : set (b* a)%type :=
  map (fun (y0:(a* b)%type) => (commute y0)) (cartesian_product s1 s2).

Axiom commute_product_el_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> (mem o (cartesian_product s1 s2)) -> mem x s1.

Axiom commute_product_el_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> (mem o (cartesian_product s1 s2)) -> mem x1 s2.

Axiom commute_product_el_spec2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> ((mem x s1) /\ (mem x1 s2)) ->
  mem o (cartesian_product s1 s2).

Axiom commute_product_el_spec3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> ((mem x s1) /\ (mem x1 s2)) ->
  mem (x1, x) (commute_product_el s1 s2).

Axiom commute_product_el_spec4 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> (mem (x1, x) (commute_product_el s1 s2)) -> mem x s1.

Axiom commute_product_el_spec5 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), forall (o:(a* b)%type), forall (x:a) (x1:b),
  (o = (x, x1)) -> (mem (x1, x) (commute_product_el s1 s2)) -> mem x1 s2.

Axiom cartesian_product_union :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b) (s3:set b),
  ((cartesian_product s1 (union s2 s3)) =
   (union (cartesian_product s1 s2) (cartesian_product s1 s3))).

Axiom cartesian_union_product :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set a) (s3:set b),
  ((cartesian_product (union s1 s2) s3) =
   (union (cartesian_product s1 s3) (cartesian_product s2 s3))).

Axiom cartesian_product_cardone_r :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), ((cardinal s1) = 1%Z) ->
  infix_eqeq (cartesian_product s1 s2) (right_injections (choose s1) s2).

Axiom cartesian_product_cardone_r1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), ((cardinal s1) = 1%Z) ->
  infix_eqeq (cartesian_product s1 s2)
  (map (fun (e2:b) => (choose s1, e2)) s2).

Axiom cartesian_product_cardone_l :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), ((cardinal s2) = 1%Z) ->
  infix_eqeq (cartesian_product s1 s2) (left_injections s1 (choose s2)).

Axiom cartesian_product_cardone_l1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b), ((cardinal s2) = 1%Z) ->
  infix_eqeq (cartesian_product s1 s2)
  (map (fun (e1:a) => (e1, choose s2)) s1).

Axiom disjoint_cartesian_product_l :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set a) (s3:set b),
  ((inter s1 s2) = (empty : set a)) ->
  ((inter (cartesian_product s1 s3) (cartesian_product s2 s3)) =
   (empty : set (a* b)%type)).

Axiom disjoint_cartesian_product_r :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b) (s3:set b),
  ((inter s2 s3) = (empty : set b)) ->
  ((inter (cartesian_product s1 s2) (cartesian_product s1 s3)) =
   (empty : set (a* b)%type)).

Axiom to_set_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (e:a), ((cardinal (add e (empty : set a))) = 1%Z).

Axiom to_set_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (e:a), forall (b:a), (mem b (add e (empty : set a))) -> (b = e).

Parameter to_fset: Z -> Z -> set Z.

Axiom to_fset_spec :
  forall (i:Z) (j:Z), (i < j)%Z -> ((cardinal (to_fset i j)) = (j - i)%Z).

Axiom to_fset_spec1 :
  forall (i:Z) (j:Z), (j <= i)%Z -> is_empty (to_fset i j).

Axiom to_fset_spec2 :
  forall (i:Z) (j:Z), forall (k:Z), (mem k (to_fset i j)) -> (i <= k)%Z.

Axiom to_fset_spec3 :
  forall (i:Z) (j:Z), forall (k:Z), (mem k (to_fset i j)) -> (k < j)%Z.

Axiom to_fset_spec4 :
  forall (i:Z) (j:Z), forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) ->
  mem k (to_fset i j).

Axiom to_fset_unit_ext :
  forall (i:Z) (j:Z), (i < j)%Z ->
  ((to_fset i j) = (add i (to_fset (i + 1%Z)%Z j))).

Axiom to_fset_ext :
  forall (i:Z) (i':Z) (j:Z), ((i <= i')%Z /\ (i' <= j)%Z) ->
  ((to_fset i j) = (union (to_fset i i') (to_fset i' j))).

Parameter op: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1 -> im1.

Parameter po: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1 -> im1.

Parameter inver: forall {im1:Type} {im1_WT:WhyType im1}, im1 -> im1.

(* Why3 assumption *)
Definition op_neutral_left {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (neutral:im1) : Prop :=
  forall (e:im1), (((op1 neutral) e) = e).

(* Why3 assumption *)
Definition op_neutral_right {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (neutral:im1) : Prop :=
  forall (e:im1), (((op1 e) neutral) = e).

(* Why3 assumption *)
Definition op_assoc {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) :
    Prop :=
  forall (a:im1) (b:im1) (c:im1),
  (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c))).

(* Why3 assumption *)
Definition op_neutral_left_comm {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (neutral:im1) : Prop :=
  forall (a:im1), (forall (b:im1), (((op1 a) b) = b)) -> (a = neutral).

(* Why3 assumption *)
Definition commut {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) :
    Prop :=
  forall (a:im1) (b:im1), (((op1 a) b) = ((op1 b) a)).

(* Why3 assumption *)
Definition assoc {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) :
    Prop :=
  forall (a:im1) (b:im1) (c:im1),
  (((op1 ((op1 a) b)) c) = ((op1 a) ((op1 b) c))).

(* Why3 assumption *)
Definition opposite_n {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1)
    (po1:im1 -> im1 -> im1) (neutral:im1) : Prop :=
  forall (a:im1), (((po1 a) a) = neutral).

(* Why3 assumption *)
Definition inverse {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1)
    (po1:im1 -> im1 -> im1) (inver1:im1 -> im1) : Prop :=
  forall (a:im1) (b:im1), (((po1 a) b) = ((op1 a) (inver1 b))).

(* Why3 assumption *)
Definition opposite {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1)
    (po1:im1 -> im1 -> im1) : Prop :=
  forall (a:im1) (b:im1), (((op1 ((po1 a) b)) b) = a).

(* Why3 assumption *)
Definition opposite_com {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) : Prop :=
  forall (a:im1) (b:im1), (((po1 ((op1 a) b)) b) = a).

Axiom refl :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (a:im1) (b:im1), (commut op1) ->
  (((op1 a) b) = ((op1 b) a)).

(* Why3 assumption *)
Definition neutral {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1)
    (neut:im1) : Prop :=
  (op_neutral_left op1 neut) /\
  ((op_neutral_right op1 neut) /\ (op_assoc op1)).

Axiom set_neutral :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (neut:im1), (op_neutral_left op1 neut) ->
  (op_neutral_right op1 neut) -> (op_assoc op1) -> neutral op1 neut.

(* Why3 assumption *)
Definition has_neutral {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) : Prop :=
  exists e:im1, neutral op1 e.

(* Why3 assumption *)
Definition iterates {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1)
    (neutral1:im1) : Prop :=
  (op_neutral_left op1 neutral1) /\
  ((op_neutral_right op1 neutral1) /\ (op_assoc op1)).

(* Why3 assumption *)
Definition iterable {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) :
    Prop :=
  exists e:im1, iterates op1 e.

Axiom iterates_ :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (neutral1:im1),
  (op_neutral_left op1 neutral1) -> (op_neutral_right op1 neutral1) ->
  (op_assoc op1) -> iterates op1 neutral1.

Axiom iterates_1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (neutral1:im1),
  (op_neutral_left op1 neutral1) -> (op_neutral_right op1 neutral1) ->
  (op_assoc op1) -> iterable op1.

Parameter neutral_elt:
  forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) -> im1.

Axiom neutral_elt_spec :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1), forall (e:im1), (neutral op1 e) ->
  ((neutral_elt op1) = e).

Axiom neutral_elt_spec1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1), forall (e:im1), ((neutral_elt op1) = e) ->
  neutral op1 e.

(* Why3 assumption *)
Definition inverse_tuple {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (neutral1:im1) : Prop :=
  (opposite_n op1 po1 neutral1) /\
  ((opposite op1 po1) /\ (opposite_com op1 po1)).

Parameter iterate:
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  (im1 -> im1 -> im1) -> (set a) -> (a -> im1) -> im1.

Axiom Iterate_def_empty :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1),
  (commut op1) -> (iterable op1) -> (is_empty s) ->
  ((iterate op1 (empty : set a) f) = (neutral_elt op1)).

Axiom Iterate_one :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1),
  forall (x:a), (is_empty s) -> (commut op1) ->
  ((iterate op1 (add x s) f) = (f x)).

Axiom Iterate_add :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1), forall (s:set a), forall (f:a -> im1),
  forall (x:a), (0%Z < (cardinal s))%Z -> (commut op1) -> ~ (mem x s) ->
  ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))).

Axiom minus_zero :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1),
  (iterable op1) -> (inverse_tuple op1 po1 (neutral_elt op1)) ->
  (((po1 a) (neutral_elt op1)) = a).

Axiom unic :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1)
    (c:im1),
  (iterable op1) -> (commut op1) -> (((op1 a) b) = ((op1 a) c)) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) -> (b = c).

Axiom substract_comm :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1),
  (iterable op1) -> (commut op1) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 ((op1 a) b)) a) = b).

Axiom substract_comm1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1),
  (iterable op1) -> (commut op1) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) -> (((po1 ((op1 b) a)) a) = b).

Axiom substract_comm2 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1)
    (c:im1),
  (iterable op1) -> (commut op1) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) ->
  (((po1 a) ((po1 b) c)) = ((op1 ((po1 a) b)) c)).

Axiom substract_comm3 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (a:im1) (b:im1)
    (c:im1),
  (iterable op1) -> (commut op1) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) ->
  (((po1 ((op1 a) b)) c) = ((op1 a) ((po1 b) c))).

Parameter int_iterate:
  forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) ->
  (Z -> im1) -> Z -> Z -> im1.

Axiom int_iterate_def :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)).

Axiom int_iterate_def1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  ~ (j <= i)%Z -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)).

Axiom int_iterate_def2 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  ~ (j <= i)%Z -> ~ (j = (i + 1%Z)%Z) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))).

Axiom int_iterate_def3 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)).

Axiom int_iterate_def4 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  ~ (j <= i)%Z -> (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)).

Axiom int_iterate_def5 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  ~ (j <= i)%Z -> ~ (j = (i + 1%Z)%Z) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))).

Axiom int_iterate_spec :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)).

Axiom int_iterate_spec1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  (j = (i + 1%Z)%Z) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (neutral_elt op1))).

Axiom int_iterate_spec2 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  (j <= i)%Z -> ((int_iterate op1 f i j) = (neutral_elt op1)).

Axiom int_iterate_spec3 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  (j = (i + 1%Z)%Z) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (neutral_elt op1))).

Parameter int_int_iterate:
  forall {im1:Type} {im1_WT:WhyType im1}, (im1 -> im1 -> im1) ->
  (Z -> Z -> im1) -> Z -> Z -> Z -> Z -> im1.

Axiom int_int_iterate_def :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (iterable op1) -> (j <= i)%Z ->
  ((int_int_iterate op1 f i j k l) = (neutral_elt op1)).

Axiom int_int_iterate_def1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (iterable op1) -> ~ (j <= i)%Z ->
  ((int_int_iterate op1 f i j k l) =
   ((op1 (int_iterate op1 (f i) k l))
    (int_int_iterate op1 f (i + 1%Z)%Z j k l))).

Parameter element: forall {a:Type} {a_WT:WhyType a}, (set a) -> a.

Axiom element_def :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ((cardinal s) = 1%Z) -> ((element s) = (choose s)).

Axiom cardone :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) ->
  (0%Z < (cardinal s))%Z -> ((cardinal s) = 1%Z).

Axiom cardone1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (a1:a), (forall (b:a), (mem b s) <-> (b = a1)) ->
  (0%Z < (cardinal s))%Z -> ((element s) = a1).

Axiom set_cardone :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (0%Z < (cardinal s))%Z ->
  (exists a1:a, forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) = 1%Z).

Axiom get_cardone :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), ((cardinal s) = 1%Z) ->
  exists a1:a, forall (b:a), (mem b s) <-> (b = a1).

Axiom set_cardone_elt :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (a1:a), (0%Z < (cardinal s))%Z ->
  (forall (b:a), (mem b s) <-> (b = a1)) -> ((cardinal s) = 1%Z).

Axiom set_cardone_elt1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (a1:a), (0%Z < (cardinal s))%Z ->
  (forall (b:a), (mem b s) <-> (b = a1)) -> ((element s) = a1).

Axiom cardzero :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a), (forall (b:a), ~ (mem b s)) -> ((cardinal s) = 0%Z).

(* Why3 assumption *)
Definition p_injective_in {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (f:a -> b) (s:set a) (s':set b) : Prop :=
  forall (e:a), (mem e s) ->
  (mem (f e) s') /\
  forall (e1:a) (e':a), (mem e1 s) -> (mem e' s) -> ~ (e1 = e') ->
  ~ ((f e1) = (f e')).

(* Why3 assumption *)
Definition equal_func {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (f:a -> b) (g:a -> b) : Prop :=
  forall (e:a), ((f e) = (g e)).

Axiom set_equal_func :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (g:a -> b), (forall (e:a), ((f e) = (g e))) -> (f = g).

Axiom get_equal_func :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (g:a -> b), (equal_func f g) -> forall (e:a),
  ((f e) = (g e)).

Axiom set_injective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a),
  (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
   ~ ((f e) = (f e'))) ->
  p_injective f s.

Axiom image_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), forall (a1:b), (mem a1 (map f s)) ->
  exists antec_a:a, (mem antec_a s) /\ (a1 = (f antec_a)).

Axiom image_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), forall (a1:b),
  (exists antec_a:a, (mem antec_a s) /\ (a1 = (f antec_a))) ->
  mem a1 (map f s).

Axiom card_image :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), ((cardinal (map f s)) <= (cardinal s))%Z.

Axiom card_image_injective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), (p_injective f s) ->
  ((cardinal (map f s)) = (cardinal s)).

Axiom get_injective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), (p_injective f s) -> forall (e:a) (e':a),
  (mem e s) -> (mem e' s) -> ~ (e = e') -> ~ ((f e) = (f e')).

Axiom set_injective_in :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b),
  (forall (e:a), (mem e s) -> mem (f e) s') ->
  (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
   ~ ((f e) = (f e'))) ->
  p_injective f s.

Axiom get_injective_in :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') ->
  forall (e:a), (mem e s) -> mem (f e) s'.

Axiom get_injective_in1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_injective_in f s s') ->
  forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
  ~ ((f e) = (f e')).

(* Why3 assumption *)
Definition p_surjective {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (f:a -> b) (s:set a) (s':set b) : Prop :=
  (forall (e:a), (mem e s) -> mem (f e) s') /\
  forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e').

Axiom set_surjective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b),
  (forall (e:a), (mem e s) -> mem (f e) s') ->
  (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) ->
  p_surjective f s s'.

Axiom get_surjective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') ->
  forall (e:a), (mem e s) -> mem (f e) s'.

Axiom get_surjective1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') ->
  forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e').

Axiom image_surjective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_surjective f s s') ->
  ((map f s) = s').

(* Why3 assumption *)
Definition p_bijective {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    (f:a -> b) (s:set a) (s':set b) : Prop :=
  (p_injective_in f s s') /\ (p_surjective f s s').

Axiom bijective_is_injective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  p_injective f s.

Axiom bijective_is_surjective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  p_surjective f s s'.

Axiom set_bijective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b),
  (forall (e:a), (mem e s) -> mem (f e) s') ->
  (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
   ~ ((f e) = (f e'))) ->
  (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) ->
  p_bijective f s s'.

Axiom set_bijective1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b),
  (forall (e:a), (mem e s) -> mem (f e) s') ->
  (forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
   ~ ((f e) = (f e'))) ->
  (forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e')) ->
  ((map f s) = s').

Axiom bijectivity_is_transitive :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {c:Type} {c_WT:WhyType c},
  forall (f:a -> b) (g:b -> c) (s:set a) (s':set b) (s'':set c),
  (p_bijective f s s') -> (p_bijective g s' s'') ->
  p_bijective (fun (k:a) => (g (f k))) s s''.

Axiom bijective_image :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:a -> a) (s:set a) (s':set a), (p_bijective f s s') ->
  ((cardinal s) = (cardinal s')).

Axiom bijective_image1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:a -> a) (s:set a) (s':set a), (p_bijective f s s') ->
  (s' = (map f s)).

Axiom get_bijective :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  forall (e:a), (mem e s) -> mem (f e) s'.

Axiom get_bijective1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  forall (e:a) (e':a), (mem e s) -> (mem e' s) -> ~ (e = e') ->
  ~ ((f e) = (f e')).

Axiom get_bijective2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  forall (e':b), (mem e' s') -> exists e:a, (mem e s) /\ ((f e) = e').

Axiom get_bijective3 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  ((cardinal s) = (cardinal s')).

Axiom bijective_eq :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (g:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  (forall (e:a), (mem e s) -> ((f e) = (g e))) -> p_bijective g s s'.

Axiom bijective_eq_gen :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a) (s':set b), (p_bijective f s s') ->
  forall (g:a -> b), (forall (e:a), (mem e s) -> ((f e) = (g e))) ->
  p_bijective g s s'.

Axiom bij_equal_card :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (f:a -> b) (s:set a), ((cardinal s) = (cardinal (map f s))) ->
  p_bijective f s (map f s).

Axiom set_bijective_auto :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:a -> a) (s:set a), (forall (e:a), (mem e s) -> mem (f e) s) ->
  (forall (e':a), (mem e' s) -> exists e:a, (mem e s) /\ ((f e) = e')) ->
  p_bijective f s s.

Axiom iterate_empty :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (is_empty s) ->
  (commut op1) -> (iterable op1) -> ((iterate op1 s t1) = (neutral_elt op1)).

Axiom iterate_one :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1),
  ((cardinal s) = 1%Z) -> (commut op1) ->
  ((iterate op1 s t1) = (t1 (choose s))).

Axiom iterate_add :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a),
  (commut op1) -> (iterable op1) -> ~ (mem x s) ->
  ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))).

Axiom iterate_add_ :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a),
  (commut op1) -> ~ (mem x s) -> ~ (is_empty s) ->
  ((iterate op1 (add x s) f) = ((op1 (f x)) (iterate op1 s f))).

Axiom iterate_remove :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (x:a),
  (commut op1) -> (iterable op1) ->
  (inverse_tuple op1 (fun (y0:im1) (y1:im1) => (po y0 y1)) (neutral_elt op1)) ->
  (mem x s) -> ((iterate op1 (remove x s) f) = (po (iterate op1 s f) (f x))).

Axiom iterate_def_choose :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1),
  ~ ((cardinal s) = 1%Z) -> (commut op1) -> ~ (is_empty s) ->
  ((iterate op1 s f) =
   ((op1 (f (choose s))) (iterate op1 (remove (choose s) s) f))).

Axiom iterate_def_choose1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1), (iterable op1) ->
  (commut op1) -> ~ (is_empty s) ->
  ((iterate op1 s f) =
   ((op1 (f (choose s))) (iterate op1 (remove (choose s) s) f))).

Axiom choose_any :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (t1:a),
  (iterable op1) -> (commut op1) -> (mem t1 s) ->
  ((iterate op1 s f) = ((op1 (f t1)) (iterate op1 (remove t1 s) f))).

Axiom iterate_comp_iterate :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s1:set a) (f:a -> im1) (g:a -> im1),
  (iterable op1) -> (commut op1) -> (assoc op1) ->
  ((iterate op1 s1 (fun (k:a) => ((op1 (f k)) (g k)))) =
   ((op1 (iterate op1 s1 (fun (k:a) => (f k))))
    (iterate op1 s1 (fun (k:a) => (g k))))).

Axiom iterate_comp_iterate_com :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s1:set a) (f:a -> im1) (g:a -> im1),
  (iterable op1) -> (commut op1) ->
  (((op1 (iterate op1 s1 (fun (k:a) => (f k))))
    (iterate op1 s1 (fun (k:a) => (g k))))
   = (iterate op1 s1 (fun (k:a) => ((op1 (f k)) (g k))))).

Axiom iterate_transitivity :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (po1:im1 -> im1 -> im1) (s1:set a)
    (s2:set a) (f:a -> im1),
  (iterable op1) -> (commut op1) ->
  (inverse_tuple op1 po1 (neutral_elt op1)) ->
  ((iterate op1 (union s1 s2) f) =
   ((po1 ((op1 (iterate op1 s1 f)) (iterate op1 s2 f)))
    (iterate op1 (inter s1 s2) f))).

Axiom iterate_disjoint_transitivity :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set a) (t1:a -> im1),
  (iterable op1) -> (commut op1) -> ((inter s1 s2) = (empty : set a)) ->
  ((iterate op1 (union s1 s2) t1) =
   ((op1 (iterate op1 s1 t1)) (iterate op1 s2 t1))).

Axiom iterate_eq :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (g:a -> im1),
  (forall (x:a), (mem x s) -> ((f x) = (g x))) -> (commut op1) ->
  ~ (is_empty s) -> ((iterate op1 s f) = (iterate op1 s g)).

Axiom iterate_eq1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f:a -> im1) (g:a -> im1),
  (forall (x:a), (mem x s) -> ((f x) = (g x))) -> (commut op1) ->
  (iterable op1) -> ((iterate op1 s f) = (iterate op1 s g)).

Axiom iterate_map :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set b) (f:b -> a) (t1:a -> im1),
  ~ (is_empty s) -> (commut op1) -> (p_injective f s) ->
  ((iterate op1 (map f s) t1) = (iterate op1 s (fun (b1:b) => (t1 (f b1))))).

Axiom iterate_map1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set b) (f:b -> a) (t1:a -> im1),
  (iterable op1) -> (commut op1) -> (p_injective f s) ->
  ((iterate op1 (map f s) t1) = (iterate op1 s (fun (b1:b) => (t1 (f b1))))).

Axiom iterate_cardone :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (iterable op1) ->
  (commut op1) -> ((cardinal s) = 1%Z) ->
  ((iterate op1 s t1) = (t1 (element s))).

Axiom iterate_cardzero :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (commut op1) ->
  (iterable op1) -> ((cardinal s) = 0%Z) ->
  ((iterate op1 s t1) = (neutral_elt op1)).

Axiom injec_iterate :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (a1:a) (s:set b) (f:a -> b -> im1),
  (iterable op1) -> (commut op1) ->
  ((iterate op1 s (f a1)) =
   (iterate op1 (cartesian_product (add a1 (empty : set a)) s)
    (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))).

Axiom iterate_cartesian_product :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set b) (f:a -> b -> im1),
  (iterable op1) -> (commut op1) ->
  ((iterate op1 s1 (fun (a1:a) => (iterate op1 s2 (f a1)))) =
   (iterate op1 (cartesian_product s1 s2)
    (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))).

Axiom iterate_eq_func :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (f1:a -> im1) (f2:a -> im1),
  (commut op1) -> (iterable op1) -> (p_injective f1 s) ->
  (p_injective f2 s) -> ((map f1 s) = (map f2 s)) ->
  ((iterate op1 s f1) = (iterate op1 s f2)).

Axiom int_iterate_def_empty :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (j <= i)%Z ->
  (iterable op1) -> ((int_iterate op1 f i j) = (neutral_elt op1)).

Axiom int_iterate_def_plus_one :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z ->
  ~ ((i + 1%Z)%Z = j) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))).

Axiom int_iterate_def_plus_one1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z ->
  (iterable op1) ->
  ((int_iterate op1 f i j) = ((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j))).

Axiom int_iterate_cardone :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z),
  (j = (i + 1%Z)%Z) -> ((int_iterate op1 f i j) = (f i)).

Axiom int_iterate_def_plus_one_com :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z ->
  ~ (j = (i + 1%Z)%Z) ->
  (((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j)) = (int_iterate op1 f i j)).

Axiom int_iterate_def_plus_one_com1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (i < j)%Z ->
  (iterable op1) ->
  (((op1 (f i)) (int_iterate op1 f (i + 1%Z)%Z j)) = (int_iterate op1 f i j)).

Axiom int_iterate_to_iterate :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), ~ (j <= i)%Z ->
  (commut op1) -> ((int_iterate op1 f i j) = (iterate op1 (to_fset i j) f)).

Axiom int_iterate_to_iterate1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  (commut op1) -> ((int_iterate op1 f i j) = (iterate op1 (to_fset i j) f)).

Axiom int_iterate_right_extension :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (iterable op1) ->
  (i < j)%Z ->
  ((int_iterate op1 f i j) =
   ((op1 (int_iterate op1 f i (j - 1%Z)%Z)) (f (j - 1%Z)%Z))).

Axiom int_iterate_right_extension_ :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z), (assoc op1) ->
  ((i + 1%Z)%Z < j)%Z ->
  ((int_iterate op1 f i j) =
   ((op1 (int_iterate op1 f i (j - 1%Z)%Z)) (f (j - 1%Z)%Z))).

Axiom int_iterate_transitivity :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (k:Z) (j:Z),
  (iterable op1) -> (iterable op1) ->
  (op_neutral_left op1 (neutral_elt op1)) -> ((i <= k)%Z /\ (k <= j)%Z) ->
  ((int_iterate op1 f i j) =
   ((op1 (int_iterate op1 f i k)) (int_iterate op1 f k j))).

Axiom int_iterate_transitivity_ :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (k:Z) (j:Z),
  (op_neutral_left op1 (neutral_elt op1)) -> ((i < k)%Z /\ (k < j)%Z) ->
  ((int_iterate op1 f i j) =
   ((op1 (int_iterate op1 f i k)) (int_iterate op1 f k j))).

Axiom int_iterate_comp_iterate :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z),
  (iterable op1) -> (op_neutral_right op1 (neutral_elt op1)) ->
  (commut op1) ->
  ((int_iterate op1 (fun (k:Z) => ((op1 (f k)) (g k))) i j) =
   ((op1 (int_iterate op1 f i j)) (int_iterate op1 g i j))).

Axiom int_iterate_attr_no_f :
  forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2},
  forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t1:Z -> im1)
    (t2:Z -> im2) (f:im1 -> im2) (i:Z) (j:Z),
  (forall (x:Z), forall (y:im1),
   (((op2 (t2 x)) (f y)) = (f ((op1 (t1 x)) y)))) ->
  ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) ->
  (iterable op2) -> (forall (i1:Z), ((f (t1 i1)) = (t2 i1))) ->
  ((int_iterate op2 t2 i j) = (f (int_iterate op1 t1 i j))).

Axiom int_iterate_attr :
  forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2},
  forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t1:Z -> im1)
    (f:im1 -> im2) (i:Z) (j:Z),
  (forall (x:Z), forall (y:im1),
   (((op2 (f (t1 x))) (f y)) = (f ((op1 (t1 x)) y)))) ->
  ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) ->
  (iterable op2) ->
  ((int_iterate op2 (fun (e:Z) => (f (t1 e))) i j) =
   (f (int_iterate op1 t1 i j))).

Axiom int_iterate_attr_comm :
  forall {im1:Type} {im1_WT:WhyType im1} {im2:Type} {im2_WT:WhyType im2},
  forall (op1:im1 -> im1 -> im1) (op2:im2 -> im2 -> im2) (t1:Z -> im1)
    (f:im1 -> im2) (i:Z) (j:Z),
  (forall (x:Z), forall (y:im1),
   (((op2 (f (t1 x))) (f y)) = (f ((op1 (t1 x)) y)))) ->
  ((f (neutral_elt op1)) = (neutral_elt op2)) -> (iterable op1) ->
  (iterable op2) ->
  ((f (int_iterate op1 t1 i j)) =
   (int_iterate op2 (fun (e:Z) => (f (t1 e))) i j)).

Axiom int_iterate_eq :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ~ (j <= i)%Z -> ((int_iterate op1 f i j) = (int_iterate op1 g i j)).

Axiom int_iterate_eq1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (g:Z -> im1) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  (iterable op1) -> ((int_iterate op1 f i j) = (int_iterate op1 g i j)).

Axiom int_iterate_left_right :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (l:Z) (k:Z) (h:Z),
  (iterable op1) -> (commut op1) -> ((l <= k)%Z /\ (k <= h)%Z) ->
  ((int_iterate op1 f l k) =
   (int_iterate op1 (fun (a:Z) => (f ((h - (a + 1%Z)%Z)%Z + l)%Z))
    ((h - k)%Z + l)%Z h)).

Axiom int_iterate_eq_func :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> im1) (g:Z -> im1),
  (iterable op1) -> (commut op1) -> (p_injective f (to_fset i j)) ->
  (p_injective g (to_fset i j)) ->
  ((map f (to_fset i j)) = (map g (to_fset i j))) ->
  ((int_iterate op1 f i j) = (int_iterate op1 g i j)).

Axiom int_iterate_map :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z)
    (t1:Z -> im1),
  ~ (j <= i)%Z -> (commut op1) ->
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((int_iterate op1 t1 k l) =
   (int_iterate op1 (fun (b:Z) => (t1 (f b))) i j)).

Axiom int_iterate_map1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z)
    (t1:Z -> im1),
  (iterable op1) -> (commut op1) ->
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((int_iterate op1 t1 k l) =
   (int_iterate op1 (fun (b:Z) => (t1 (f b))) i j)).

Axiom int_iterate_transl :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> im1) (i:Z) (j:Z) (k:Z),
  (iterable op1) ->
  ((int_iterate op1 f i j) =
   (int_iterate op1 (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)).

Axiom int_iterate_map_auto :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> Z) (t1:Z -> im1),
  ~ (j <= i)%Z -> (commut op1) ->
  (p_bijective f (to_fset i j) (to_fset i j)) ->
  ((int_iterate op1 t1 i j) =
   (int_iterate op1 (fun (b:Z) => (t1 (f b))) i j)).

Axiom int_iterate_map_auto1 :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (i:Z) (j:Z) (f:Z -> Z) (t1:Z -> im1),
  (iterable op1) -> (commut op1) ->
  (p_bijective f (to_fset i j) (to_fset i j)) ->
  ((int_iterate op1 t1 i j) =
   (int_iterate op1 (fun (b:Z) => (t1 (f b))) i j)).

Axiom neutrals : (0%Z = (neutral_elt (fun (y0:Z) (y1:Z) => (y0 + y1)%Z))).

Axiom neutrals1 : (1%Z = (neutral_elt (fun (y0:Z) (y1:Z) => (y0 * y1)%Z))).

Axiom neutrals2 : iterable (fun (y0:Z) (y1:Z) => (y0 + y1)%Z).

Axiom neutrals3 : iterable (fun (y0:Z) (y1:Z) => (y0 * y1)%Z).

(* Why3 assumption *)
Definition isum {a:Type} {a_WT:WhyType a} (s:set a) (t1:a -> Z) : Z :=
  iterate (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) s t1.

Axiom isum_iter : iterates (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) 0%Z.

Axiom isum_iter__ : iterable (fun (y0:Z) (y1:Z) => (y0 + y1)%Z).

Axiom isum_eq :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> Z) (t':a -> Z),
  (forall (e:a), (mem e s) -> ((t1 e) = (t' e))) ->
  ((isum s t1) = (isum s t')).

Axiom isum_eq_gen :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (t1:a -> Z) (t':a -> Z), (s = s') ->
  (forall (e:a), (mem e s) -> ((t1 e) = (t' e))) ->
  ((isum s t1) = (isum s t')).

Axiom isum_add :
  forall {b:Type} {b_WT:WhyType b},
  forall (s:set b) (f:b -> Z) (x:b), ~ (mem x s) ->
  ((isum (add x s) f) = ((f x) + (isum s f))%Z).

Axiom mul_assoc :
  forall (a:Z) (b:Z) (c:Z), (((a * b)%Z * c)%Z = (a * (b * c)%Z)%Z).

Axiom mul_comm : forall (a:Z) (b:Z), ((a * b)%Z = (b * a)%Z).

Axiom mul_assoc_rev :
  forall (a:Z) (b:Z) (c:Z), ((a * (b * c)%Z)%Z = ((a * b)%Z * c)%Z).

Axiom mult_add_distr :
  forall (a:Z) (b:Z) (c:Z) (d:Z),
  (((a + b)%Z * (c + d)%Z)%Z =
   ((((a * c)%Z + (a * d)%Z)%Z + (b * c)%Z)%Z + (b * d)%Z)%Z).

Axiom mult_add_right :
  forall (a:Z) (b:Z) (c:Z), (((a + b)%Z * c)%Z = ((a * c)%Z + (b * c)%Z)%Z).

Axiom mult_add_right_rev :
  forall (a:Z) (b:Z) (c:Z), (((a * c)%Z + (b * c)%Z)%Z = ((a + b)%Z * c)%Z).

Axiom mult_add_left :
  forall (a:Z) (b:Z) (c:Z), ((a * (b + c)%Z)%Z = ((a * b)%Z + (a * c)%Z)%Z).

Axiom mult_add_left_rev :
  forall (a:Z) (b:Z) (c:Z), (((a * b)%Z + (a * c)%Z)%Z = (a * (b + c)%Z)%Z).

Axiom mult_add_distr_rev :
  forall (a:Z) (b:Z) (c:Z) (d:Z),
  (((((a * c)%Z + (a * d)%Z)%Z + (b * c)%Z)%Z + (b * d)%Z)%Z =
   ((a + b)%Z * (c + d)%Z)%Z).

Axiom mul_assoc_comm :
  forall (a:Z) (b:Z) (c:Z), (((a * b)%Z * c)%Z = (b * (a * c)%Z)%Z).

Axiom mul_assoc_rev_comm :
  forall (a:Z) (b:Z) (c:Z), ((a * (b * c)%Z)%Z = ((a * c)%Z * b)%Z).

Axiom add_assoc :
  forall (a:Z) (b:Z) (c:Z), (((a + b)%Z + c)%Z = (a + (b + c)%Z)%Z).

Axiom add_assoc_rev :
  forall (a:Z) (b:Z) (c:Z), ((a + (b + c)%Z)%Z = ((a + b)%Z + c)%Z).

Axiom isum_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> Z), (is_empty s) -> ((isum s f) = 0%Z).

Axiom isum_iter_ :
  opposite_n (fun (y0:Z) (y1:Z) => (y0 + y1)%Z)
  (fun (y0:Z) (y1:Z) => (y0 - y1)%Z) 0%Z.

Axiom isum_iter_1 :
  opposite (fun (y0:Z) (y1:Z) => (y0 + y1)%Z)
  (fun (y0:Z) (y1:Z) => (y0 - y1)%Z).

Axiom isum_iter_2 :
  opposite_com (fun (y0:Z) (y1:Z) => (y0 + y1)%Z)
  (fun (y0:Z) (y1:Z) => (y0 - y1)%Z).

Axiom isum_iter_3 :
  inverse_tuple (fun (y0:Z) (y1:Z) => (y0 + y1)%Z)
  (fun (y0:Z) (y1:Z) => (y0 - y1)%Z) 0%Z.

(* Why3 assumption *)
Definition ind_isum (f:Z -> Z) (i:Z) (j:Z) : Z :=
  int_iterate (fun (y0:Z) (y1:Z) => (y0 + y1)%Z) f i j.

Axiom ind_isum_empty :
  forall (f:Z -> Z) (i:Z) (j:Z), (j <= i)%Z -> ((ind_isum f i j) = 0%Z).

Axiom ind_isum_one :
  forall (f:Z -> Z) (i:Z) (j:Z), (j = (i + 1%Z)%Z) ->
  ((ind_isum f i j) = (f i)).

Axiom ind_isum_plus_one :
  forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_isum f i j) = ((f i) + (ind_isum f (i + 1%Z)%Z j))%Z).

Axiom ind_isum_to_isum :
  forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_isum f i j) = (isum (to_fset i j) f)).

Axiom ind_isum_const :
  forall (k:Z) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_isum ((fun (y0:Z) (y1:Z) => y0) k) i j) = (k * (j - i)%Z)%Z).

Axiom ind_isum_right_extension :
  forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z ->
  ((ind_isum f i (j + 1%Z)%Z) = ((ind_isum f i j) + (f j))%Z).

Axiom ind_isum_eq :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((ind_isum f i j) = (ind_isum g i j)).

Parameter fc: (Z -> Z) -> (Z -> Z) -> (Z -> bool) -> Z -> Z.

Axiom fc_def :
  forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (k:Z),
  (((p k) = true) -> (((fc f g p) k) = (f k))) /\
  (~ ((p k) = true) -> (((fc f g p) k) = (g k))).

Axiom ind_isum_to_guard :
  forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((p k) = true)) ->
  ((ind_isum (fc f g p) i j) = (ind_isum f i j)).

Parameter fc1: (Z -> Z) -> (Z -> Z) -> (Z -> bool) -> Z -> Z.

Axiom fc_def1 :
  forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (k:Z),
  (((p k) = true) -> (((fc1 f g p) k) = (g k))) /\
  (~ ((p k) = true) -> (((fc1 f g p) k) = (f k))).

Axiom ind_isum_no_guard :
  forall (f:Z -> Z) (g:Z -> Z) (p:Z -> bool) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ~ ((p k) = true)) ->
  ((ind_isum (fc1 f g p) i j) = (ind_isum f i j)).

Axiom ind_isum_eq_gen :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (i1:Z) (j:Z) (j1:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) -> (i = i1) ->
  (j = j1) -> ((ind_isum f i j) = (ind_isum g i1 j1)).

Axiom ind_isum_func_const :
  forall (k:Z) (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  (forall (l:Z), ((i <= l)%Z /\ (l < j)%Z) -> ((f l) = k)) ->
  ((ind_isum f i j) = (k * (j - i)%Z)%Z).

Axiom ind_isum_pos :
  forall (f:Z -> Z) (i:Z) (j:Z), (i <= j)%Z ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z <= (f k))%Z) ->
  (0%Z <= (ind_isum f i j))%Z.

(* Why3 assumption *)
Definition ind_iproduct (f:Z -> Z) (i:Z) (j:Z) : Z :=
  int_iterate (fun (y0:Z) (y1:Z) => (y0 * y1)%Z) f i j.

Axiom ind_iproduct_eq :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((ind_iproduct f i j) = (ind_iproduct g i j)).

Axiom ind_iproduct_eq_gen :
  forall (f:Z -> Z) (g:Z -> Z) (i1:Z) (j1:Z) (i2:Z) (j2:Z),
  (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) ->
  (i1 = i2) -> (j1 = j2) -> ((ind_iproduct f i1 j1) = (ind_iproduct g i2 j2)).

Axiom iproduct_to_iterate :
  forall (f:Z -> Z) (i:Z) (j:Z),
  ((ind_iproduct f i j) =
   (int_iterate (fun (y0:Z) (y1:Z) => (y0 * y1)%Z) f i j)).

Axiom ind_isum_map_auto :
  forall (i:Z) (j:Z) (f:Z -> Z) (t1:Z -> Z),
  (p_bijective f (to_fset i j) (to_fset i j)) ->
  ((ind_isum t1 i j) = (ind_isum (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_isum_map :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> Z),
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((ind_isum t1 k l) = (ind_isum (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_isum_map_auto_bij :
  forall (i:Z) (j:Z) (f:Z -> Z) (t1:Z -> Z),
  (forall (e:Z), ((i <= e)%Z /\ (e < j)%Z) ->
   (i <= (f e))%Z /\ ((f e) < j)%Z) ->
  (forall (e:Z) (e':Z), ((i <= e)%Z /\ (e < j)%Z) ->
   ((i <= e')%Z /\ (e' < j)%Z) -> ~ (e = e') -> ~ ((f e) = (f e'))) ->
  (forall (e':Z), ((i <= e')%Z /\ (e' < j)%Z) ->
   exists e:Z, ((i <= e)%Z /\ (e < j)%Z) /\ ((f e) = e')) ->
  ((ind_isum t1 i j) = (ind_isum (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_isum_map_bij :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> Z),
  (forall (e:Z), ((i <= e)%Z /\ (e < j)%Z) ->
   (k <= (f e))%Z /\ ((f e) < l)%Z) ->
  (forall (e:Z) (e':Z), ((i <= e)%Z /\ (e < j)%Z) ->
   ((i <= e')%Z /\ (e' < j)%Z) -> ~ (e = e') -> ~ ((f e) = (f e'))) ->
  (forall (e':Z), ((k <= e')%Z /\ (e' < l)%Z) ->
   exists e:Z, ((i <= e)%Z /\ (e < j)%Z) /\ ((f e) = e')) ->
  ((ind_isum t1 k l) = (ind_isum (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_iproduct_empty :
  forall (f:Z -> Z) (i:Z) (j:Z), (j <= i)%Z -> ((ind_iproduct f i j) = 1%Z).

Axiom ind_iproduct_plus_one :
  forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_iproduct f i j) = ((f i) * (ind_iproduct f (i + 1%Z)%Z j))%Z).

Axiom ind_iproduct_right_extension :
  forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_iproduct f i j) =
   ((ind_iproduct f i (j - 1%Z)%Z) * (f (j - 1%Z)%Z))%Z).

Axiom ind_iproduct_right_extension_comm :
  forall (f:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  (((ind_iproduct f i (j - 1%Z)%Z) * (f (j - 1%Z)%Z))%Z =
   (ind_iproduct f i j)).

Axiom ind_iproduct_one :
  forall (f:Z -> Z) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = 1%Z)) ->
  ((ind_iproduct f i j) = 1%Z).

Axiom positive_iproduct :
  forall (f:Z -> Z) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> (0%Z < (f k))%Z) ->
  (0%Z < (ind_iproduct f i j))%Z.

Axiom ind_iproduct_left_right :
  forall (f:Z -> Z) (l:Z) (k:Z) (h:Z), ((l <= k)%Z /\ (k <= h)%Z) ->
  ((ind_iproduct f l k) =
   (ind_iproduct (fun (a:Z) => (f ((h - (a + 1%Z)%Z)%Z + l)%Z))
    ((h - k)%Z + l)%Z h)).

Axiom iterable_imult : iterable (fun (y0:Z) (y1:Z) => (y0 * y1)%Z).

Axiom ind_iproduct_map_auto :
  forall (i:Z) (j:Z) (f:Z -> Z) (t1:Z -> Z),
  (p_bijective f (to_fset i j) (to_fset i j)) ->
  ((ind_iproduct t1 i j) = (ind_iproduct (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_iproduct_map :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> Z),
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((ind_iproduct t1 k l) = (ind_iproduct (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_iproduct_trans :
  forall (f:Z -> Z) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) ->
  ((ind_iproduct f i j) = ((ind_iproduct f i k) * (ind_iproduct f k j))%Z).

Axiom ind_isum_transl :
  forall (f:Z -> Z) (i:Z) (j:Z) (k:Z),
  ((ind_isum f i j) =
   (ind_isum (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)).

Axiom ind_isum_transl_plus_one :
  forall (f:Z -> Z) (i:Z) (j:Z),
  ((ind_isum f i j) =
   (ind_isum (fun (b:Z) => (f (b - 1%Z)%Z)) (i + 1%Z)%Z (j + 1%Z)%Z)).

Axiom ind_isum_transl_minus_one :
  forall (f:Z -> Z) (i:Z) (j:Z),
  ((ind_isum f i j) =
   (ind_isum (fun (b:Z) => (f (b + 1%Z)%Z)) (i - 1%Z)%Z (j - 1%Z)%Z)).

Axiom ind_isum_scal :
  forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z ->
  ((ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j) = (a * (ind_isum f i j))%Z).

Axiom ind_isum_scal_rev :
  forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z ->
  ((a * (ind_isum f i j))%Z = (ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j)).

Axiom ind_isum_scal_rev_right :
  forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z ->
  (((ind_isum f i j) * a)%Z = (ind_isum (fun (i1:Z) => ((f i1) * a)%Z) i j)).

Axiom ind_isum_scal_right :
  forall (f:Z -> Z) (i:Z) (j:Z) (a:Z), (i <= j)%Z ->
  ((ind_isum (fun (i1:Z) => ((f i1) * a)%Z) i j) = ((ind_isum f i j) * a)%Z).

Axiom ind_isum_bound :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (i < j)%Z ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) < (g k))%Z) ->
  ((ind_isum f i j) < (ind_isum g i j))%Z.

Axiom comp_trans_equal_strict :
  forall (a:Z) (b:Z) (c:Z), (a <= b)%Z -> (b < c)%Z -> (a < c)%Z.

Axiom compeq_trans_sum :
  forall (a:Z) (b:Z) (c:Z), (b <= c)%Z -> ((a + b)%Z <= (a + c)%Z)%Z.

Axiom compeq_trans_sum_zero :
  forall (a:Z) (b:Z), (0%Z <= b)%Z -> (a <= (a + b)%Z)%Z.

Axiom comp_trans_sum :
  forall (a:Z) (b:Z) (c:Z), (b < c)%Z -> ((a + b)%Z < (a + c)%Z)%Z.

Axiom ind_isum_bound_eq :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (j:Z), (i <= j)%Z ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) <= (g k))%Z) ->
  ((ind_isum f i j) <= (ind_isum g i j))%Z.

Axiom ind_isum_scal_gen :
  forall (f:Z -> Z) (i:Z) (j:Z), forall (a:Z), ((i <= a)%Z /\ (a < j)%Z) ->
  ((ind_isum (fun (i1:Z) => (a * (f i1))%Z) i j) = (a * (ind_isum f i j))%Z).

Axiom ind_isum_trans :
  forall (f:Z -> Z) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) ->
  ((ind_isum f i j) = ((ind_isum f i k) + (ind_isum f k j))%Z).

Parameter power: Z -> Z -> Z.

Axiom power_def :
  forall (e:Z) (i:Z), (0%Z <= i)%Z -> (i = 0%Z) -> ((power e i) = 1%Z).

Axiom power_def1 :
  forall (e:Z) (i:Z), (0%Z <= i)%Z -> ~ (i = 0%Z) ->
  ((power e i) = (e * (power e (i - 1%Z)%Z))%Z).

Axiom Power_zero : forall (i:Z), ((power i 0%Z) = 1%Z).

Axiom Power_one : forall (i:Z), ((power i 1%Z) = i).

Axiom Power_sum :
  forall (x:Z) (y:Z) (i:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z ->
  ((power i (x + y)%Z) = ((power i x) * (power i y))%Z).

Axiom Power_mult :
  forall (x:Z) (y:Z) (i:Z), (0%Z <= x)%Z -> (0%Z <= y)%Z ->
  ((power i (x * y)%Z) = (power (power i x) y)).

Axiom power_plus_one :
  forall (e:Z) (i:Z), (0%Z <= i)%Z ->
  ((power e (i + 1%Z)%Z) = (e * (power e i))%Z).

Axiom power_to_ind_iproduct :
  forall (e:Z) (i:Z), (0%Z <= i)%Z ->
  ((power e i) = (ind_iproduct ((fun (y0:Z) (y1:Z) => y0) e) 0%Z i)).

Axiom power_transl :
  forall (e:Z) (k:Z) (i:Z), (0%Z <= i)%Z ->
  ((power e i) = (ind_iproduct ((fun (y0:Z) (y1:Z) => y0) e) k (k + i)%Z)).

Axiom ind_iproduct_to_power :
  forall (e:Z) (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i <= j)%Z) ->
  ((ind_iproduct ((fun (y0:Z) (y1:Z) => y0) e) i j) = (power e (j - i)%Z)).

Axiom ind_iproduct_to_power_gen :
  forall (e:Z), forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i <= j)%Z) ->
  ((ind_iproduct ((fun (y0:Z) (y1:Z) => y0) e) i j) = (power e (j - i)%Z)).

Axiom power_sum :
  forall (x:Z) (n:Z) (m:Z), (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  ((power x (n + m)%Z) = ((power x n) * (power x m))%Z).

Axiom power_sum_rev :
  forall (x:Z) (n:Z) (m:Z), (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  (((power x n) * (power x m))%Z = (power x (n + m)%Z)).

Axiom power_eq :
  forall (x:Z) (n:Z) (m:Z), (n = m) -> ((power x n) = (power x m)).

Axiom power_eq_gen :
  forall (x:Z) (y:Z) (n:Z) (m:Z), (n = m) -> (x = y) ->
  ((power x n) = (power y m)).

Axiom power_decomp :
  forall (i:Z), (1%Z <= i)%Z ->
  ((ind_isum (fun (k:Z) => (power 2%Z (k + 1%Z)%Z)) 0%Z i) <
   (power 2%Z (i + 1%Z)%Z))%Z.

Parameter fc2: Z -> Z -> Z.

Axiom fc_def2 :
  forall (i:Z) (k:Z),
  (((1%Z <= k)%Z /\ (k < (i + 1%Z)%Z)%Z) ->
   (((fc2 i) k) = (power 2%Z (k - 1%Z)%Z))) /\
  (~ ((1%Z <= k)%Z /\ (k < (i + 1%Z)%Z)%Z) -> (((fc2 i) k) = 0%Z)).

Axiom power_decomp_minus_one :
  forall (i:Z), (1%Z <= i)%Z ->
  ((ind_isum (fc2 i) 1%Z i) < (power 2%Z (i - 1%Z)%Z))%Z.

Axiom power_decomp_ :
  forall (i:Z), (1%Z <= i)%Z ->
  ((ind_isum (fun (k:Z) => (power 2%Z k)) 0%Z i) < (power 2%Z i))%Z.

Axiom power_decomp_one :
  forall (i:Z), (1%Z <= i)%Z ->
  ((ind_isum (fun (k:Z) => (power 2%Z (k + 1%Z)%Z)) 1%Z i) <
   (power 2%Z (i + 1%Z)%Z))%Z.

Axiom power_decomp_one_ :
  forall (i:Z), (1%Z <= i)%Z ->
  ((ind_isum (fun (k:Z) => (power 2%Z k)) 1%Z i) < (power 2%Z i))%Z.

Axiom growing_mult :
  forall (n:Z) (m:Z), (0%Z <= n)%Z -> (1%Z <= m)%Z -> (n <= (n * m)%Z)%Z.

Axiom strict_growing_mult :
  forall (n:Z) (m:Z), (1%Z < n)%Z -> (1%Z < m)%Z -> (n < (n * m)%Z)%Z.

Axiom init_exp : forall (k:Z), ((power k 0%Z) = 1%Z).

Axiom init_exp1 : forall (k:Z), ((power k 1%Z) = k).

Axiom init_exp2 : forall (k:Z), ((power k 2%Z) = (k * k)%Z).

Axiom positive_int_exp :
  forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z -> (1%Z <= (power k n))%Z.

Axiom positive_int_exp1 :
  forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z -> (0%Z < (power k n))%Z.

Axiom positive_int_exp2 :
  forall (k:Z) (n:Z), (1%Z <= k)%Z -> (0%Z <= n)%Z ->
  ((power k n) <= (power k (n + 1%Z)%Z))%Z.

Axiom strict_positive_int_exp :
  forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z -> (1%Z < (power k n))%Z.

Axiom strict_positive_int_exp1 :
  forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z ->
  ((power k (n - 1%Z)%Z) < (power k n))%Z.

Axiom strict_positive_int_exp2 :
  forall (k:Z) (n:Z), (1%Z < k)%Z -> (0%Z < n)%Z ->
  ((power k n) < (power k (n + 1%Z)%Z))%Z.

Axiom power_minus_one :
  forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) ->
  ((power (-1%Z)%Z i) = 1%Z).

Axiom power_minus_one1 :
  forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) ->
  ((power (-1%Z)%Z i) = (-1%Z)%Z).

Axiom growing_exp :
  forall (k:Z) (m:Z) (n:Z), (1%Z <= k)%Z -> ((0%Z <= m)%Z /\ (m <= n)%Z) ->
  ((power k m) <= (power k n))%Z.

Axiom strict_growing_exp :
  forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> ((0%Z <= m)%Z /\ (m < n)%Z) ->
  ((power k m) < (power k n))%Z.

Axiom unicity_exp :
  forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> (0%Z <= m)%Z -> (0%Z <= n)%Z ->
  ((power k m) = (power k n)) -> (m = n).

Axiom unicity_exp1 :
  forall (k:Z) (m:Z) (n:Z), (1%Z < k)%Z -> (0%Z <= m)%Z -> (0%Z <= n)%Z ->
  (m = n) -> ((power k m) = (power k n)).

Axiom bounded_sum_exp :
  forall (i:Z) (j:Z) (m:Z) (n:Z), (0%Z <= m)%Z -> (0%Z <= n)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z m))%Z) ->
  ((0%Z <= j)%Z /\ (j < (power 2%Z n))%Z) ->
  (((i * (power 2%Z n))%Z + j)%Z < (power 2%Z (m + n)%Z))%Z.

Parameter result2:
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool.

Axiom result_def2 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (t1:a -> im1) (e:a),
  (((result2 op1 t1) e) = true) <-> ~ (neutral op1 (t1 e)).

(* Why3 assumption *)
Definition nonn_part {a:Type} {a_WT:WhyType a}
    {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) (s:set a)
    (t1:a -> im1) : set a :=
  filter (result2 op1 t1) s.

Axiom nonn_part_spec :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (nonn_part op1 s t1)) -> mem e s.

Axiom nonn_part_spec1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (nonn_part op1 s t1)) -> ~ (neutral op1 (t1 e)).

Axiom nonn_part_spec2 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  ((mem e s) /\ ~ (neutral op1 (t1 e))) -> mem e (nonn_part op1 s t1).

Parameter result3:
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool.

Axiom result_def3 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (t1:a -> im1) (e:a),
  (((result3 op1 t1) e) = true) <-> (neutral op1 (t1 e)).

(* Why3 assumption *)
Definition n_part {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1) : set a :=
  filter (result3 op1 t1) s.

Axiom n_part_spec :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (n_part op1 s t1)) -> mem e s.

Axiom n_part_spec1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (n_part op1 s t1)) -> neutral op1 (t1 e).

Axiom n_part_spec2 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  ((mem e s) /\ (neutral op1 (t1 e))) -> mem e (n_part op1 s t1).

Axiom nullity_partition :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (commut op1) ->
  (s = (union (nonn_part op1 s t1) (n_part op1 s t1))).

Axiom nullity_partition1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (commut op1) ->
  ((inter (nonn_part op1 s t1) (n_part op1 s t1)) = (empty : set a)).

Axiom iterate_neutral :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (iterable op1) ->
  (commut op1) ->
  (forall (a1:a), (mem a1 s) -> ((t1 a1) = (neutral_elt op1))) ->
  ((iterate op1 s t1) = (neutral_elt op1)).

Axiom iterate_nullity_partition :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (iterable op1) ->
  (commut op1) ->
  ((iterate op1 s t1) = (iterate op1 (nonn_part op1 s t1) t1)).

(* Why3 assumption *)
Definition couple {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1} (f:a -> b -> im1) (o:(a* b)%type) : im1 :=
  match o with
  | (a1, b1) => (f a1) b1
  end.

Axiom null_product :
  forall (a:t) (b:t), ((infix_asdt a b) = tzero) ->
  (a = tzero) \/ (b = tzero).

Axiom neutral_tzero :
  neutral (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) tzero.

Axiom neutral_tzero1 : iterable (fun (y0:t) (y1:t) => (infix_pldt y0 y1)).

(* Why3 assumption *)
Definition sum {a:Type} {a_WT:WhyType a} (s:set a) (t1:a -> t) : t :=
  iterate (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) s t1.

Axiom sum_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), (is_empty s) -> ((sum s t1) = tzero).

Axiom sum_one :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), ((cardinal s) = 1%Z) ->
  ((sum s t1) = (t1 (choose s))).

Axiom sum_add :
  forall {b:Type} {b_WT:WhyType b},
  forall (s:set b) (f:b -> t) (x:b), ~ (mem x s) ->
  ((sum (add x s) f) = (infix_pldt (f x) (sum s f))).

Axiom map_sum_eq :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set b) (f:b -> a) (t1:a -> t), (p_injective f s) ->
  ((sum (map f s) t1) = (sum s (fun (b1:b) => (t1 (f b1))))).

Axiom sum_comp :
  forall {b:Type} {b_WT:WhyType b},
  forall (s:set b) (f:b -> t) (g:b -> t),
  ((sum s (fun (k:b) => (infix_pldt (f k) (g k)))) =
   (infix_pldt (sum s f) (sum s g))).

Axiom sum_iter_ :
  opposite_n (fun (y0:t) (y1:t) => (infix_pldt y0 y1))
  (fun (y0:t) (y1:t) => (infix_mndt y0 y1)) tzero.

Axiom sum_iter_1 :
  opposite (fun (y0:t) (y1:t) => (infix_pldt y0 y1))
  (fun (y0:t) (y1:t) => (infix_mndt y0 y1)).

Axiom sum_iter_2 :
  opposite_com (fun (y0:t) (y1:t) => (infix_pldt y0 y1))
  (fun (y0:t) (y1:t) => (infix_mndt y0 y1)).

Axiom sum_iter_3 :
  inverse_tuple (fun (y0:t) (y1:t) => (infix_pldt y0 y1))
  (fun (y0:t) (y1:t) => (infix_mndt y0 y1)) tzero.

Axiom neutral_zero :
  ((neutral_elt (fun (y0:t) (y1:t) => (infix_pldt y0 y1))) = tzero).

Axiom sum_eq :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> t) (g:a -> t),
  (forall (x:a), (mem x s) -> ((f x) = (g x))) -> ((sum s f) = (sum s g)).

Axiom sum_eq_gen :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (f:a -> t) (g:a -> t), (s = s') ->
  (forall (x:a), (mem x s) -> ((f x) = (g x))) -> ((sum s f) = (sum s' g)).

Axiom sum_disjoint_transitivity :
  forall {a:Type} {a_WT:WhyType a},
  forall (s1:set a) (s2:set a) (t1:a -> t),
  ((inter s1 s2) = (empty : set a)) ->
  ((sum (union s1 s2) t1) = (infix_pldt (sum s1 t1) (sum s2 t1))).

Axiom sum_to_cartesian_product :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b) (f:a -> b -> t),
  ((sum s1 (fun (a1:a) => (sum s2 (f a1)))) =
   (sum (cartesian_product s1 s2)
    (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))).

Axiom sum_from_cartesian_product :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s1:set a) (s2:set b) (f:a -> b -> t),
  ((sum (cartesian_product s1 s2)
    (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))
   = (sum s1 (fun (a1:a) => (sum s2 (f a1))))).

(* Why3 assumption *)
Definition ind_sum (f:Z -> t) (i:Z) (j:Z) : t :=
  int_iterate (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) f i j.

Axiom ind_sum_to_int_iterate :
  forall (f:Z -> t) (i:Z) (j:Z),
  ((ind_sum f i j) =
   (int_iterate (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) f i j)).

Axiom ind_sum_cardone :
  forall (f:Z -> t) (i:Z) (j:Z), (j = (i + 1%Z)%Z) ->
  ((ind_sum f i j) = (f i)).

Axiom ind_sum_right_extension :
  forall (f:Z -> t) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_sum f i j) = (infix_pldt (ind_sum f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))).

Axiom ind_sum_plus_one :
  forall (f:Z -> t) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_sum f i j) = (infix_pldt (f i) (ind_sum f (i + 1%Z)%Z j))).

Axiom ind_sum_eq :
  forall (f:Z -> t) (g:Z -> t) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((ind_sum f i j) = (ind_sum g i j)).

Parameter fc3: (Z -> t) -> t -> Z -> Z -> Z -> t.

Axiom fc_def3 :
  forall (f:Z -> t) (g:t) (i:Z) (j:Z) (k:Z),
  (((i <= k)%Z /\ (k < j)%Z) -> (((fc3 f g i j) k) = (f k))) /\
  (~ ((i <= k)%Z /\ (k < j)%Z) -> (((fc3 f g i j) k) = g)).

Axiom ind_sum_eq_del_bound :
  forall (f:Z -> t) (g:t) (i:Z) (j:Z),
  ((ind_sum (fc3 f g i j) i j) = (ind_sum f i j)).

Parameter fc4: (Z -> t) -> t -> Z -> Z -> Z -> t.

Axiom fc_def4 :
  forall (f:Z -> t) (g:t) (i:Z) (j:Z) (k:Z),
  (((i <= k)%Z /\ (k < j)%Z) -> (((fc4 f g i j) k) = (f k))) /\
  (~ ((i <= k)%Z /\ (k < j)%Z) -> (((fc4 f g i j) k) = g)).

Axiom ind_sum_eq_del_bound_rev :
  forall (f:Z -> t) (g:t) (i:Z) (j:Z),
  ((ind_sum f i j) = (ind_sum (fc4 f g i j) i j)).

Axiom ind_sum_eq_gen :
  forall (f:Z -> t) (g:Z -> t) (i1:Z) (j1:Z) (i2:Z) (j2:Z), (i1 = i2) ->
  (j1 = j2) ->
  (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) ->
  ((ind_sum f i1 j1) = (ind_sum g i2 j2)).

Axiom ind_sum_eq_bound :
  forall (f:Z -> t) (g:Z -> t) (i:Z) (j:Z), (i = j) ->
  (forall (k:Z), ((0%Z <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((ind_sum f 0%Z i) = (ind_sum g 0%Z j)).

Axiom ind_sum_comp :
  forall (f:Z -> t) (g:Z -> t) (i:Z) (j:Z),
  ((ind_sum (fun (k:Z) => (infix_pldt (f k) (g k))) i j) =
   (infix_pldt (ind_sum f i j) (ind_sum g i j))).

Axiom ind_sum_to_iterate :
  forall (f:Z -> t) (i:Z) (j:Z),
  ((ind_sum f i j) =
   (iterate (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) (to_fset i j) f)).

Axiom ind_sum_to_sum :
  forall (f:Z -> t) (i:Z) (j:Z), ((ind_sum f i j) = (sum (to_fset i j) f)).

Axiom map_ind_sum_eq :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> t),
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((ind_sum t1 k l) = (ind_sum (fun (b:Z) => (t1 (f b))) i j)).

Axiom sum_scal :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:a -> t) (s:set a) (c:t),
  ((sum s (fun (x:a) => (infix_asdt c (f x)))) = (infix_asdt c (sum s f))).

Axiom ind_sum_scal :
  forall (f:Z -> t) (i:Z) (j:Z) (a:t),
  ((ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j) =
   (infix_asdt a (ind_sum f i j))).

Axiom ind_sum_scal_rev :
  forall (f:Z -> t) (i:Z) (j:Z) (a:t),
  ((infix_asdt a (ind_sum f i j)) =
   (ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j)).

Axiom sum_scal_gen :
  forall (f:Z -> t) (s:set Z), forall (a:t),
  ((sum s (fun (i:Z) => (infix_asdt a (f i)))) = (infix_asdt a (sum s f))).

Axiom ind_sum_scal_gen :
  forall (f:Z -> t) (i:Z) (j:Z), forall (a:t),
  ((ind_sum (fun (i1:Z) => (infix_asdt a (f i1))) i j) =
   (infix_asdt a (ind_sum f i j))).

Axiom int_int_iterate_def_empty :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (j <= i)%Z -> (iterable op1) ->
  ((int_int_iterate op1 f i j k l) = (neutral_elt op1)).

Axiom int_int_iterate_def_plus_one :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (i < j)%Z -> (iterable op1) ->
  ((int_int_iterate op1 f i j k l) =
   ((op1 (int_iterate op1 (fun (n:Z) => ((f i) n)) k l))
    (int_int_iterate op1 f (i + 1%Z)%Z j k l))).

Axiom int_int_iterate_to_int_iterate :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (i <= j)%Z -> (iterable op1) ->
  ((int_int_iterate op1 f i j k l) =
   (int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j)).

Axiom int_iterate_to_int_int_iterate :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (i <= j)%Z -> (iterable op1) ->
  ((int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j) =
   (int_int_iterate op1 f i j k l)).

Axiom int_int_iterate_to_iterate :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (i <= j)%Z -> (iterable op1) -> (commut op1) ->
  ((int_int_iterate op1 f i j k l) =
   (iterate op1 (cartesian_product (to_fset i j) (to_fset k l))
    (fun (o:(Z* Z)%type) => ((f (fir o)) (sec o))))).

Axiom iterate_commute :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}
    {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s1:set a) (s2:set b) (f:a -> b -> im1),
  (iterable op1) -> (commut op1) ->
  ((iterate op1 (cartesian_product s1 s2)
    (fun (o:(a* b)%type) => ((f (fir o)) (sec o))))
   =
   (iterate op1 (cartesian_product s2 s1)
    (fun (o:(b* a)%type) => ((f (sec o)) (fir o))))).

Axiom int_int_iterate_commute :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (iterable op1) -> (commut op1) -> (i <= j)%Z -> (k <= l)%Z ->
  ((int_int_iterate op1 f i j k l) =
   (int_int_iterate op1 (fun (a:Z) (b:Z) => ((f b) a)) k l i j)).

Axiom int_iterate_commute :
  forall {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (f:Z -> Z -> im1) (i:Z) (j:Z) (k:Z) (l:Z),
  (iterable op1) -> (commut op1) -> (i <= j)%Z -> (k <= l)%Z ->
  ((int_iterate op1 (fun (a:Z) => (int_iterate op1 (f a) k l)) i j) =
   (int_iterate op1
    (fun (a:Z) => (int_iterate op1 (fun (b:Z) => ((f b) a)) i j)) k l)).

Axiom ind_sum_commute :
  forall (f:Z -> Z -> t) (i:Z) (j:Z) (k:Z) (l:Z), (i <= j)%Z -> (k <= l)%Z ->
  ((ind_sum (fun (k1:Z) => (ind_sum (f k1) k l)) i j) =
   (ind_sum (fun (k1:Z) => (ind_sum (fun (k2:Z) => ((f k2) k1)) i j)) k l)).

(* Why3 assumption *)
Definition non_tzero {a:Type} {a_WT:WhyType a} (s:set a) (t1:a -> t) : set a :=
  nonn_part (fun (y0:t) (y1:t) => (infix_pldt y0 y1)) s t1.

Axiom non_tzero_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), forall (e:a), (mem e (non_tzero s t1)) ->
  mem e s.

Axiom non_tzero_spec1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), forall (e:a), (mem e (non_tzero s t1)) ->
  ~ ((t1 e) = tzero).

Axiom non_tzero_spec2 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), forall (e:a),
  ((mem e s) /\ ~ ((t1 e) = tzero)) -> mem e (non_tzero s t1).

Axiom get_non_tzero_member :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (e:a), (mem e (non_tzero s t1)) -> mem e s.

Axiom get_non_tzero_member1 :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (e:a), (mem e (non_tzero s t1)) ->
  ~ ((t1 e) = tzero).

Axiom set_non_tzero_member :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (e:a), (mem e s) -> ~ ((t1 e) = tzero) ->
  mem e (non_tzero s t1).

Axiom set_non_tzero_member_gen :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), forall (e:a),
  ((mem e s) /\ ~ ((t1 e) = tzero)) -> mem e (non_tzero s t1).

Axiom set_non_tzero_member_gen_ :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), forall (e:a),
  ((mem e s) /\ ~ ((t1 e) = tzero)) -> mem e (non_tzero s t1).

Axiom sum_nullity_partition :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), ((sum s t1) = (sum (non_tzero s t1) t1)).

Axiom non_null_map :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> a) (t1:a -> t),
  ((non_tzero (map f s) t1) =
   (map f (non_tzero s (fun (b:a) => (t1 (f b)))))).

Axiom map_sum_eq_nonnull :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> a) (t1:a -> t),
  (p_bijective f (non_tzero s (fun (b:a) => (t1 (f b))))
   (non_tzero (map f s) t1)) ->
  ((sum (non_tzero (map f s) t1) t1) =
   (sum (non_tzero s (fun (b:a) => (t1 (f b)))) (fun (b:a) => (t1 (f b))))).

Axiom sum_null_but_one :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), ((cardinal (non_tzero s t1)) = 1%Z) ->
  ((sum s t1) = (t1 (element (non_tzero s t1)))).

Axiom sum_null :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t), ((cardinal (non_tzero s t1)) = 0%Z) ->
  ((sum s t1) = tzero).

Axiom ind_sum_null :
  forall (t1:Z -> t) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((t1 k) = tzero)) ->
  ((ind_sum t1 i j) = tzero).

Axiom sum_null_but_one_elt :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (elt:a),
  ((mem elt s) /\ ~ ((t1 elt) = tzero)) ->
  (forall (a1:a), (mem a1 s) -> ~ (a1 = elt) -> ((t1 a1) = tzero)) ->
  ((sum s t1) = (t1 elt)).

Axiom sum_null_but_maybe_one_elt :
  forall {a:Type} {a_WT:WhyType a},
  forall (t1:a -> t) (s:set a) (elt:a), (mem elt s) ->
  (forall (k:a), (mem k s) -> ~ (k = elt) -> ((t1 k) = tzero)) ->
  ((sum s t1) = (t1 elt)).

Axiom ind_sum_null_but_maybe_one_elt :
  forall (t1:Z -> t) (i:Z) (j:Z) (ind:Z), ((i <= ind)%Z /\ (ind < j)%Z) ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ~ (k = ind) ->
   ((t1 k) = tzero)) ->
  ((ind_sum t1 i j) = (t1 ind)).

Axiom neutral_tone : neutral (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) tone.

Axiom neutral_tone1 : iterable (fun (y0:t) (y1:t) => (infix_asdt y0 y1)).

Axiom product_iter :
  op_neutral_left (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) tone.

Axiom product_iter1 :
  op_neutral_right (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) tone.

Axiom product_iter2 : op_assoc (fun (y0:t) (y1:t) => (infix_asdt y0 y1)).

Axiom product_iter3 : commut (fun (y0:t) (y1:t) => (infix_asdt y0 y1)).

Axiom product_iter4 :
  iterates (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) tone.

(* Why3 assumption *)
Definition product {a:Type} {a_WT:WhyType a} (s:set a) (t1:a -> t) : t :=
  iterate (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) s t1.

Axiom product_eq :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (t':a -> t),
  (forall (e:a), (mem e s) -> ((t1 e) = (t' e))) ->
  ((product s t1) = (product s t')).

Axiom product_eq_gen :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (s':set a) (t1:a -> t) (t':a -> t), (s = s') ->
  (forall (e:a), (mem e s) -> ((t1 e) = (t' e))) ->
  ((product s t1) = (product s' t')).

Axiom product_empty :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> t), (is_empty s) -> ((product s f) = tone).

Axiom product_iter_ : iterable (fun (y0:t) (y1:t) => (infix_asdt y0 y1)).

Axiom add_product :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> t) (x:a), ~ (mem x s) ->
  ((product (add x s) f) = (infix_asdt (f x) (product s f))).

Axiom product_add :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (f:a -> t) (x:a), ~ (mem x s) ->
  ((product (add x s) f) = (infix_asdt (product s f) (f x))).

Axiom neutral_one :
  ((neutral_elt (fun (y0:t) (y1:t) => (infix_asdt y0 y1))) = tone).

(* Why3 assumption *)
Definition ind_product (f:Z -> t) (i:Z) (j:Z) : t :=
  int_iterate (fun (y0:t) (y1:t) => (infix_asdt y0 y1)) f i j.

Axiom ind_product_eq :
  forall (f:Z -> t) (g:Z -> t) (i:Z) (j:Z),
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((ind_product f i j) = (ind_product g i j)).

Axiom ind_product_cardone :
  forall (f:Z -> t) (i:Z) (j:Z), (j = (i + 1%Z)%Z) ->
  ((ind_product f i j) = (f i)).

Axiom ind_product_eq_gen :
  forall (f:Z -> t) (g:Z -> t) (i1:Z) (j1:Z) (i2:Z) (j2:Z),
  (forall (k:Z), ((i1 <= k)%Z /\ (k < j1)%Z) -> ((f k) = (g k))) ->
  (i1 = i2) -> (j1 = j2) -> ((ind_product f i1 j1) = (ind_product g i2 j2)).

Axiom ind_product_right_extension :
  forall (f:Z -> t) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_product f i j) =
   (infix_asdt (ind_product f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))).

Axiom ind_product_left_extension :
  forall (f:Z -> t) (i:Z) (j:Z), (i < j)%Z ->
  ((ind_product f i j) = (infix_asdt (f i) (ind_product f (i + 1%Z)%Z j))).

Axiom ind_product_to_product :
  forall (f:Z -> t) (i:Z) (j:Z),
  ((ind_product f i j) = (product (to_fset i j) f)).

Axiom map_product_eq :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (s:set b) (f:b -> a) (t1:a -> t), (p_injective f s) ->
  ((product (map f s) t1) = (product s (fun (b1:b) => (t1 (f b1))))).

Axiom map_ind_product_eq :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> t),
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((ind_product t1 k l) = (ind_product (fun (b:Z) => (t1 (f b))) i j)).

Axiom ind_product_right_extension_comm :
  forall (f:Z -> t) (i:Z) (j:Z), (i < j)%Z ->
  ((infix_asdt (ind_product f i (j - 1%Z)%Z) (f (j - 1%Z)%Z)) =
   (ind_product f i j)).

Axiom ind_product_eq_func :
  forall (i:Z) (j:Z) (f1:Z -> t) (f2:Z -> t),
  (p_injective f1 (to_fset i j)) -> (p_injective f2 (to_fset i j)) ->
  ((map f1 (to_fset i j)) = (map f2 (to_fset i j))) ->
  ((ind_product f1 i j) = (ind_product f2 i j)).

Axiom ind_product_trans :
  forall (f:Z -> t) (i:Z) (k:Z) (j:Z), ((i <= k)%Z /\ (k <= j)%Z) ->
  ((ind_product f i j) =
   (infix_asdt (ind_product f i k) (ind_product f k j))).

Axiom ind_product_zero_pre :
  forall (f:Z -> t) (i:Z) (t1:Z) (j:Z), ((i <= t1)%Z /\ (t1 < j)%Z) ->
  ((f t1) = tzero) -> ((ind_product f i j) = tzero).

Axiom ind_product_zero :
  forall (f:Z -> t) (i:Z) (j:Z), (i <= j)%Z ->
  (exists t1:Z, ((i <= t1)%Z /\ (t1 < j)%Z) /\ ((f t1) = tzero)) ->
  ((ind_product f i j) = tzero).

Axiom ind_product_zero_elt :
  forall (f:Z -> t) (i:Z) (j:Z) (t1:Z), (i <= j)%Z ->
  ((i <= t1)%Z /\ (t1 < j)%Z) -> ((f t1) = tzero) ->
  ((ind_product f i j) = tzero).

Axiom ind_product_const_tone :
  forall (f:Z -> t) (i:Z) (j:Z), (i <= j)%Z ->
  (forall (t1:Z), ((i <= t1)%Z /\ (t1 < j)%Z) -> ((f t1) = tone)) ->
  ((ind_product f i j) = tone).

Axiom abs_eqinf :
  forall (x:Z) (y:Z), ((x <= y)%Z /\ (y <= 0%Z)%Z) ->
  ((ZArith.BinInt.Z.abs y) <= (ZArith.BinInt.Z.abs x))%Z.

Axiom abs_inf :
  forall (x:Z) (y:Z), ((0%Z < x)%Z /\ ((x < y)%Z /\ (y <= 0%Z)%Z)) ->
  ((ZArith.BinInt.Z.abs y) < (ZArith.BinInt.Z.abs x))%Z.

Axiom abs_eqsup :
  forall (x:Z) (y:Z), ((x <= 0%Z)%Z /\ (y <= x)%Z) ->
  ((ZArith.BinInt.Z.abs x) <= (ZArith.BinInt.Z.abs y))%Z.

Axiom abs_sup :
  forall (x:Z) (y:Z), ((x <= 0%Z)%Z /\ (y < x)%Z) ->
  ((ZArith.BinInt.Z.abs x) < (ZArith.BinInt.Z.abs y))%Z.

Axiom inv_negeq :
  forall (x:Z), (x <= 0%Z)%Z -> (0%Z <= (ZArith.BinInt.Z.abs x))%Z.

Axiom inv_neg1 :
  forall (x:Z), (x < 0%Z)%Z -> (0%Z < (ZArith.BinInt.Z.abs x))%Z.

Parameter cpower: t -> Z -> t.

Axiom Cpower_zero : forall (i:t), ((cpower i 0%Z) = tone).

Axiom Cpower_one : forall (i:t), ((cpower i 1%Z) = i).

Axiom Cpower_sum :
  forall (i:t), forall (n:Z) (m:Z), ~ (i = tzero) ->
  ((cpower i (n + m)%Z) = (infix_asdt (cpower i n) (cpower i m))).

Axiom Cpower_sum1 :
  forall (i:t), forall (n:Z) (m:Z), ~ (n = (-m)%Z) ->
  ((cpower i (n + m)%Z) = (infix_asdt (cpower i n) (cpower i m))).

Axiom zero_poower : forall (e:Z), ~ (e = 0%Z) -> ((cpower tzero e) = tzero).

Parameter squarert_two: t.

Axiom real_squarert_two : real_ squarert_two.

Axiom squarertTwo : ((cpower squarert_two 2%Z) = (infix_pldt tone tone)).

Axiom complete_rt_two :
  forall (a:t), (a = (infix_sldt squarert_two (infix_pldt tone tone))) ->
  ((infix_asdt squarert_two a) = tone).

Axiom cpower_sum :
  forall (x:t) (n:Z) (m:Z), ~ (x = tzero) ->
  ((cpower x (n + m)%Z) = (infix_asdt (cpower x n) (cpower x m))).

Axiom cpower_sum1 :
  forall (x:t) (n:Z) (m:Z), ~ (n = (-m)%Z) ->
  ((cpower x (n + m)%Z) = (infix_asdt (cpower x n) (cpower x m))).

Axiom cpower_one : forall (x:t) (n:Z), (n = 1%Z) -> ((cpower x n) = x).

Axiom cpower_sum_rev :
  forall (x:t) (n:Z) (m:Z), ~ (x = tzero) ->
  ((infix_asdt (cpower x n) (cpower x m)) = (cpower x (n + m)%Z)).

Axiom cpower_sum_rev1 :
  forall (x:t) (n:Z) (m:Z), ~ (n = (-m)%Z) ->
  ((infix_asdt (cpower x n) (cpower x m)) = (cpower x (n + m)%Z)).

Axiom cpower_plus_one :
  forall (e:t) (i:Z), ~ (e = tzero) ->
  ((cpower e (i + 1%Z)%Z) = (infix_asdt (cpower e i) e)).

Axiom cpower_plus_one1 :
  forall (e:t) (i:Z), ~ (i = (-1%Z)%Z) ->
  ((cpower e (i + 1%Z)%Z) = (infix_asdt (cpower e i) e)).

Axiom cpower_zero : forall (e:t), ((cpower e 0%Z) = tone).

Axiom cpower_inv :
  forall (e:t) (i:Z), ~ (e = tzero) ->
  ((infix_asdt (cpower e i) (cpower e (-i)%Z)) = tone).

Axiom cpower_inv_rew :
  forall (e:t) (i:Z), ~ (e = tzero) ->
  ((cpower e i) = (infix_sldt tone (cpower e (-i)%Z))).

Axiom inv_cpower :
  forall (e:t) (i:Z), ~ ((cpower e i) = tzero) ->
  ((infix_sldt tone (cpower e i)) = (cpower e (-i)%Z)).

Axiom cpower_tone_pos :
  forall (m:Z), (0%Z <= m)%Z -> ((cpower tone m) = tone).

Axiom cpower_iterate :
  forall (e:t) (i:Z), (0%Z <= i)%Z ->
  ((cpower e i) =
   (int_iterate (fun (y0:t) (y1:t) => (infix_asdt y0 y1))
    ((fun (y0:t) (y1:Z) => y0) e) 0%Z i)).

Axiom cpower_mult_pre :
  forall (x:t) (n:Z) (m:Z), (0%Z <= m)%Z ->
  ((cpower x (n * m)%Z) = (cpower (cpower x n) m)).

Axiom cpower_mult :
  forall (x:t) (n:Z) (m:Z), ((cpower x (n * m)%Z) = (cpower (cpower x n) m)).

Axiom non_zero_cpower_pos :
  forall (i:t) (n:Z), ~ (i = tzero) -> (0%Z <= n)%Z ->
  ~ ((cpower i n) = tzero).

Axiom inv_cpower_ :
  forall (e:t) (i:Z), ~ (e = tzero) ->
  ((infix_sldt tone (cpower e i)) = (cpower e (-i)%Z)).

Axiom zero_cpower_pos :
  forall (n:Z), (0%Z < n)%Z -> ((cpower tzero n) = tzero).

Axiom zero_cpower : forall (n:Z), ~ (n = 0%Z) -> ((cpower tzero n) = tzero).

Axiom non_zero_cpower :
  forall (i:t) (n:Z), ~ (i = tzero) -> ~ ((cpower i n) = tzero).

Axiom real_cpower_pos :
  forall (elt:t) (i:Z), (real_ elt) -> (0%Z <= i)%Z -> real_ (cpower elt i).

Axiom real_cpower :
  forall (elt:t) (i:Z), (real_ elt) -> real_ (cpower elt i).

Axiom pre_cond_int_ :
  forall (a:t) (b:t) (c:t), (infix_lsdt a b) -> (infix_lsdt tzero c) ->
  infix_lsdt (infix_asdt a c) (infix_asdt b c).

Axiom growing_mult1 :
  forall (n:t) (m:t), (infix_lseqdt tzero n) -> (infix_lseqdt tone m) ->
  infix_lseqdt n (infix_asdt n m).

Axiom strict_growing_mult_pos :
  forall (n:t) (m:t), (infix_lsdt tone n) -> (infix_lsdt tone m) ->
  infix_lsdt n (infix_asdt n m).

Axiom init_exp3 : forall (k:t), ((cpower k 0%Z) = tone).

Axiom init_exp4 : forall (k:t), ((cpower k 1%Z) = k).

Axiom init_exp5 : forall (k:t), ((cpower k 2%Z) = (infix_asdt k k)).

Axiom int_exp_pos :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (0%Z <= n)%Z ->
  infix_gteqdt (cpower k n) tone.

Axiom int_exp_pos1 :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (0%Z <= n)%Z ->
  infix_gtdt (cpower k n) tzero.

Axiom int_exp_pos2 :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (0%Z <= n)%Z ->
  infix_lseqdt (cpower k n) (cpower k (n + 1%Z)%Z).

Axiom strict_int_exp_pos :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (0%Z < n)%Z ->
  infix_gtdt (cpower k n) tone.

Axiom strict_int_exp_pos1 :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (0%Z < n)%Z ->
  infix_lsdt (cpower k (n - 1%Z)%Z) (cpower k n).

Axiom strict_int_exp_pos2 :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (0%Z < n)%Z ->
  infix_lsdt (cpower k n) (cpower k (n + 1%Z)%Z).

Axiom strict_int_exp_neg :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (n < 0%Z)%Z ->
  infix_lsdt (cpower k n) tone.

Axiom strict_int_exp_neg1 :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (n < 0%Z)%Z ->
  infix_lsdt (cpower k (n - 1%Z)%Z) (cpower k n).

Axiom strict_int_exp_neg2 :
  forall (k:t) (n:Z), (infix_lsdt tone k) -> (n < 0%Z)%Z ->
  infix_lsdt (cpower k n) (cpower k (n + 1%Z)%Z).

Axiom int_exp_neg :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (n < 0%Z)%Z ->
  infix_lseqdt (cpower k n) tone.

Axiom int_exp_neg1 :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (n < 0%Z)%Z ->
  infix_gtdt (cpower k n) tzero.

Axiom int_exp_neg2 :
  forall (k:t) (n:Z), (infix_lseqdt tone k) -> (n < 0%Z)%Z ->
  infix_lseqdt (cpower k n) (cpower k (n + 1%Z)%Z).

Axiom positive_exp :
  forall (k:t) (m:Z), (infix_lseqdt tone k) -> infix_lsdt tzero (cpower k m).

Axiom growing_exp_pos :
  forall (k:t) (m:Z) (n:Z), (infix_lseqdt tone k) ->
  ((0%Z <= m)%Z /\ (m <= n)%Z) -> infix_lseqdt (cpower k m) (cpower k n).

Axiom growing_exp1 :
  forall (k:t) (m:Z) (n:Z), (infix_lseqdt tone k) -> (m <= n)%Z ->
  infix_lseqdt (cpower k m) (cpower k n).

Axiom strict_growing_exp1 :
  forall (k:t) (m:Z) (n:Z), (infix_lsdt tone k) -> (m < n)%Z ->
  infix_lsdt (cpower k m) (cpower k n).

Axiom cpower_comm_pos :
  forall (x:t) (y:t) (n:Z), (infix_lseqdt tone x) -> (infix_lseqdt tone y) ->
  (0%Z <= n)%Z ->
  ((cpower (infix_asdt x y) n) = (infix_asdt (cpower x n) (cpower y n))).

Axiom cpower_comm :
  forall (x:t) (y:t) (n:Z), (infix_lseqdt tone x) -> (infix_lseqdt tone y) ->
  ((cpower (infix_asdt x y) n) = (infix_asdt (cpower x n) (cpower y n))).

Axiom unicity_exp2 :
  forall (k:t) (m:Z) (n:Z), (infix_lsdt tone k) ->
  ((cpower k m) = (cpower k n)) -> (m = n).

Axiom unicity_exp3 :
  forall (k:t) (m:Z) (n:Z), (infix_lsdt tone k) -> (m = n) ->
  ((cpower k m) = (cpower k n)).

Axiom div_plus_one :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  (((int.EuclideanDivision.div i j) * j)%Z <= i)%Z.

Axiom div_plus_one1 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  (i < (((int.EuclideanDivision.div i j) + 1%Z)%Z * j)%Z)%Z.

Axiom zero_add : forall (a1:Z) (a2:Z), (a1 = 0%Z) -> ((a1 + a2)%Z = a2).

Axiom add_zero : forall (a1:Z) (a2:Z), (a2 = 0%Z) -> ((a1 + a2)%Z = a1).

Axiom one_mult : forall (a1:Z) (a2:Z), (a1 = 1%Z) -> ((a1 * a2)%Z = a2).

Axiom mult_one : forall (a1:Z) (a2:Z), (a2 = 1%Z) -> ((a1 * a2)%Z = a1).

Axiom add_eq :
  forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) ->
  ((a1 + b1)%Z = (a2 + b2)%Z).

Axiom mult_eq :
  forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) ->
  ((a1 * b1)%Z = (a2 * b2)%Z).

Axiom add_eq_inv :
  forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) ->
  ((a1 + b1)%Z = (b2 + a2)%Z).

Axiom mult_eq_inv :
  forall (a1:Z) (a2:Z) (b1:Z) (b2:Z), (a1 = a2) -> (b1 = b2) ->
  ((a1 * b1)%Z = (b2 * a2)%Z).

Axiom bound_eq :
  forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < j)%Z) ->
  (i = (int.EuclideanDivision.mod1 i j)).

Axiom bound_eq_rev :
  forall (i:Z) (j:Z), ((0%Z <= i)%Z /\ (i < j)%Z) ->
  ((int.EuclideanDivision.mod1 i j) = i).

Axiom unicity_div_mod :
  forall (i:Z) (j:Z) (q:Z) (r:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z ->
  (0%Z <= r)%Z -> (0%Z < j)%Z -> (i = ((q * j)%Z + r)%Z) ->
  ((0%Z <= r)%Z /\ (r < j)%Z) -> (q = (int.EuclideanDivision.div i j)).

Axiom unicity_div_mod1 :
  forall (i:Z) (j:Z) (q:Z) (r:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z ->
  (0%Z <= r)%Z -> (0%Z < j)%Z -> (i = ((q * j)%Z + r)%Z) ->
  ((0%Z <= r)%Z /\ (r < j)%Z) -> (r = (int.EuclideanDivision.mod1 i j)).

Axiom unicity_div_gen :
  forall (j:Z) (q:Z), (0%Z <= q)%Z -> (0%Z < j)%Z -> forall (i:Z),
  (0%Z <= i)%Z ->
  ((0%Z <= (i - (q * j)%Z)%Z)%Z /\ ((i - (q * j)%Z)%Z < j)%Z) ->
  (q = (int.EuclideanDivision.div i j)).

Axiom unicity_div_gen1 :
  forall (j:Z) (q:Z), (0%Z <= q)%Z -> (0%Z < j)%Z -> forall (i:Z),
  (0%Z <= i)%Z ->
  ((0%Z <= (i - (q * j)%Z)%Z)%Z /\ ((i - (q * j)%Z)%Z < j)%Z) ->
  ((i - (j * q)%Z)%Z = (int.EuclideanDivision.mod1 i j)).

Axiom bound_mod :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  (0%Z <= (int.EuclideanDivision.mod1 i j))%Z.

Axiom bound_mod1 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1 i j) < j)%Z.

Axiom mod_eq :
  forall (a:Z) (b:Z) (d:Z), (a = b) ->
  ((int.EuclideanDivision.mod1 a d) = (int.EuclideanDivision.mod1 b d)).

Axiom e_div_eq :
  forall (a:Z) (b:Z) (d:Z), (a = b) ->
  ((int.EuclideanDivision.div a d) = (int.EuclideanDivision.div b d)).

Axiom decomp :
  forall (i:Z) (j:Z), ~ (0%Z = j) ->
  (i =
   ((j * (int.EuclideanDivision.div i j))%Z +
    (int.EuclideanDivision.mod1 i j))%Z).

Axiom div_mod_eq :
  forall (i:Z) (j:Z) (q:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> (0%Z < q)%Z ->
  ((int.EuclideanDivision.div i q) = (int.EuclideanDivision.div j q)) ->
  ((int.EuclideanDivision.mod1 i q) = (int.EuclideanDivision.mod1 j q)) ->
  (i = j).

Axiom mod_zero :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1 i j) = 0%Z) ->
  (i = (j * (int.EuclideanDivision.div i j))%Z).

Axiom div_plus_quotient :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((int.EuclideanDivision.div (i + j)%Z j) =
   ((int.EuclideanDivision.div i j) + 1%Z)%Z).

Axiom div_plus_fact_gen_div :
  forall (i:Z) (j:Z) (k:Z), (0%Z < j)%Z ->
  ((int.EuclideanDivision.div (i + (k * j)%Z)%Z j) =
   ((int.EuclideanDivision.div i j) + k)%Z).

Axiom mod_plus_fact_gen_mod :
  forall (i:Z) (j:Z) (k:Z), (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1 ((k * j)%Z + i)%Z j) =
   (int.EuclideanDivision.mod1 i j)).

Axiom bound_div :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z ->
  (i < (f * q)%Z)%Z -> (0%Z <= (int.EuclideanDivision.div i q))%Z.

Axiom bound_div1 :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z ->
  (i < (f * q)%Z)%Z -> (0%Z <= ((int.EuclideanDivision.div i q) * q)%Z)%Z.

Axiom bound_div2 :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z ->
  (i < (f * q)%Z)%Z -> (((int.EuclideanDivision.div i q) * q)%Z <= i)%Z.

Axiom bound_div3 :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z ->
  (i < (f * q)%Z)%Z ->
  (i < (q * ((int.EuclideanDivision.div i q) + 1%Z)%Z)%Z)%Z.

Axiom bound_div4 :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z <= q)%Z -> (0%Z <= f)%Z ->
  (i < (f * q)%Z)%Z -> ((int.EuclideanDivision.div i q) < f)%Z.

Axiom bound_div_gen :
  forall (q:Z) (f:Z), (0%Z <= q)%Z -> (0%Z <= f)%Z -> forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (q * f)%Z)%Z) ->
  ((int.EuclideanDivision.div i q) < f)%Z.

Axiom mod_invariant :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < q)%Z -> (0%Z < f)%Z ->
  ((int.EuclideanDivision.mod1
    ((q * (f * (int.EuclideanDivision.div i (q * f)%Z))%Z)%Z +
     (int.EuclideanDivision.mod1 i (q * f)%Z))%Z
    q)
   = (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (q * f)%Z) q)).

Axiom mod_mod_left :
  forall (i:Z) (j:Z) (f:Z), (0%Z < j)%Z -> (0%Z < f)%Z ->
  ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (f * j)%Z) j) =
   (int.EuclideanDivision.mod1 i j)).

Axiom mod_mod_i :
  forall (i:Z) (j:Z), (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i j) j) =
   (int.EuclideanDivision.mod1 i j)).

Axiom binary_prod :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1
    ((int.EuclideanDivision.mod1 i 2%Z) *
     (int.EuclideanDivision.mod1 j 2%Z))%Z
    2%Z)
   = (int.EuclideanDivision.mod1 (i * j)%Z 2%Z)).

Axiom add_mod :
  forall (a:Z) (b:Z) (c:Z), (0%Z < c)%Z ->
  ((int.EuclideanDivision.mod1
    ((int.EuclideanDivision.mod1 a c) + (int.EuclideanDivision.mod1 b c))%Z
    c)
   = (int.EuclideanDivision.mod1 (a + b)%Z c)).

Axiom mod_mod_right :
  forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z ->
  ((int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j * f)%Z) j) =
   (int.EuclideanDivision.mod1 i j)).

Axiom mod_mod_rev :
  forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z ->
  ((int.EuclideanDivision.mod1 i j) =
   (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j * f)%Z) j)).

Axiom mod_mod_rev1 :
  forall (i:Z) (j:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < f)%Z ->
  ((int.EuclideanDivision.mod1 i j) =
   (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (f * j)%Z) j)).

Axiom mod_mod_plus :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((int.EuclideanDivision.mod1 i j) =
   (int.EuclideanDivision.mod1 (int.EuclideanDivision.mod1 i (j + j)%Z) j)).

Axiom mult_assoc1 :
  forall (i:Z) (q:Z) (f:Z), (0%Z <= i)%Z -> (0%Z < q)%Z -> (0%Z < f)%Z ->
  ((q * (f * (int.EuclideanDivision.div i (q * f)%Z))%Z)%Z =
   ((q * f)%Z * (int.EuclideanDivision.div i (q * f)%Z))%Z).

Axiom div_div1 :
  forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z ->
  ((int.EuclideanDivision.div (int.EuclideanDivision.div i k) j) =
   (int.EuclideanDivision.div i (k * j)%Z)).

Axiom div_div2 :
  forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z ->
  ((int.EuclideanDivision.div (int.EuclideanDivision.div i k) j) =
   (int.EuclideanDivision.div i (j * k)%Z)).

Axiom mod_div :
  forall (i:Z) (j:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (0%Z < k)%Z ->
  ((int.EuclideanDivision.div (int.EuclideanDivision.mod1 i (j * k)%Z) j) =
   (int.EuclideanDivision.mod1 (int.EuclideanDivision.div i j) k)).

Axiom inf_mul :
  forall (ia:Z) (ib:Z) (a:Z) (b:Z), ((0%Z <= ia)%Z /\ (ia < a)%Z) ->
  ((0%Z <= ib)%Z /\ (ib < b)%Z) -> (((a * ib)%Z + ia)%Z < (a * b)%Z)%Z.

Axiom inf_mul1 :
  forall (ia:Z) (ib:Z) (a:Z) (b:Z), ((0%Z <= ia)%Z /\ (ia < a)%Z) ->
  ((0%Z <= ib)%Z /\ (ib < b)%Z) -> (((ib * a)%Z + ia)%Z < (b * a)%Z)%Z.

Axiom inf_mul_gen :
  forall (n:Z) (v:Z) (p:Z), ((0%Z <= p)%Z /\ (p < v)%Z) -> forall (k:Z),
  ((0%Z <= k)%Z /\ (k < n)%Z) -> (((k * v)%Z + p)%Z < (n * v)%Z)%Z.

Axiom inf_mul_gen_b :
  forall (n:Z) (v:Z) (p:Z), ((0%Z <= p)%Z /\ (p < n)%Z) -> forall (k:Z),
  ((0%Z <= k)%Z /\ (k < v)%Z) -> (((p * v)%Z + k)%Z < (n * v)%Z)%Z.

Axiom inf_mul_comm :
  forall (i:Z) (bi:Z) (quot:Z) (rest:Z), ((0%Z <= i)%Z /\ (i < bi)%Z) ->
  (0%Z < rest)%Z -> (0%Z < quot)%Z -> (bi = (quot * rest)%Z) ->
  ((int.EuclideanDivision.mod1 i rest) < rest)%Z.

Parameter result4:
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool.

Axiom result_def4 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (t1:a -> im1) (e:a),
  (((result4 op1 t1) e) = true) <-> ~ (neutral op1 (t1 e)).

(* Why3 assumption *)
Definition nonn_part1 {a:Type} {a_WT:WhyType a}
    {im1:Type} {im1_WT:WhyType im1} (op1:im1 -> im1 -> im1) (s:set a)
    (t1:a -> im1) : set a :=
  filter (result4 op1 t1) s.

Axiom nonn_part_spec3 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (nonn_part1 op1 s t1)) -> mem e s.

Axiom nonn_part_spec4 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (nonn_part1 op1 s t1)) -> ~ (neutral op1 (t1 e)).

Axiom nonn_part_spec5 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  ((mem e s) /\ ~ (neutral op1 (t1 e))) -> mem e (nonn_part1 op1 s t1).

Parameter result5:
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  (im1 -> im1 -> im1) -> (a -> im1) -> a -> bool.

Axiom result_def5 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (t1:a -> im1) (e:a),
  (((result5 op1 t1) e) = true) <-> (neutral op1 (t1 e)).

(* Why3 assumption *)
Definition n_part1 {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1}
    (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1) : set a :=
  filter (result5 op1 t1) s.

Axiom n_part_spec3 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (n_part1 op1 s t1)) -> mem e s.

Axiom n_part_spec4 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  (mem e (n_part1 op1 s t1)) -> neutral op1 (t1 e).

Axiom n_part_spec5 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), forall (e:a),
  ((mem e s) /\ (neutral op1 (t1 e))) -> mem e (n_part1 op1 s t1).

Axiom nullity_partition2 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (commut op1) ->
  (s = (union (nonn_part1 op1 s t1) (n_part1 op1 s t1))).

Axiom nullity_partition3 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (commut op1) ->
  ((inter (nonn_part1 op1 s t1) (n_part1 op1 s t1)) = (empty : set a)).

Axiom iterate_neutral1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (iterable op1) ->
  (commut op1) ->
  (forall (a1:a), (mem a1 s) -> ((t1 a1) = (neutral_elt op1))) ->
  ((iterate op1 s t1) = (neutral_elt op1)).

Axiom iterate_nullity_partition1 :
  forall {a:Type} {a_WT:WhyType a} {im1:Type} {im1_WT:WhyType im1},
  forall (op1:im1 -> im1 -> im1) (s:set a) (t1:a -> im1), (iterable op1) ->
  (commut op1) ->
  ((iterate op1 s t1) = (iterate op1 (nonn_part1 op1 s t1) t1)).

Parameter indic: forall {a:Type} {a_WT:WhyType a}, a -> a -> t.

Axiom indic_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (a':a),
  ((a1 = a') -> ((indic a1 a') = tone)) /\
  (~ (a1 = a') -> ((indic a1 a') = tzero)).

Axiom get_indic :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (a':a),
  ((a1 = a') -> ((indic a1 a') = tone)) /\
  (~ (a1 = a') -> ((indic a1 a') = tzero)).

Parameter indic_bool: forall {a:Type} {a_WT:WhyType a}, a -> a -> bool.

Axiom indic_bool_spec :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (a':a),
  ((a1 = a') -> ((indic_bool a1 a') = true)) /\
  (~ (a1 = a') -> ((indic_bool a1 a') = false)).

Axiom indic_comm :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (a':a), ((indic a1 a') = (indic a' a1)).

Axiom indic_transl_r :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (b:a) (c:a), (b = c) -> ((indic a1 b) = (indic a1 c)).

Axiom indic_transl_l :
  forall {a:Type} {a_WT:WhyType a},
  forall (a1:a) (b:a) (c:a), (b = c) -> ((indic b a1) = (indic c a1)).

Parameter indic_2:
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b}, a -> a -> b ->
  b -> t.

Axiom indic_2_def :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((((indic_bool a1 a') = true) /\ ((indic_bool b1 b') = true)) ->
   ((indic_2 a1 a' b1 b') = tone)) /\
  (~ (((indic_bool a1 a') = true) /\ ((indic_bool b1 b') = true)) ->
   ((indic_2 a1 a' b1 b') = tzero)).

Axiom indic_2_spec :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((indic_2 a1 a' b1 b') = (infix_asdt (indic a1 a') (indic b1 b'))).

Axiom indic_2_spec1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((indic_2 a1 a' b1 b') = (indic (a1, b1) (a', b'))).

Axiom indic_2_comm :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((indic_2 a1 a' b1 b') = (indic_2 a' a1 b1 b')).

Axiom indic_2_comm1 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((indic_2 a1 a' b1 b') = (indic_2 a1 a' b' b1)).

Axiom indic_2_comm2 :
  forall {a:Type} {a_WT:WhyType a} {b:Type} {b_WT:WhyType b},
  forall (a1:a) (a':a) (b1:b) (b':b),
  ((indic_2 a1 a' b1 b') = (indic_2 a' a1 b' b1)).

(* Why3 assumption *)
Definition sum_indic {a:Type} {a_WT:WhyType a} (s:set a) (t1:a -> t)
    (i:a) : t :=
  sum s (fun (e:a) => (infix_asdt (t1 e) (indic i e))).

Parameter ind_sum_indic: (Z -> t) -> Z -> Z -> Z -> t.

Axiom ind_sum_indic_def :
  forall (t1:Z -> t) (l:Z) (h:Z) (i:Z), (l < h)%Z ->
  ((ind_sum_indic t1 l h i) =
   (ind_sum (fun (e:Z) => (infix_asdt (t1 e) (indic i e))) l h)).

Axiom ind_sum_indic_spec :
  forall (t1:Z -> t) (l:Z) (h:Z) (i:Z), (l < h)%Z ->
  ((ind_sum_indic t1 l h i) = (sum_indic (to_fset l h) t1 i)).

Axiom sum_indic_t :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (i:a), (mem i s) ->
  ((sum_indic s t1 i) = (t1 i)).

Axiom sum_indic_ts :
  forall {a:Type} {a_WT:WhyType a},
  forall (s:set a) (t1:a -> t) (i:a), (mem i s) ->
  ((sum s (fun (e:a) => (infix_asdt (t1 e) (indic i e)))) = (t1 i)).

Axiom ind_sum_indic_t :
  forall (t1:Z -> t) (l:Z) (h:Z) (i:Z), ((l <= i)%Z /\ (i < h)%Z) ->
  ((ind_sum_indic t1 l h i) = (t1 i)).

Axiom ind_sum_indic_t1 :
  forall (t1:Z -> t) (l:Z) (h:Z) (i:Z), ((l <= i)%Z /\ (i < h)%Z) ->
  ((ind_sum (fun (e:Z) => (infix_asdt (t1 e) (indic i e))) l h) = (t1 i)).

Axiom ind_sum_indic_t_quant :
  forall (t1:Z -> t) (l:Z) (h:Z), forall (i:Z), ((l <= i)%Z /\ (i < h)%Z) ->
  ((ind_sum (fun (e:Z) => (infix_asdt (t1 e) (indic i e))) l h) = (t1 i)).

Axiom indic_div_mod :
  forall (i:Z) (j:Z) (q:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z -> (0%Z < q)%Z ->
  ((indic i j) =
   (infix_asdt
    (indic (int.EuclideanDivision.mod1 i q) (int.EuclideanDivision.mod1 j q))
    (indic (int.EuclideanDivision.div i q) (int.EuclideanDivision.div j q)))).

Axiom indic_div_mod_gen :
  forall (q:Z), (0%Z < q)%Z -> forall (i:Z) (j:Z),
  ((0%Z <= i)%Z /\ (0%Z <= j)%Z) ->
  ((indic i j) =
   (infix_asdt
    (indic (int.EuclideanDivision.mod1 i q) (int.EuclideanDivision.mod1 j q))
    (indic (int.EuclideanDivision.div i q) (int.EuclideanDivision.div j q)))).

Axiom set_inf : True.

Axiom set_infeq : True.

Axiom bounded_cycle :
  forall (a:Z) (b:Z) (c:Z) (d:Z), (0%Z <= a)%Z -> (0%Z < b)%Z ->
  ((0%Z <= d)%Z /\ (d < b)%Z) -> (0%Z < c)%Z ->
  ((int.EuclideanDivision.div ((a * b)%Z + d)%Z (b * c)%Z) =
   (int.EuclideanDivision.div a c)).

Parameter exp: t -> t.

Axiom e_diff_tzero : forall (x:t), ~ ((exp x) = tzero).

Axiom Exp_one : real_ (exp tone).

Axiom Exp_zero : ((exp tzero) = tone).

Axiom Exp_sum :
  forall (x:t) (y:t), ((exp (infix_pldt x y)) = (infix_asdt (exp x) (exp y))).

Axiom exp_one : real_ (exp tone).

Axiom exp_sum :
  forall (x:t) (y:t), ((exp (infix_pldt x y)) = (infix_asdt (exp x) (exp y))).

Axiom exp_eq : forall (t1:t) (t2:t), (t1 = t2) -> ((exp t1) = (exp t2)).

Axiom exp_sum_rev :
  forall (x:t) (y:t), ((infix_asdt (exp x) (exp y)) = (exp (infix_pldt x y))).

Axiom exp_inv :
  forall (i:t), ~ ((exp i) = tzero) ->
  ((exp (prefix_mndt i)) = (infix_sldt tone (exp i))).

Axiom exp_inv_rev :
  forall (i:t), ~ ((exp i) = tzero) ->
  ((infix_sldt tone (exp i)) = (exp (prefix_mndt i))).

Axiom exp_mult_pre :
  forall (x:t) (y:Z), (0%Z <= y)%Z ->
  ((exp (infix_asdt x (i_to_t y))) = (cpower (exp x) y)).

Axiom exp_mult :
  forall (x:t) (y:Z), ((exp (infix_asdt x (i_to_t y))) = (cpower (exp x) y)).

Axiom cpower_to_exp :
  forall (x:t) (y:Z), ((cpower (exp x) y) = (exp (infix_asdt x (i_to_t y)))).

Axiom Exp_quarter_pi :
  ((exp (infix_sldt (infix_asdt im pi) (i_to_t 4%Z))) =
   (infix_pldt (infix_sldt squarert_two (infix_pldt tone tone))
    (infix_asdt im (infix_sldt squarert_two (infix_pldt tone tone))))).

Axiom exp_h_pi :
  ((exp (infix_sldt (infix_asdt im pi) (infix_pldt tone tone))) = im).

Axiom exp_pi : ((exp (infix_asdt im pi)) = (prefix_mndt tone)).

Axiom exp_two_pi :
  ((exp (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))) = tone).

Axiom exp_two_pi_mul :
  forall (k:Z),
  ((exp
    (infix_asdt (i_to_t k)
     (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))))
   = tone).

Axiom exp_two_pi_mul_den :
  forall (k:Z) (l:Z), ~ (k = 0%Z) ->
  ((exp
    (infix_sldt
     (infix_asdt (i_to_t (k * l)%Z)
      (infix_asdt (infix_asdt im pi) (infix_pldt tone tone)))
     (i_to_t k)))
   = tone).

Axiom exp_two_pi_mul_den_add :
  forall (k:Z) (l:Z) (m:Z),
  ((exp
    (infix_asdt (i_to_t ((k * m)%Z + l)%Z)
     (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))))
   =
   (exp
    (infix_asdt (i_to_t l)
     (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))))).

Axiom comp_exp_cpower :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z ->
  ((cpower (exp (i_to_t i)) j) = (cpower (exp tone) (i * j)%Z)).

Axiom comp_exp_cpower1 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z <= j)%Z ->
  ((cpower (exp (i_to_t i)) j) = (exp (i_to_t (i * j)%Z))).

Parameter unity_rt: Z -> t.

Axiom unity_rt_def :
  forall (n:Z), (0%Z < n)%Z ->
  ((unity_rt n) =
   (exp
    (infix_sldt (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))
     (i_to_t n)))).

Axiom unity_rt_spec :
  forall (n:Z), (0%Z < n)%Z -> ((cpower (unity_rt n) n) = tone).

Axiom unity_rt_spec1 : forall (n:Z), (0%Z < n)%Z -> ~ ((unity_rt n) = tzero).

Axiom exp_mod :
  forall (k:Z) (n:Z), (0%Z < n)%Z ->
  ((exp
    (infix_sldt
     (infix_asdt (i_to_t k)
      (infix_asdt (infix_asdt im pi) (infix_pldt tone tone)))
     (i_to_t n)))
   =
   (exp
    (infix_sldt
     (infix_asdt (i_to_t (int.EuclideanDivision.mod1 k n))
      (infix_asdt (infix_asdt im pi) (infix_pldt tone tone)))
     (i_to_t n)))).

Parameter p_unity: Z -> Z -> t.

Axiom p_unity_def :
  forall (n:Z) (k:Z), (0%Z < n)%Z ->
  ((p_unity n k) = (cpower (unity_rt n) k)).

Axiom p_unity_mod :
  forall (n:Z) (k:Z), (0%Z < n)%Z ->
  ((p_unity n k) = (p_unity n (int.EuclideanDivision.mod1 k n))).

Axiom cpower_mod :
  forall (n:Z) (k:Z), (0%Z < n)%Z ->
  ((cpower (unity_rt n) k) =
   (cpower (unity_rt n) (int.EuclideanDivision.mod1 k n))).

Axiom p_unity_sum :
  forall (n:Z) (k:Z) (k':Z), (0%Z < n)%Z ->
  ((p_unity n (k + k')%Z) = (infix_asdt (p_unity n k) (p_unity n k'))).

Axiom exp_p_unity :
  forall (n:Z) (k:Z), (0%Z < n)%Z ->
  ((p_unity n k) =
   (exp
    (infix_sldt
     (infix_asdt (i_to_t (int.EuclideanDivision.mod1 k n))
      (infix_asdt (infix_asdt im pi) (infix_pldt tone tone)))
     (i_to_t n)))).

Axiom unity_rt_trans :
  forall (n:Z) (k:Z), (0%Z < n)%Z -> (0%Z < k)%Z ->
  ((unity_rt n) = (cpower (unity_rt (n * k)%Z) k)).

Axiom unity_rt_two : ((unity_rt 2%Z) = (prefix_mndt tone)).

Axiom p_unity_neut :
  forall (n:Z) (k:Z), (0%Z < n)%Z -> (0%Z <= k)%Z ->
  ((p_unity n (n * k)%Z) = tone).

Parameter omega: Z -> t.

Axiom omega_def :
  forall (n:Z), (0%Z <= n)%Z -> ((omega n) = (unity_rt (power 2%Z n))).

Parameter p_omega: Z -> Z -> t.

Axiom p_omega_def :
  forall (n:Z) (k:Z), (0%Z <= n)%Z -> ((p_omega n k) = (cpower (omega n) k)).

Axiom p_omega_spec :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) = (p_unity (power 2%Z n) k)).

Axiom p_omega_to_omega :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) =
   (cpower (omega n) (int.EuclideanDivision.mod1 k (power 2%Z n)))).

Axiom p_omega_eq :
  forall (n:Z) (k:Z) (k':Z), (0%Z <= n)%Z -> (k = k') ->
  ((p_omega n k) = (p_omega n k')).

Axiom p_omega_eq_gen :
  forall (n:Z) (n':Z) (k:Z) (k':Z), (0%Z <= n)%Z -> (k = k') -> (n = n') ->
  ((p_omega n k) = (p_omega n' k')).

Axiom p_omega_unity :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) = (p_unity (power 2%Z n) k)).

Axiom p_unity_omega :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_unity (power 2%Z n) k) = (p_omega n k)).

Axiom exp_omega :
  forall (n:Z), (0%Z <= n)%Z ->
  ((omega n) =
   (exp
    (infix_sldt (infix_asdt (infix_asdt im pi) (infix_pldt tone tone))
     (i_to_t (power 2%Z n))))).

Axiom exp_p_omega :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) =
   (exp
    (infix_sldt
     (infix_asdt (i_to_t k)
      (infix_asdt (infix_asdt im pi) (infix_pldt tone tone)))
     (i_to_t (power 2%Z n))))).

Axiom p_omega_sum :
  forall (n:Z) (k:Z) (k':Z), (0%Z <= n)%Z ->
  ((p_omega n (k + k')%Z) = (infix_asdt (p_omega n k) (p_omega n k'))).

Axiom p_omega_sum_rev :
  forall (n:Z) (k:Z) (k':Z), (0%Z <= n)%Z ->
  ((infix_asdt (p_omega n k) (p_omega n k')) = (p_omega n (k + k')%Z)).

Axiom p_omega_sum_gen :
  forall (n:Z) (n':Z) (k:Z) (k':Z), (0%Z <= n)%Z -> (n = n') ->
  ((p_omega n (k + k')%Z) = (infix_asdt (p_omega n k) (p_omega n' k'))).

Axiom p_omega_sum_rev_gen :
  forall (n:Z) (n':Z) (k:Z) (k':Z), (0%Z <= n)%Z -> (n = n') ->
  ((infix_asdt (p_omega n k) (p_omega n' k')) = (p_omega n (k + k')%Z)).

Axiom p_omega_neut :
  forall (n:Z) (k:Z), (0%Z <= n)%Z -> (0%Z <= k)%Z ->
  ((p_omega n ((power 2%Z n) * k)%Z) = tone).

Axiom p_omega_neut_one :
  forall (n:Z) (k:Z), (0%Z <= n)%Z -> (0%Z <= k)%Z ->
  ((p_omega n (power 2%Z n)) = tone).

Axiom p_omega_mod :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) = (p_omega n (int.EuclideanDivision.mod1 k (power 2%Z n)))).

Axiom p_omega_mod_rest :
  forall (n:Z) (k:Z) (i:Z), (0%Z <= n)%Z ->
  ((p_omega n ((k * (power 2%Z n))%Z + i)%Z) = (p_omega n i)).

Axiom omega_transl :
  forall (n:Z) (n':Z), (0%Z <= n)%Z -> (0%Z <= n')%Z -> (n <= n')%Z ->
  ((omega n) = (p_omega n' (power 2%Z (n' - n)%Z))).

Axiom p_omega_transl :
  forall (n:Z) (n':Z) (k:Z), (0%Z <= n)%Z -> (0%Z <= n')%Z -> (n <= n')%Z ->
  ((p_omega n k) = (p_omega n' (k * (power 2%Z (n' - n)%Z))%Z)).

Axiom p_omega_plus_one :
  forall (n:Z) (k:Z), (0%Z <= n)%Z ->
  ((p_omega n k) = (p_omega (n + 1%Z)%Z (k * 2%Z)%Z)).

Axiom p_omega_minus_one :
  forall (n:Z) (k:Z), (0%Z < n)%Z ->
  ((p_omega n k) = (p_omega (n + 1%Z)%Z (k * 2%Z)%Z)).

Axiom p_omega_rt_two :
  forall (n:Z), (0%Z < n)%Z ->
  ((p_omega n (power 2%Z (n - 1%Z)%Z)) = (prefix_mndt tone)).

Axiom p_omega_sum_units :
  forall (n:Z) (n':Z), (0%Z <= n)%Z -> (0%Z <= n')%Z -> (n <= n')%Z ->
  ((infix_asdt (omega n) (omega n')) =
   (p_omega n' (1%Z + (power 2%Z (n' - n)%Z))%Z)).

Axiom p_omega_add_ord :
  forall (n:Z) (k:Z) (n':Z) (k':Z), ((n <= n')%Z /\ (0%Z <= n)%Z) ->
  ((infix_asdt (p_omega n k) (p_omega n' k')) =
   (p_omega n' (k' + (k * (power 2%Z (n' - n)%Z))%Z)%Z)).

Axiom p_omega_add :
  forall (n:Z) (k:Z) (n':Z) (k':Z), (0%Z <= n)%Z -> (0%Z <= n')%Z ->
  ((n' <= n)%Z ->
   ((infix_asdt (p_omega n k) (p_omega n' k')) =
    (p_omega n (k + (k' * (power 2%Z (n - n')%Z))%Z)%Z))) /\
  (~ (n' <= n)%Z ->
   ((infix_asdt (p_omega n k) (p_omega n' k')) =
    (p_omega n' (k' + (k * (power 2%Z (n' - n)%Z))%Z)%Z))).

Axiom p_omega_equiv :
  forall (n:Z) (k:Z) (a:Z), (0%Z <= n)%Z ->
  ((p_omega n k) = (p_omega n (k + (a * (power 2%Z n))%Z)%Z)).

Axiom p_omega_equiv_rev :
  forall (n:Z) (k:Z) (a:Z), (0%Z <= n)%Z ->
  ((p_omega n (k + ((power 2%Z n) * a)%Z)%Z) = (p_omega n k)).

Axiom omega_sum_to_prod :
  forall {a:Type} {a_WT:WhyType a},
  forall (n:Z) (f:a -> Z) (s:set a), (0%Z <= n)%Z ->
  ((p_omega n (isum s f)) = (product s (fun (k:a) => (p_omega n (f k))))).

Parameter fc5: Z -> (Z -> Z) -> Z -> Z -> Z -> t.

Axiom fc_def5 :
  forall (n:Z) (f:Z -> Z) (i:Z) (j:Z) (k:Z),
  (((i <= k)%Z /\ (k < j)%Z) -> (((fc5 n f i j) k) = (p_omega n (f k)))) /\
  (~ ((i <= k)%Z /\ (k < j)%Z) -> (((fc5 n f i j) k) = tone)).

Axiom omega_ind_sum_to_prod :
  forall (n:Z) (f:Z -> Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (0%Z <= n)%Z ->
  ((p_omega n (ind_isum f i j)) = (ind_product (fc5 n f i j) i j)).

Parameter cos: t -> t.

Axiom cos_spec : forall (x:t), (real_ x) -> real_ (cos x).

Axiom cos_spec1 :
  forall (x:t), (real_ x) -> infix_lseqdt (prefix_mndt tone) (cos x).

Axiom cos_spec2 : forall (x:t), (real_ x) -> infix_lseqdt (cos x) tone.

Parameter sin: t -> t.

Axiom sin_spec : forall (x:t), (real_ x) -> real_ (sin x).

Axiom sin_spec1 :
  forall (x:t), (real_ x) -> infix_lseqdt (prefix_mndt tone) (sin x).

Axiom sin_spec2 : forall (x:t), (real_ x) -> infix_lseqdt (sin x) tone.

Axiom euler_real_r :
  forall (x:t), (real_ x) ->
  ((cos x) = (r_to_t (real_part (exp (infix_asdt im x))))).

Axiom euler_im_r :
  forall (x:t), (real_ x) ->
  ((sin x) = (r_to_t (im_part (exp (infix_asdt im x))))).

Axiom cos_zero : ((cos tzero) = tone).

Axiom cos_half_pi : ((cos (infix_sldt pi (infix_pldt tone tone))) = tzero).

Axiom cos_quarter_pi :
  ((cos (infix_sldt pi (i_to_t 4%Z))) =
   (infix_sldt squarert_two (infix_pldt tone tone))).

Axiom cos_pi : ((cos pi) = (prefix_mndt tone)).

Axiom euler_real :
  forall (x:t), (real_ x) ->
  ((cos x) = (t_real_part (exp (infix_asdt im x)))).

Axiom euler_im :
  forall (x:t), (real_ x) -> ((sin x) = (t_im_part (exp (infix_asdt im x)))).

Axiom d_frac : Type.
Parameter d_frac_WhyType : WhyType d_frac.
Existing Instance d_frac_WhyType.

Parameter value: d_frac -> t.

Axiom d_frac'invariant : forall (self:d_frac), ~ ((value self) = tzero).

Axiom equal_d_frac :
  forall (d:d_frac) (d':d_frac), (d = d') -> ((value d) = (value d')).

Axiom equal_d_frac1 :
  forall (d:d_frac) (d':d_frac), ((value d) = (value d')) -> (d = d').

Parameter dyadic: Z -> Z -> d_frac.

Axiom dyadic_spec :
  forall (k:Z) (n:Z), (0%Z <= n)%Z -> ((value (dyadic k n)) = (p_omega n k)).

Parameter add1: d_frac -> d_frac -> d_frac.

Axiom add_spec3 :
  forall (d:d_frac) (d':d_frac),
  ((value (add1 d d')) = (infix_asdt (value d) (value d'))).

Parameter inv1: d_frac -> d_frac.

Axiom inv_spec :
  forall (d:d_frac), ((value (inv1 d)) = (infix_sldt tone (value d))).

Parameter div_two: d_frac -> d_frac.

Axiom div_two_spec :
  forall (d:d_frac), ((cpower (value (div_two d)) 2%Z) = (value d)).

Axiom div_two_spec1 :
  forall (d:d_frac), forall (k:Z) (n:Z),
  ((0%Z <= k)%Z /\ (k < (power 2%Z n))%Z) -> (0%Z <= n)%Z ->
  (d = (dyadic k n)) -> ((div_two d) = (dyadic k (n + 1%Z)%Z)).

Axiom value_zero : ((value (dyadic 0%Z 0%Z)) = tone).

Parameter d_mult_int: d_frac -> Z -> d_frac.

Axiom d_mult_int_spec :
  forall (d:d_frac) (i:Z), ((value (d_mult_int d i)) = (cpower (value d) i)).

Parameter phase_inv_pre: Z -> d_frac -> d_frac.

Axiom phase_inv_pre_def :
  forall (i:Z) (d:d_frac), (0%Z <= i)%Z -> (i = 0%Z) ->
  ((phase_inv_pre i d) = d).

Axiom phase_inv_pre_def1 :
  forall (i:Z) (d:d_frac), (0%Z <= i)%Z -> ~ (i = 0%Z) ->
  ((phase_inv_pre i d) = (inv1 (phase_inv_pre (i - 1%Z)%Z d))).

Axiom phase_inv_pre_spec :
  forall (i:Z) (d:d_frac), (0%Z <= i)%Z ->
  ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((phase_inv_pre i d) = d).

Axiom phase_inv_pre_spec1 :
  forall (i:Z) (d:d_frac), (0%Z <= i)%Z ->
  ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) ->
  ((phase_inv_pre i d) = (inv1 d)).

Axiom phase_inv_pre_spec2 :
  forall (i:Z) (d:d_frac), (0%Z <= i)%Z -> forall (k:Z) (n:Z),
  (0%Z <= n)%Z -> (d = (dyadic k n)) ->
  ((phase_inv_pre i d) = (dyadic ((power (-1%Z)%Z i) * k)%Z n)).

Parameter phase_inv: Z -> d_frac -> d_frac.

Axiom phase_inv_def :
  forall (i:Z) (d:d_frac),
  ((0%Z <= i)%Z -> ((phase_inv i d) = (phase_inv_pre i d))) /\
  (~ (0%Z <= i)%Z -> ((phase_inv i d) = (phase_inv_pre (-i)%Z d))).

Axiom phase_inv_spec :
  forall (i:Z) (d:d_frac), ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) ->
  ((phase_inv i d) = d).

Axiom phase_inv_spec1 :
  forall (i:Z) (d:d_frac), ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) ->
  ((phase_inv i d) = (inv1 d)).

Axiom phase_inv_spec2 :
  forall (i:Z) (d:d_frac), forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  (0%Z <= i)%Z -> (d = (dyadic k n)) ->
  ((phase_inv i d) = (dyadic ((power (-1%Z)%Z i) * k)%Z n)).

Axiom phase_inv_spec3 :
  forall (i:Z) (d:d_frac), forall (k:Z) (n:Z), (0%Z <= n)%Z -> (i < 0%Z)%Z ->
  (d = (dyadic k n)) ->
  ((phase_inv i d) = (dyadic ((power (-1%Z)%Z (-i)%Z) * k)%Z n)).

(* Why3 assumption *)
Definition k_dyadic (i:Z) : d_frac := dyadic 1%Z (ZArith.BinInt.Z.abs i).

Axiom k_dyadic_spec :
  forall (i:Z), (0%Z <= i)%Z -> ((k_dyadic i) = (dyadic 1%Z i)).

Parameter d_sum: (Z -> d_frac) -> Z -> Z -> d_frac.

Axiom d_sum_def :
  forall (f:Z -> d_frac) (i:Z) (j:Z),
  ((j <= i)%Z -> ((d_sum f i j) = (dyadic 0%Z 0%Z))) /\
  (~ (j <= i)%Z ->
   ((d_sum f i j) =
    (int_iterate (fun (y0:d_frac) (y1:d_frac) => (add1 y0 y1)) f i j))).

Axiom power_minus_one2 :
  forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) ->
  ((power (-1%Z)%Z i) = 1%Z).

Axiom power_minus_one3 :
  forall (i:Z), (0%Z <= i)%Z -> ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) ->
  ((power (-1%Z)%Z i) = (-1%Z)%Z).

Parameter kth_right: Z -> Z -> Z -> (Z -> Z) -> Z.

Axiom kth_right_def :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) ->
  ((kth_right i k h f) =
   (int.EuclideanDivision.mod1
    (int.EuclideanDivision.div i (ind_iproduct f ((h - k)%Z + 1%Z)%Z h))
    (f (h - k)%Z))).

Axiom kth_right_spec :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) ->
  (0%Z <= (kth_right i k h f))%Z.

Axiom kth_right_spec1 :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l < h)%Z) -> (0%Z < (f l))%Z) ->
  ((kth_right i k h f) < (f (h - k)%Z))%Z.

Axiom kth_right_eq :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z) (g:Z -> Z), (0%Z <= i)%Z ->
  (1%Z <= k)%Z ->
  (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l <= h)%Z) -> (0%Z < (f l))%Z) ->
  (forall (l:Z), (((h - k)%Z <= l)%Z /\ (l <= h)%Z) -> ((f l) = (g l))) ->
  ((kth_right i k h f) = (kth_right i k h g)).

Axiom kth_right_trans :
  forall (i:Z) (k:Z) (h:Z) (t1:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (l:Z), (0%Z < (f l))%Z) -> (0%Z <= h)%Z -> (0%Z <= t1)%Z ->
  ((kth_right (int.EuclideanDivision.div i (ind_iproduct f h (h + t1)%Z)) k h
    f)
   = (kth_right i (k + t1)%Z (h + t1)%Z f)).

Parameter kth_left: Z -> Z -> Z -> Z -> (Z -> Z) -> Z.

Axiom kth_left_def :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) ->
  ((kth_left i k l h f) = (kth_right i (((h - l)%Z - k)%Z + 1%Z)%Z h f)).

Axiom kth_left_spec :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) ->
  ((kth_left i k l h f) =
   (int.EuclideanDivision.mod1
    (int.EuclideanDivision.div i (ind_iproduct f (l + k)%Z h))
    (f ((l + k)%Z - 1%Z)%Z))).

Axiom kth_left_spec1 :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) ->
  (0%Z <= (kth_left i k l h f))%Z.

Axiom kth_left_spec2 :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) -> (0%Z < (f ind))%Z) ->
  ((kth_left i k l h f) < (f ((l + k)%Z - 1%Z)%Z))%Z.

Axiom kth_left_eq :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z) (g:Z -> Z), (0%Z <= i)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) -> (0%Z <= l)%Z ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind < h)%Z) ->
   ((f ind) = (g ind)) /\ (0%Z < (g ind))%Z) ->
  ((kth_left i k l h f) = (kth_left i k l h g)).

Axiom kth_left_to_mod_div :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind <= h)%Z) -> (0%Z < (f ind))%Z) ->
  ((kth_left i k l h f) =
   (int.EuclideanDivision.mod1
    (int.EuclideanDivision.div i (ind_iproduct f (l + k)%Z h))
    (f ((l + k)%Z - 1%Z)%Z))).

Axiom kth_left_trans :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (0%Z <= l)%Z ->
  ((1%Z <= k)%Z /\ (k < (h - l)%Z)%Z) ->
  (forall (ind:Z), ((l <= ind)%Z /\ (ind <= h)%Z) -> (0%Z < (f ind))%Z) ->
  ((kth_left i k l h f) =
   (kth_left (int.EuclideanDivision.div i (f (h - 1%Z)%Z)) k l (h - 1%Z)%Z f)).

Axiom div_isum_exponents :
  forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z ->
  (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  ((power k (n + m)%Z) = ((power k n) * (power k m))%Z).

Axiom div_isum_exponents1 :
  forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z ->
  (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  ((power k (n + 1%Z)%Z) = ((power k n) * k)%Z).

Axiom div_isum_exponents2 :
  forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z ->
  (0%Z <= n)%Z -> (0%Z <= m)%Z -> ((power k 1%Z) = k).

Axiom div_isum_exponents3 :
  forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z ->
  (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  ((int.EuclideanDivision.div (int.EuclideanDivision.div i (power k n))
    (power k m))
   = (int.EuclideanDivision.div i (power k (n + m)%Z))).

Axiom div_isum_exponents4 :
  forall (i:Z) (k:Z) (n:Z) (m:Z), (0%Z <= i)%Z -> (0%Z < k)%Z ->
  (0%Z <= n)%Z -> (0%Z <= m)%Z ->
  ((int.EuclideanDivision.div (int.EuclideanDivision.div i (power k n)) k) =
   (int.EuclideanDivision.div i (power k (n + 1%Z)%Z))).

Parameter divp: Z -> Z -> Z.

Axiom divp_def :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  ((divp i j) = ((int.EuclideanDivision.div i j) * j)%Z).

Axiom divp_spec :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  (i = ((divp i j) + (int.EuclideanDivision.mod1 i j))%Z).

Axiom divp_spec1 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> ((divp i j) <= i)%Z.

Axiom divp_spec2 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z ->
  (i < (((divp i j) + 1%Z)%Z * j)%Z)%Z.

Axiom divp_spec3 :
  forall (i:Z) (j:Z), (0%Z <= i)%Z -> (0%Z < j)%Z -> (j < i)%Z ->
  (0%Z < (divp i j))%Z.

Axiom kth_right_div_mod :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((kth_right i k h f) =
   (int.EuclideanDivision.div
    (int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h))
    (ind_iproduct f ((h - k)%Z + 1%Z)%Z h))).

Axiom kth_head :
  forall (i:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= h)%Z ->
  (forall (k:Z), (0%Z < (f k))%Z) ->
  ((kth_right i 1%Z h f) = (int.EuclideanDivision.mod1 i (f (h - 1%Z)%Z))).

Parameter weighted_kth_right: Z -> Z -> Z -> (Z -> Z) -> Z.

Axiom weighted_kth_right_def :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z ->
  (forall (k1:Z), (0%Z < (f k1))%Z) -> (1%Z <= k)%Z ->
  ((weighted_kth_right i k h f) =
   ((kth_right i k h f) * (ind_iproduct f ((h - k)%Z + 1%Z)%Z h))%Z).

Axiom weighted_kth_right_ :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (1%Z <= k)%Z -> (0%Z <= i)%Z ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h)) =
   ((weighted_kth_right i k h f) +
    (int.EuclideanDivision.mod1 i (ind_iproduct f ((h - k)%Z + 1%Z)%Z h)))%Z).

Axiom kth_right_decomposition :
  forall (i:Z) (k:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (1%Z <= k)%Z ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((int.EuclideanDivision.mod1 i (ind_iproduct f (h - k)%Z h)) =
   (ind_isum (fun (a:Z) => (weighted_kth_right i a h f)) 1%Z (k + 1%Z)%Z)).

Axiom kth_left_div_mod :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z ->
  ((0%Z <= l)%Z /\ (l <= h)%Z) -> ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((kth_left i k l h f) =
   (int.EuclideanDivision.div
    (int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h))
    (ind_iproduct f (l + k)%Z h))).

Parameter weighted_kth_left: Z -> Z -> Z -> Z -> (Z -> Z) -> Z.

Axiom weighted_kth_left_def :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((weighted_kth_left i k l h f) =
   (weighted_kth_right i (((h - l)%Z - k)%Z + 1%Z)%Z h f)).

Axiom weighted_kth_left_ :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h)) =
   ((weighted_kth_left i k l h f) +
    (int.EuclideanDivision.mod1 i (ind_iproduct f (l + k)%Z h)))%Z).

Axiom bounded_kth_left_decomposition :
  forall (i:Z) (k:Z) (l:Z) (h:Z) (f:Z -> Z), (0%Z <= i)%Z -> (l <= h)%Z ->
  ((1%Z <= k)%Z /\ (k <= (h - l)%Z)%Z) ->
  (forall (k1:Z), (0%Z < (f k1))%Z) ->
  ((int.EuclideanDivision.mod1 i (ind_iproduct f ((l + k)%Z - 1%Z)%Z h)) =
   (ind_isum (fun (a:Z) => (weighted_kth_left i a l h f)) k
    ((h - l)%Z + 1%Z)%Z)).

Axiom kth_left_decomposition :
  forall (i:Z) (l:Z) (h:Z) (f:Z -> Z),
  ((0%Z <= i)%Z /\ (i < (ind_iproduct f l h))%Z) -> (l < h)%Z ->
  (forall (k:Z), (0%Z < (f k))%Z) ->
  (i =
   (ind_isum (fun (a:Z) => (weighted_kth_left i a l h f)) 1%Z
    ((h - l)%Z + 1%Z)%Z)).

Parameter value_: d_frac -> t.

Axiom Assoc2 :
  forall (x:d_frac) (y:d_frac) (z:d_frac),
  ((add1 (add1 x y) z) = (add1 x (add1 y z))).

Axiom Unit_def_l1 : forall (x:d_frac), ((add1 (dyadic 0%Z 0%Z) x) = x).

Axiom Unit_def_r1 : forall (x:d_frac), ((add1 x (dyadic 0%Z 0%Z)) = x).

Axiom Inv_def_l1 : forall (x:d_frac), ((add1 (inv1 x) x) = (dyadic 0%Z 0%Z)).

Axiom Inv_def_r1 : forall (x:d_frac), ((add1 x (inv1 x)) = (dyadic 0%Z 0%Z)).

Axiom Comm2 : forall (x:d_frac) (y:d_frac), ((add1 x y) = (add1 y x)).

Axiom Dyadic_inv :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((add1 (dyadic k n) (dyadic (-k)%Z n)) = (dyadic 0%Z 0%Z)).

Axiom Dyadic_add :
  forall (k:Z) (k':Z) (n:Z), (0%Z <= n)%Z ->
  ((add1 (dyadic k n) (dyadic k' n)) = (dyadic (k + k')%Z n)).

Axiom Dyadic_up :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((dyadic k n) = (dyadic (2%Z * k)%Z (n + 1%Z)%Z)).

Axiom Dyadic_cyclic :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((dyadic k n) = (dyadic (k + (power 2%Z n))%Z n)).

Axiom Zero_n :
  forall (n:Z), (0%Z <= n)%Z -> ((dyadic 0%Z n) = (dyadic 0%Z 0%Z)).

Axiom D_mult :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z ->
  ((d_mult_int (dyadic k n) i) = (dyadic (k * i)%Z n)).

Axiom Div_two_dyadic :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((0%Z <= k)%Z /\ (k < (power 2%Z n))%Z) ->
  ((div_two (dyadic k n)) = (dyadic k (n + 1%Z)%Z)).

Axiom Div_two : forall (d:d_frac), ((add1 (div_two d) (div_two d)) = d).

Axiom K_dyadic :
  forall (k:Z), (0%Z <= k)%Z -> ((k_dyadic k) = (dyadic 1%Z k)).

Axiom K_dyadic_plus_one :
  forall (k:Z), (0%Z < k)%Z ->
  ((add1 (k_dyadic k) (k_dyadic k)) = (k_dyadic (k - 1%Z)%Z)).

Axiom Even_phase_inv :
  forall (d:d_frac), forall (i:Z),
  ((int.EuclideanDivision.mod1 i 2%Z) = 0%Z) -> ((phase_inv i d) = d).

Axiom Odd_phase_inv :
  forall (d:d_frac), forall (i:Z),
  ((int.EuclideanDivision.mod1 i 2%Z) = 1%Z) -> ((phase_inv i d) = (inv1 d)).

Axiom Gen_phase_inv :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z ->
  ((phase_inv i (dyadic k n)) = (dyadic ((power (-1%Z)%Z i) * k)%Z n)).

Axiom Gen_phase_inv_neg :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (i < 0%Z)%Z ->
  ((phase_inv i (dyadic k n)) = (dyadic ((power (-1%Z)%Z (-i)%Z) * k)%Z n)).

Axiom d_mult_int_in :
  forall (i:Z) (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((d_mult_int (dyadic k n) i) = (dyadic (i * k)%Z n)).

Axiom d_mult_int_out :
  forall (i:Z) (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((dyadic (i * k)%Z n) = (d_mult_int (dyadic k n) i)).

Axiom dyadic_cycles :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z ->
  ((dyadic (k + (i * (power 2%Z n))%Z)%Z n) = (dyadic k n)).

Axiom dyadic_cycles_neg :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (i <= 0%Z)%Z ->
  ((dyadic (k + (i * (power 2%Z n))%Z)%Z n) = (dyadic k n)).

Axiom dyadic_cycles_gen :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z ->
  ((dyadic (k + (i * (power 2%Z n))%Z)%Z n) = (dyadic k n)).

Axiom dyadic_cycles_zero :
  forall (n':Z) (n:Z), ((0%Z <= n)%Z /\ (n <= n')%Z) ->
  ((dyadic (power 2%Z n') n) = (dyadic 0%Z 0%Z)).

Axiom dyadic_cycles_zero_mult :
  forall (k:Z) (n':Z) (n:Z), ((0%Z <= n)%Z /\ (n <= n')%Z) ->
  ((dyadic (k * (power 2%Z n'))%Z n) = (dyadic 0%Z 0%Z)).

Axiom dyadic_eq :
  forall (k1:Z) (k2:Z) (n1:Z) (n2:Z), (k1 = k2) -> (n1 = n2) ->
  ((dyadic k1 n1) = (dyadic k2 n2)).

Axiom dyadicmod :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((dyadic k n) = (dyadic (int.EuclideanDivision.mod1 k (power 2%Z n)) n)).

Axiom dyadic_red :
  forall (k:Z) (n:Z), (1%Z <= n)%Z -> ~ (0%Z = k) ->
  ((int.EuclideanDivision.mod1 k 2%Z) = 0%Z) ->
  ((dyadic k n) = (dyadic (int.EuclideanDivision.div k 2%Z) (n - 1%Z)%Z)).

Axiom dyadic_up :
  forall (k:Z) (n:Z) (n':Z), (0%Z <= n)%Z -> (0%Z <= n')%Z ->
  ((dyadic (k * (power 2%Z n'))%Z (n + n')%Z) = (dyadic k n)).

Axiom d_frac_simpl :
  forall (k:Z) (n1:Z) (n2:Z), (0%Z <= n1)%Z -> (0%Z <= n2)%Z ->
  ((dyadic (k * (power 2%Z n1))%Z (n2 + n1)%Z) = (dyadic k n2)).

Axiom add_eq1 :
  forall (d1:d_frac) (d2:d_frac) (e1:d_frac) (e2:d_frac), (d1 = e1) ->
  (d2 = e2) -> ((add1 d1 d2) = (add1 e1 e2)).

Axiom add_comm :
  forall (d1:d_frac) (d2:d_frac), ((add1 d1 d2) = (add1 d2 d1)).

Axiom add_eq_comm :
  forall (d1:d_frac) (d2:d_frac) (d3:d_frac) (d4:d_frac), (d1 = d3) ->
  (d2 = d4) -> ((add1 d1 d2) = (add1 d4 d3)).

Axiom d_div :
  forall (k:Z) (n:Z) (i:Z), (0%Z <= n)%Z -> (0%Z <= i)%Z ->
  ((dyadic k n) = (d_mult_int (dyadic k (n + i)%Z) (power 2%Z i))).

Axiom zero_d_add :
  forall (d':d_frac) (d:d_frac), (d' = (dyadic 0%Z 0%Z)) -> ((add1 d' d) = d).

Axiom add_zero_d :
  forall (d':d_frac) (d:d_frac), (d' = (dyadic 0%Z 0%Z)) -> ((add1 d d') = d).

Axiom d_sum__def :
  forall (f:Z -> d_frac), forall (i:Z) (j:Z),
  ((j <= i)%Z -> ((d_sum f i j) = (dyadic 0%Z 0%Z))) /\
  (~ (j <= i)%Z ->
   ((d_sum f i j) =
    (int_iterate (fun (y0:d_frac) (y1:d_frac) => (add1 y0 y1)) f i j))).

Axiom d_sum_to_int_iterate :
  forall (f:Z -> d_frac) (i:Z) (j:Z), (i < j)%Z ->
  ((d_sum f i j) =
   (int_iterate (fun (y0:d_frac) (y1:d_frac) => (add1 y0 y1)) f i j)).

Axiom d_sum_plus_one :
  forall (f:Z -> d_frac) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z ->
  ((d_sum f i j) = (add1 (f i) (d_sum f (i + 1%Z)%Z j))).

Axiom d_sum_cardone :
  forall (f:Z -> d_frac) (i:Z) (j:Z), (j = (i + 1%Z)%Z) ->
  ((d_sum f i j) = (f i)).

Axiom d_sum_neutral :
  forall (f:Z -> d_frac) (i:Z) (j:Z), (i < j)%Z ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (dyadic 0%Z 0%Z))) ->
  ((d_sum f i j) = (dyadic 0%Z 0%Z)).

Axiom d_sum_def_plus_one_com :
  forall (f:Z -> d_frac) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z ->
  ((add1 (f i) (d_sum f (i + 1%Z)%Z j)) = (d_sum f i j)).

Axiom d_sum_right_extension :
  forall (f:Z -> d_frac) (i:Z) (j:Z), ((i + 1%Z)%Z < j)%Z ->
  ((d_sum f i j) = (add1 (d_sum f i (j - 1%Z)%Z) (f (j - 1%Z)%Z))).

Axiom d_sum_transitivity :
  forall (f:Z -> d_frac) (i:Z) (k:Z) (j:Z), ((i < k)%Z /\ (k < j)%Z) ->
  ((d_sum f i j) = (add1 (d_sum f i k) (d_sum f k j))).

Axiom d_sum_eq :
  forall (f:Z -> d_frac) (g:Z -> d_frac) (i:Z) (j:Z), (i < j)%Z ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((d_sum f i j) = (d_sum g i j)).

Axiom d_sum_cardzero :
  forall (f:Z -> d_frac) (i:Z) (j:Z), (j <= i)%Z ->
  ((d_sum f i j) = (dyadic 0%Z 0%Z)).

Axiom d_sum_eq_gen :
  forall (f:Z -> d_frac) (g:Z -> d_frac) (i:Z) (j:Z) (i':Z) (j':Z),
  (i < j)%Z -> (i = i') -> (j = j') ->
  (forall (k:Z), ((i <= k)%Z /\ (k < j)%Z) -> ((f k) = (g k))) ->
  ((d_sum f i j) = (d_sum g i' j')).

Axiom d_sum_map :
  forall (i:Z) (j:Z) (k:Z) (l:Z) (f:Z -> Z) (t1:Z -> d_frac), (i < j)%Z ->
  (p_bijective f (to_fset i j) (to_fset k l)) ->
  ((d_sum t1 k l) = (d_sum (fun (b:Z) => (t1 (f b))) i j)).

Axiom d_sum_break :
  forall (f:Z -> d_frac) (i:Z) (j:Z) (y:Z), ((i <= y)%Z /\ (y < j)%Z) ->
  ((d_sum f i j) = (add1 (d_sum f i y) (d_sum f y j))).

Axiom d_sum_break_param :
  forall (f:Z -> Z -> d_frac) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z),
  ((i <= y)%Z /\ (y < j)%Z) ->
  ((d_sum (f y) i j) = (add1 (d_sum (f y) i y) (d_sum (f y) y j))).

Axiom d_sum_neutral_param_r :
  forall (f:Z -> Z -> d_frac) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z),
  ((i <= y)%Z /\ (y < j)%Z) ->
  (forall (k:Z), ((y <= k)%Z /\ (k < j)%Z) -> (((f y) k) = (dyadic 0%Z 0%Z))) ->
  ((d_sum (f y) y j) = (dyadic 0%Z 0%Z)).

Axiom d_sum_neutral_param_l :
  forall (f:Z -> Z -> d_frac) (i:Z) (j:Z), (i < j)%Z -> forall (y:Z),
  ((i <= y)%Z /\ (y < j)%Z) ->
  (forall (k:Z), ((i <= k)%Z /\ (k < y)%Z) -> (((f y) k) = (dyadic 0%Z 0%Z))) ->
  ((d_sum (f y) i y) = (dyadic 0%Z 0%Z)).

Axiom d_sum_transl :
  forall (f:Z -> d_frac) (i:Z) (j:Z) (k:Z), (i < j)%Z ->
  ((d_sum f i j) = (d_sum (fun (b:Z) => (f (b + k)%Z)) (i - k)%Z (j - k)%Z)).

Axiom d_sum_transl_one :
  forall (f:Z -> d_frac) (i:Z) (j:Z), (i < j)%Z ->
  ((d_sum f i j) =
   (d_sum (fun (b:Z) => (f (b - 1%Z)%Z)) (i + 1%Z)%Z (j + 1%Z)%Z)).

Axiom d_sum_to_ind_isum :
  forall (f:Z -> Z) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (i < j)%Z ->
  ((d_sum (fun (k:Z) => (dyadic (f k) n)) i j) = (dyadic (ind_isum f i j) n)).

Axiom ind_isum_to_d_sum :
  forall (f:Z -> Z) (n:Z) (i:Z) (j:Z), (0%Z <= n)%Z -> (i < j)%Z ->
  ((dyadic (ind_isum f i j) n) = (d_sum (fun (k:Z) => (dyadic (f k) n)) i j)).

Parameter min_set: (set Z) -> Z.

Axiom min_set_def :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> ((cardinal s) = 1%Z) ->
  ((min_set s) = (choose s)).

Axiom min_set_def1 :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> ~ ((cardinal s) = 1%Z) ->
  ((min_set s) =
   (ZArith.BinInt.Z.min (choose s) (min_set (remove (choose s) s)))).

Axiom min_set_spec :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> mem (min_set s) s.

Axiom min_set_spec1 :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> forall (e:Z), (mem e s) ->
  ((min_set s) <= e)%Z.

Parameter max_set: (set Z) -> Z.

Axiom max_set_def :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> ((cardinal s) = 1%Z) ->
  ((max_set s) = (choose s)).

Axiom max_set_def1 :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> ~ ((cardinal s) = 1%Z) ->
  ((max_set s) =
   (ZArith.BinInt.Z.max (choose s) (max_set (remove (choose s) s)))).

Axiom max_set_spec :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> mem (max_set s) s.

Axiom max_set_spec1 :
  forall (s:set Z), (0%Z < (cardinal s))%Z -> forall (e:Z), (mem e s) ->
  (e <= (max_set s))%Z.

(* Why3 assumption *)
Definition max3 (a:Z) (b:Z) (c:Z) : Z :=
  (ZArith.BinInt.Z.max (ZArith.BinInt.Z.max a b) c).

Axiom max3_spec :
  forall (a:Z) (b:Z) (c:Z),
  ((max3 a b c) = (ZArith.BinInt.Z.max a (ZArith.BinInt.Z.max b c))).

Parameter complex_frac: Z -> Z -> t.

Axiom complex_frac_def :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((complex_frac k n) = (infix_sldt (i_to_t k) (i_to_t (power 2%Z n)))).

Axiom complex_frac_spec :
  forall (k:Z) (n:Z), (0%Z <= n)%Z -> real_ (complex_frac k n).

(* Why3 assumption *)
Definition d_cos (o:d_frac) : t := t_real_part (value o).

Axiom d_cos_spec : forall (o:d_frac), real_ (d_cos o).

(* Why3 assumption *)
Definition d_sin (o:d_frac) : t := t_im_part (value o).

Axiom d_sin_spec : forall (o:d_frac), real_ (d_sin o).

Axiom real_omega :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((d_cos (dyadic k n)) =
   (cos
    (infix_asdt (infix_asdt (infix_pldt tone tone) pi) (complex_frac k n)))).

Axiom im_omega :
  forall (k:Z) (n:Z), (0%Z <= n)%Z ->
  ((d_sin (dyadic k n)) =
   (sin
    (infix_asdt (infix_asdt (infix_pldt tone tone) pi) (complex_frac k n)))).

Axiom omega_decomp :
  forall (o:d_frac),
  ((value o) = (infix_pldt (d_cos o) (infix_asdt im (d_sin o)))).

Axiom d_cos_eq :
  forall (d1:d_frac) (d2:d_frac), ((value d1) = (value d2)) ->
  ((d_cos d1) = (d_cos d2)).

Axiom d_sin_eq :
  forall (d1:d_frac) (d2:d_frac), ((value d1) = (value d2)) ->
  ((d_sin d1) = (d_sin d2)).

(* Why3 assumption *)
Definition shift {a:Type} {a_WT:WhyType a} (f:Z -> a) (i:Z) (k:Z) : a :=
  f (k + i)%Z.

Axiom shift_value :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (i:Z) (k:Z), ((shift f i k) = (f (k + i)%Z)).

Axiom shiftz :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (k:Z), ((shift f 0%Z k) = (f k)).

Axiom shiftz_gen :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (i:Z) (k:Z), (i = 0%Z) -> ((shift f i k) = (f k)).

Axiom shiftz_quant :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a),
  ((((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) 0%Z) = f).

Axiom shiftz_quant_rev :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a),
  (f = (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) 0%Z)).

Parameter concat_fun:
  forall {a:Type} {a_WT:WhyType a}, (Z -> a) -> (Z -> a) -> Z -> Z -> a.

Axiom concat_fun_def :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (g:Z -> a) (i:Z) (k:Z),
  ((k < i)%Z -> ((concat_fun f g i k) = (f k))) /\
  (~ (k < i)%Z -> ((concat_fun f g i k) = (g (k - i)%Z))).

Axiom shift_add :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (i:Z) (j:Z) (k:Z),
  ((shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) j) i k) =
   (shift f (i + j)%Z k)).

Axiom concat_fun_value :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (g:Z -> a) (i:Z) (k:Z),
  ((k < i)%Z -> ((concat_fun f g i k) = (f k))) /\
  (~ (k < i)%Z -> ((concat_fun f g i k) = (g (k - i)%Z))).

Axiom concat_eq :
  forall {a:Type} {a_WT:WhyType a},
  forall (f1:Z -> a) (g1:Z -> a) (f2:Z -> a) (g2:Z -> a) (i1:Z) (i2:Z) (k:Z),
  (forall (l:Z), (l < i1)%Z -> ((f1 l) = (f2 l))) ->
  (forall (l:Z), (0%Z <= l)%Z -> ((g1 l) = (g2 l))) -> (i1 = i2) ->
  ((concat_fun f1 g1 i1 k) = (concat_fun f2 g2 i2 k)).

Parameter mod_func:
  forall {a:Type} {a_WT:WhyType a}, (Z -> a) -> Z -> Z -> a.

Axiom mod_func_def :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (k:Z) (i:Z), (0%Z < k)%Z ->
  ((mod_func f k i) = (f (int.EuclideanDivision.mod1 i k))).

Axiom mod_func_inf :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (k:Z) (i:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < k)%Z) -> ((mod_func f k i) = (f i)).

Axiom shift_mod :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (k:Z) (i:Z), (0%Z < k)%Z ->
  ((mod_func f k i) =
   (shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k) k i)).

Axiom shift_mod_rev :
  forall {a:Type} {a_WT:WhyType a},
  forall (f:Z -> a) (k:Z) (i:Z), (0%Z < k)%Z ->
  ((shift (((fun (y0:Z -> a) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k) k i)
   = (mod_func f k i)).

(* Why3 assumption *)
Definition binary (t1:Z -> Z) : Prop :=
  forall (k:Z), (0%Z <= (t1 k))%Z /\ ((t1 k) < 2%Z)%Z.

Axiom set_binary :
  forall (t1:Z -> Z),
  (forall (k:Z), (0%Z <= (t1 k))%Z /\ ((t1 k) < 2%Z)%Z) -> binary t1.

Axiom get_binary :
  forall (t1:Z -> Z), (binary t1) -> forall (k:Z), (0%Z <= (t1 k))%Z.

Axiom get_binary1 :
  forall (t1:Z -> Z), (binary t1) -> forall (k:Z), ((t1 k) < 2%Z)%Z.

Parameter head_bit: Z -> Z -> Z.

Axiom head_bit_def :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((head_bit i k) = (int.EuclideanDivision.div i (power 2%Z (k - 1%Z)%Z))).

Axiom head_bit_spec :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> (0%Z <= (head_bit i k))%Z.

Axiom head_bit_spec1 :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> ((head_bit i k) <= 1%Z)%Z.

Parameter tail_bits: Z -> Z -> Z.

Axiom tail_bits_def :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((tail_bits i k) = (int.EuclideanDivision.mod1 i (power 2%Z (k - 1%Z)%Z))).

Axiom tail_bits_spec :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) -> (0%Z <= (tail_bits i k))%Z.

Axiom tail_bits_spec1 :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((tail_bits i k) <= (power 2%Z (k - 1%Z)%Z))%Z.

Parameter ht_to_int: Z -> Z -> Z -> Z.

Axiom ht_to_int_def :
  forall (hi:Z) (ti:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= hi)%Z /\ (hi < 2%Z)%Z) ->
  ((0%Z <= ti)%Z /\ (ti < (power 2%Z (k - 1%Z)%Z))%Z) ->
  ((ht_to_int hi ti k) = ((hi * (power 2%Z (k - 1%Z)%Z))%Z + ti)%Z).

Axiom head_tail_inv :
  forall (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((ht_to_int (head_bit i k) (tail_bits i k) k) = i).

Axiom ht_to_int_head :
  forall (i:Z) (ti:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((0%Z <= ti)%Z /\ (ti < (power 2%Z (k - 1%Z)%Z))%Z) ->
  ((head_bit (ht_to_int (head_bit i k) ti k) k) = (head_bit i k)).

Axiom ht_to_int_tail :
  forall (hi:Z) (i:Z) (k:Z), (0%Z < k)%Z ->
  ((0%Z <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ((0%Z <= hi)%Z /\ (hi < 2%Z)%Z) ->
  ((tail_bits (ht_to_int hi (tail_bits i k) k) k) = (tail_bits i k)).

Axiom concat_fun_bin_i :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (k:Z), (binary f) -> (binary g) ->
  (0%Z <= (concat_fun f g i k))%Z.

Axiom concat_fun_bin_i1 :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z) (k:Z), (binary f) -> (binary g) ->
  ((concat_fun f g i k) < 2%Z)%Z.

Axiom shift_bin_i :
  forall (f:Z -> Z) (i:Z) (k:Z), (binary f) -> (0%Z <= (shift f i k))%Z.

Axiom shift_bin_i1 :
  forall (f:Z -> Z) (i:Z) (k:Z), (binary f) -> ((shift f i k) < 2%Z)%Z.

Axiom concat_fun_bin :
  forall (f:Z -> Z) (g:Z -> Z) (i:Z), (binary f) -> (binary g) ->
  binary
  ((((fun (y0:Z -> Z) (y1:Z -> Z) (y2:Z) (y3:Z) => (concat_fun y0 y1 y2 y3))
     f)
    g)
   i).

Axiom mod_func_bin :
  forall (f:Z -> Z) (k:Z), (0%Z < k)%Z -> (binary f) ->
  binary (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (mod_func y0 y1 y2)) f) k).

Axiom shift_bin :
  forall (f:Z -> Z) (i:Z), (binary f) ->
  binary (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) f) i).

Axiom binary_comp :
  forall (f:Z -> Z) (g:Z -> Z), (binary f) -> binary (fun (x:Z) => (f (g x))).

Axiom set_is_all_binary :
  forall (t1:Z -> Z),
  (forall (k:Z), (0%Z <= (t1 k))%Z /\ ((t1 k) < 2%Z)%Z) -> binary t1.

Parameter nary_length: Z -> Z -> Z.

Axiom nary_length_spec :
  forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (0%Z < i)%Z ->
  ((power n ((nary_length i n) - 1%Z)%Z) <= i)%Z.

Axiom nary_length_spec1 :
  forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (0%Z < i)%Z ->
  (i < (power n (nary_length i n)))%Z.

Axiom nary_length_spec2 :
  forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z -> (i < n)%Z ->
  ((nary_length i n) = 1%Z).

Axiom nary_length_spec3 :
  forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z ->
  (1%Z <= (nary_length i n))%Z.

Axiom nary_length_spec4 :
  forall (i:Z) (n:Z), (1%Z < n)%Z -> (0%Z <= i)%Z ->
  (i = (int.EuclideanDivision.mod1 i (power n (nary_length i n)))).

Parameter binary_length: Z -> Z.

Axiom binary_length_def :
  forall (i:Z), (0%Z <= i)%Z -> ((binary_length i) = (nary_length i 2%Z)).

Axiom binary_length_spec :
  forall (i:Z), (0%Z <= i)%Z -> (0%Z < i)%Z ->
  ((power 2%Z ((binary_length i) - 1%Z)%Z) <= i)%Z.

Axiom binary_length_spec1 :
  forall (i:Z), (0%Z <= i)%Z -> (0%Z < i)%Z ->
  (i < (power 2%Z (binary_length i)))%Z.

Axiom binary_length_spec2 :
  forall (i:Z), (0%Z <= i)%Z -> (i < 2%Z)%Z -> ((binary_length i) = 1%Z).

Axiom binary_length_spec3 :
  forall (i:Z), (0%Z <= i)%Z -> (1%Z <= (binary_length i))%Z.

Axiom binary_length_spec4 :
  forall (i:Z), (0%Z <= i)%Z ->
  (i = (int.EuclideanDivision.mod1 i (power 2%Z (binary_length i)))).

Axiom set_binary_length :
  forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> ~ (0%Z < i)%Z ->
  ~ (i < 2%Z)%Z -> (k = (binary_length i)).

Axiom set_binary_length1 :
  forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z -> ~ (0%Z < i)%Z ->
  (k = 1%Z) -> (k = (binary_length i)).

Axiom set_binary_length2 :
  forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z ->
  (((power 2%Z (k - 1%Z)%Z) <= i)%Z /\ (i < (power 2%Z k))%Z) ->
  ~ (i < 2%Z)%Z -> (k = (binary_length i)).

Axiom set_binary_length3 :
  forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z <= k)%Z ->
  (((power 2%Z (k - 1%Z)%Z) <= i)%Z /\ (i < (power 2%Z k))%Z) -> (k = 1%Z) ->
  (k = (binary_length i)).

Axiom set_binary_length_b :
  forall (i:Z) (k:Z), (0%Z <= i)%Z -> (0%Z < k)%Z -> (i < (power 2%Z k))%Z ->
  ((binary_length i) <= k)%Z.

(* Why3 assumption *)
Inductive circuit_pre :=
  | Phase : d_frac -> circuit_pre
  | Rz : d_frac -> circuit_pre
  | Hadamard : circuit_pre
  | Cnot : circuit_pre
  | Sequence : circuit_pre -> circuit_pre -> circuit_pre
  | Parallel : circuit_pre -> circuit_pre -> circuit_pre.
Axiom circuit_pre_WhyType : WhyType circuit_pre.
Existing Instance circuit_pre_WhyType.

(* Why3 assumption *)
Fixpoint depth_pre (c:circuit_pre) {struct c}: Z :=
  match c with
  | Cnot => 2%Z
  | Sequence d _ => depth_pre d
  | Parallel d e => ((depth_pre d) + (depth_pre e))%Z
  | _ => 1%Z
  end.

Axiom depth_pre_spec : forall (c:circuit_pre), (1%Z <= (depth_pre c))%Z.

(* Why3 assumption *)
Fixpoint build_correct (c:circuit_pre) {struct c}: Prop :=
  match c with
  | Sequence d e =>
      ((depth_pre d) = (depth_pre e)) /\
      ((build_correct d) /\ (build_correct e))
  | Parallel d e => (build_correct d) /\ (build_correct e)
  | _ => True
  end.

Axiom circuit : Type.
Parameter circuit_WhyType : WhyType circuit.
Existing Instance circuit_WhyType.

Parameter pre: circuit -> circuit_pre.

Axiom circuit'invariant : forall (self:circuit), build_correct (pre self).

Axiom injective_pre :
  forall (c:circuit) (c':circuit), ~ (c = c') -> ~ ((pre c) = (pre c')).

Parameter to_qc: circuit_pre -> circuit.

Axiom to_qc_spec :
  forall (c:circuit_pre), (build_correct c) -> ((pre (to_qc c)) = c).

Axiom to_qc_rev : forall (c:circuit), (c = (to_qc (pre c))).

(* Why3 assumption *)
Definition depth (c:circuit) : Z := depth_pre (pre c).

Axiom depth_spec : forall (c:circuit), (0%Z < (depth c))%Z.

Parameter sum_range: circuit -> Z.

Axiom sum_range_def :
  forall (c:circuit), forall (x:d_frac), ((pre c) = (Phase x)) ->
  ((sum_range c) = 0%Z).

Axiom sum_range_def1 :
  forall (c:circuit), forall (x:d_frac), ((pre c) = (Rz x)) ->
  ((sum_range c) = 0%Z).

Axiom sum_range_def2 :
  forall (c:circuit), ((pre c) = Hadamard) -> ((sum_range c) = 1%Z).

Axiom sum_range_def3 :
  forall (c:circuit), ((pre c) = Cnot) -> ((sum_range c) = 0%Z).

Axiom sum_range_def4 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Sequence x x1)) ->
  ((sum_range c) = ((sum_range (to_qc x)) + (sum_range (to_qc x1)))%Z).

Axiom sum_range_def5 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Parallel x x1)) ->
  ((sum_range c) = ((sum_range (to_qc x)) + (sum_range (to_qc x1)))%Z).

Axiom sum_range_spec : forall (c:circuit), (0%Z <= (sum_range c))%Z.

Parameter ket_part: circuit -> (Z -> Z) -> (Z -> Z) -> Z -> Z.

Axiom ket_part_def :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), forall (x:d_frac),
  ((pre c) = (Phase x)) -> (i = 0%Z) -> ((ket_part c bvx bvy i) = (bvx i)).

Axiom ket_part_def1 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), forall (x:d_frac),
  ((pre c) = (Phase x)) -> ~ (i = 0%Z) -> ((ket_part c bvx bvy i) = 0%Z).

Axiom ket_part_def2 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), forall (x:d_frac),
  ((pre c) = (Rz x)) -> (i = 0%Z) -> ((ket_part c bvx bvy i) = (bvx i)).

Axiom ket_part_def3 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), forall (x:d_frac),
  ((pre c) = (Rz x)) -> ~ (i = 0%Z) -> ((ket_part c bvx bvy i) = 0%Z).

Axiom ket_part_def4 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((pre c) = Hadamard) ->
  (i = 0%Z) -> ((ket_part c bvx bvy i) = (bvy i)).

Axiom ket_part_def5 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((pre c) = Hadamard) ->
  ~ (i = 0%Z) -> ((ket_part c bvx bvy i) = 0%Z).

Axiom ket_part_def6 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((pre c) = Cnot) ->
  (i = 1%Z) ->
  ((ket_part c bvx bvy i) =
   (int.EuclideanDivision.mod1 ((bvx 0%Z) + (bvx 1%Z))%Z 2%Z)).

Axiom ket_part_def7 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((pre c) = Cnot) ->
  ~ (i = 1%Z) -> (i = 0%Z) -> ((ket_part c bvx bvy i) = (bvx i)).

Axiom ket_part_def8 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((pre c) = Cnot) ->
  ~ (i = 1%Z) -> ~ (i = 0%Z) -> ((ket_part c bvx bvy i) = 0%Z).

Axiom ket_part_def9 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z),
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Sequence x x1)) ->
  ((ket_part c bvx bvy i) =
   (ket_part (to_qc x1)
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       (to_qc x))
      bvx)
     bvy)
    (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
     (sum_range (to_qc x)))
    i)).

Axiom ket_part_def10 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z),
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Parallel x x1)) ->
  ((ket_part c bvx bvy i) =
   (concat_fun
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       (to_qc x))
      bvx)
     bvy)
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       (to_qc x1))
      (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx)
       (depth (to_qc x))))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range (to_qc x))))
    (depth (to_qc x)) i)).

Axiom ket_part_spec :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), (binary bvx) ->
  (binary bvy) -> (0%Z <= (ket_part c bvx bvy i))%Z.

Axiom ket_part_spec1 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), (binary bvx) ->
  (binary bvy) -> ((ket_part c bvx bvy i) < 2%Z)%Z.

Axiom ket_part_spec2 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), (i < 0%Z)%Z ->
  ((ket_part c bvx bvy i) = 0%Z).

Axiom ket_part_spec3 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z) (i:Z), ((depth c) <= i)%Z ->
  ((ket_part c bvx bvy i) = 0%Z).

Axiom binary_ket_part :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z), (binary bvx) ->
  (binary bvy) ->
  binary
  ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
      (ket_part y0 y1 y2 y3))
     c)
    bvx)
   bvy).

Parameter phase_part: circuit -> (Z -> Z) -> (Z -> Z) -> d_frac.

Axiom phase_part_def :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z), forall (x:d_frac),
  ((pre c) = (Phase x)) -> ((phase_part c bvx bvy) = x).

Axiom phase_part_def1 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z), forall (x:d_frac),
  ((pre c) = (Rz x)) ->
  ((phase_part c bvx bvy) = (phase_inv (1%Z - (bvx 0%Z))%Z x)).

Axiom phase_part_def2 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z), ((pre c) = Hadamard) ->
  ((phase_part c bvx bvy) = (dyadic ((bvx 0%Z) * (bvy 0%Z))%Z 1%Z)).

Axiom phase_part_def3 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z), ((pre c) = Cnot) ->
  ((phase_part c bvx bvy) = (dyadic 0%Z 0%Z)).

Axiom phase_part_def4 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z),
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Sequence x x1)) ->
  ((phase_part c bvx bvy) =
   (add1 (phase_part (to_qc x) bvx bvy)
    (phase_part (to_qc x1)
     ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
         (ket_part y0 y1 y2 y3))
        (to_qc x))
       bvx)
      bvy)
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range (to_qc x)))))).

Axiom phase_part_def5 :
  forall (c:circuit) (bvx:Z -> Z) (bvy:Z -> Z),
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Parallel x x1)) ->
  ((phase_part c bvx bvy) =
   (add1 (phase_part (to_qc x) bvx bvy)
    (phase_part (to_qc x1)
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx)
      (depth (to_qc x)))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range (to_qc x)))))).

Parameter phase: d_frac -> circuit.

Axiom phase_spec : forall (o:d_frac), ((sum_range (phase o)) = 0%Z).

Axiom phase_spec1 : forall (o:d_frac), ((depth (phase o)) = 1%Z).

Axiom phase_spec2 :
  forall (o:d_frac), forall (bvx:Z -> Z) (bvy:Z -> Z), forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (depth (phase o)))%Z) ->
  ((ket_part (phase o) bvx bvy i) = (bvx i)).

Axiom phase_spec3 :
  forall (o:d_frac), forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (phase o) bvx bvy) = o).

Axiom phase_spec4 : forall (o:d_frac), ((pre (phase o)) = (Phase o)).

Parameter rz: d_frac -> circuit.

Axiom rz_spec : forall (o:d_frac), ((sum_range (rz o)) = 0%Z).

Axiom rz_spec1 : forall (o:d_frac), ((depth (rz o)) = 1%Z).

Axiom rz_spec2 :
  forall (o:d_frac), forall (bvx:Z -> Z) (bvy:Z -> Z), forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (depth (rz o)))%Z) ->
  ((ket_part (rz o) bvx bvy i) = (bvx i)).

Axiom rz_spec3 :
  forall (o:d_frac), forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (rz o) bvx bvy) = (phase_inv (1%Z - (bvx 0%Z))%Z o)).

Axiom rz_spec4 : forall (o:d_frac), ((pre (rz o)) = (Rz o)).

Parameter hadamard: unit -> circuit.

Axiom hadamard_spec : forall (us:unit), ((sum_range (hadamard us)) = 1%Z).

Axiom hadamard_spec1 : forall (us:unit), ((depth (hadamard us)) = 1%Z).

Axiom hadamard_spec2 :
  forall (us:unit), forall (bvx:Z -> Z) (bvy:Z -> Z), forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (depth (hadamard us)))%Z) ->
  ((ket_part (hadamard us) bvx bvy i) = (bvy i)).

Axiom hadamard_spec3 :
  forall (us:unit), forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (hadamard us) bvx bvy) =
   (dyadic ((bvx 0%Z) * (bvy 0%Z))%Z 1%Z)).

Axiom hadamard_spec4 : forall (us:unit), ((pre (hadamard us)) = Hadamard).

Parameter cnot: unit -> circuit.

Axiom cnot_spec : forall (us:unit), ((sum_range (cnot us)) = 0%Z).

Axiom cnot_spec1 : forall (us:unit), ((depth (cnot us)) = 2%Z).

Axiom cnot_spec2 :
  forall (us:unit), forall (bvx:Z -> Z) (bvy:Z -> Z), forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (depth (cnot us)))%Z) ->
  ((i = 1%Z) ->
   ((ket_part (cnot us) bvx bvy i) =
    (int.EuclideanDivision.mod1 ((bvx 0%Z) + (bvx 1%Z))%Z 2%Z))) /\
  (~ (i = 1%Z) -> ((ket_part (cnot us) bvx bvy i) = (bvx i))).

Axiom cnot_spec3 :
  forall (us:unit), forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (cnot us) bvx bvy) = (dyadic 0%Z 0%Z)).

Axiom cnot_spec4 : forall (us:unit), ((pre (cnot us)) = Cnot).

Parameter parallel: circuit -> circuit -> circuit.

Axiom parallel_spec :
  forall (d:circuit) (e:circuit),
  ((depth (parallel d e)) = ((depth d) + (depth e))%Z).

Axiom parallel_spec1 :
  forall (d:circuit) (e:circuit),
  ((sum_range (parallel d e)) = ((sum_range d) + (sum_range e))%Z).

Axiom parallel_spec2 :
  forall (d:circuit) (e:circuit), forall (bvx:Z -> Z) (bvy:Z -> Z),
  forall (i:Z), ((0%Z <= i)%Z /\ (i < (depth (parallel d e)))%Z) ->
  ((ket_part (parallel d e) bvx bvy i) =
   (concat_fun
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       d)
      bvx)
     bvy)
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       e)
      (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx) (depth d)))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range d)))
    (depth d) i)).

Axiom parallel_spec3 :
  forall (d:circuit) (e:circuit), forall (bvx:Z -> Z) (bvy:Z -> Z),
  forall (i:Z), ((0%Z <= i)%Z /\ (i < (depth (parallel d e)))%Z) ->
  ((ket_part (parallel d e) bvx bvy i) =
   (concat_fun
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       d)
      bvx)
     bvy)
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       e)
      (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx) (depth d)))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range d)))
    (depth d) i)).

Axiom parallel_spec4 :
  forall (d:circuit) (e:circuit), forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (parallel d e) bvx bvy) =
   (add1 (phase_part d bvx bvy)
    (phase_part e
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx) (depth d))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range d))))).

Axiom parallel_spec5 :
  forall (d:circuit) (e:circuit),
  ((pre (parallel d e)) = (Parallel (pre d) (pre e))).

Parameter sequence: circuit -> circuit -> circuit.

Axiom sequence_spec :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  ((sum_range (sequence d e)) = ((sum_range d) + (sum_range e))%Z).

Axiom sequence_spec1 :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  ((depth (sequence d e)) = (depth d)).

Axiom sequence_spec2 :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  forall (bvx:Z -> Z) (bvy:Z -> Z), forall (i:Z),
  ((0%Z <= i)%Z /\ (i < (depth (sequence d e)))%Z) ->
  ((ket_part (sequence d e) bvx bvy i) =
   (ket_part e
    ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
        (ket_part y0 y1 y2 y3))
       d)
      bvx)
     bvy)
    (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy) (sum_range d))
    i)).

Axiom sequence_spec3 :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  forall (bvx:Z -> Z) (bvy:Z -> Z),
  ((phase_part (sequence d e) bvx bvy) =
   (add1 (phase_part d bvx bvy)
    (phase_part e
     ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
         (ket_part y0 y1 y2 y3))
        d)
       bvx)
      bvy)
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvy)
      (sum_range d))))).

Axiom sequence_spec4 :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  ((pre (sequence d e)) = (Sequence (pre d) (pre e))).

Axiom sequence_spec5 :
  forall (d:circuit) (e:circuit), ((depth d) = (depth e)) ->
  ((sequence d e) = (to_qc (Sequence (pre d) (pre e)))).

Parameter rzp: Z -> circuit.

Axiom rzp_def :
  forall (n:Z), (0%Z <= n)%Z ->
  ((rzp n) =
   (sequence (phase (dyadic 1%Z (n + 1%Z)%Z)) (rz (dyadic 1%Z (n + 1%Z)%Z)))).

Axiom rzp_spec : forall (n:Z), (0%Z <= n)%Z -> ((depth (rzp n)) = 1%Z).

Axiom rzp_spec1 : forall (n:Z), (0%Z <= n)%Z -> ((sum_range (rzp n)) = 0%Z).

Axiom rzp_spec2 :
  forall (n:Z), (0%Z <= n)%Z -> forall (bvx:Z -> Z) (bvy:Z -> Z),
  forall (i:Z), ((0%Z <= i)%Z /\ (i < (depth (rzp n)))%Z) ->
  ((ket_part (rzp n) bvx bvy i) = (bvx i)).

Axiom rzp_spec3 :
  forall (n:Z), (0%Z <= n)%Z -> forall (bvx:Z -> Z) (bvy:Z -> Z),
  (binary bvx) -> (binary bvy) ->
  ((phase_part (rzp n) bvx bvy) = (k_dyadic ((bvx 0%Z) * n)%Z)).

Parameter flat: circuit -> Prop.

Axiom flat_def :
  forall (c:circuit), forall (x:d_frac), ((pre c) = (Phase x)) -> flat c.

Axiom flat_def1 :
  forall (c:circuit), forall (x:d_frac), ((pre c) = (Rz x)) -> flat c.

Axiom flat_def2 : forall (c:circuit), ((pre c) = Hadamard) -> ~ (flat c).

Axiom flat_def3 : forall (c:circuit), ((pre c) = Cnot) -> flat c.

Axiom flat_def4 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Sequence x x1)) -> (flat c) -> flat (to_qc x).

Axiom flat_def5 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Sequence x x1)) -> (flat c) -> flat (to_qc x1).

Axiom flat_def6 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Sequence x x1)) -> ((flat (to_qc x)) /\ (flat (to_qc x1))) ->
  flat c.

Axiom flat_def7 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Parallel x x1)) -> (flat c) -> flat (to_qc x).

Axiom flat_def8 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Parallel x x1)) -> (flat c) -> flat (to_qc x1).

Axiom flat_def9 :
  forall (c:circuit), forall (x:circuit_pre) (x1:circuit_pre),
  ((pre c) = (Parallel x x1)) -> ((flat (to_qc x)) /\ (flat (to_qc x1))) ->
  flat c.

Axiom flat_spec : forall (c:circuit), (flat c) -> ((sum_range c) = 0%Z).

Axiom flat_spec1 : forall (c:circuit), ((sum_range c) = 0%Z) -> flat c.

Parameter flat_ket: circuit -> (Z -> Z) -> Z -> Z.

Axiom flat_ket_def :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Phase x)) -> (i = 0%Z) -> ((flat_ket c bvx i) = (bvx i)).

Axiom flat_ket_def1 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Phase x)) -> ~ (i = 0%Z) -> ((flat_ket c bvx i) = 0%Z).

Axiom flat_ket_def2 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Rz x)) -> (i = 0%Z) -> ((flat_ket c bvx i) = (bvx i)).

Axiom flat_ket_def3 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Rz x)) -> ~ (i = 0%Z) -> ((flat_ket c bvx i) = 0%Z).

Axiom flat_ket_def4 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> ((pre c) = Cnot) ->
  (i = 1%Z) ->
  ((flat_ket c bvx i) =
   (int.EuclideanDivision.mod1 ((bvx 0%Z) + (bvx 1%Z))%Z 2%Z)).

Axiom flat_ket_def5 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> ((pre c) = Cnot) ->
  ~ (i = 1%Z) -> (i = 0%Z) -> ((flat_ket c bvx i) = (bvx i)).

Axiom flat_ket_def6 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> ((pre c) = Cnot) ->
  ~ (i = 1%Z) -> ~ (i = 0%Z) -> ((flat_ket c bvx i) = 0%Z).

Axiom flat_ket_def7 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) ->
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Sequence x x1)) ->
  ((flat_ket c bvx i) =
   (flat_ket (to_qc x1)
    (((fun (y0:circuit) (y1:Z -> Z) (y2:Z) => (flat_ket y0 y1 y2)) (to_qc x))
     bvx)
    i)).

Axiom flat_ket_def8 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) ->
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Parallel x x1)) ->
  ((flat_ket c bvx i) =
   (concat_fun
    (((fun (y0:circuit) (y1:Z -> Z) (y2:Z) => (flat_ket y0 y1 y2)) (to_qc x))
     bvx)
    (((fun (y0:circuit) (y1:Z -> Z) (y2:Z) => (flat_ket y0 y1 y2))
      (to_qc x1))
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx)
      (depth (to_qc x))))
    (depth (to_qc x)) i)).

Axiom flat_ket_def9 :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> ((pre c) = Hadamard) ->
  ((flat_ket c bvx i) = 0%Z).

Axiom flat_ket_spec :
  forall (c:circuit) (bvx:Z -> Z) (i:Z), (flat c) -> forall (bvy:Z -> Z),
  ((flat_ket c bvx i) = (ket_part c bvx bvy i)).

Parameter flat_phase: circuit -> (Z -> Z) -> d_frac.

Axiom flat_phase_def :
  forall (c:circuit) (bvx:Z -> Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Phase x)) -> ((flat_phase c bvx) = x).

Axiom flat_phase_def1 :
  forall (c:circuit) (bvx:Z -> Z), (flat c) -> forall (x:d_frac),
  ((pre c) = (Rz x)) ->
  ((flat_phase c bvx) = (phase_inv (1%Z - (bvx 0%Z))%Z x)).

Axiom flat_phase_def2 :
  forall (c:circuit) (bvx:Z -> Z), (flat c) -> ((pre c) = Cnot) ->
  ((flat_phase c bvx) = (dyadic 0%Z 0%Z)).

Axiom flat_phase_def3 :
  forall (c:circuit) (bvx:Z -> Z), (flat c) ->
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Sequence x x1)) ->
  ((flat_phase c bvx) =
   (add1 (flat_phase (to_qc x) bvx)
    (flat_phase (to_qc x1)
     (((fun (y0:circuit) (y1:Z -> Z) (y2:Z) => (flat_ket y0 y1 y2))
       (to_qc x))
      bvx)))).

Axiom flat_phase_def4 :
  forall (c:circuit) (bvx:Z -> Z), (flat c) ->
  forall (x:circuit_pre) (x1:circuit_pre), ((pre c) = (Parallel x x1)) ->
  ((flat_phase c bvx) =
   (add1 (flat_phase (to_qc x) bvx)
    (flat_phase (to_qc x1)
     (((fun (y0:Z -> Z) (y1:Z) (y2:Z) => (shift y0 y1 y2)) bvx)
      (depth (to_qc x)))))).

Axiom flat_phase_def5 :
  forall (c:circuit) (bvx:Z -> Z), (flat c) -> ((pre c) = Hadamard) ->
  ((flat_phase c bvx) = (dyadic 0%Z 0%Z)).

Axiom flat_phase_spec :
  forall (c:circuit) (bvx:Z -> Z), (flat c) -> forall (bvy:Z -> Z),
  ((phase_part c bvx bvy) = (flat_phase c bvx)).

(* Why3 assumption *)
Definition d_sum1 (f:Z -> d_frac) (i:Z) (j:Z) : d_frac :=
  int_iterate (fun (y0:d_frac) (y1:d_frac) => (add1 y0 y1)) f i j.

Axiom pre_to_qc : forall (c:circuit), ((to_qc (pre c)) = c).

Axiom ket_part_equiv :
  forall (c:circuit) (bvx:Z -> Z) (bvx':Z -> Z) (bvy:Z -> Z) (bvy':Z -> Z),
  (forall (i:Z), ((0%Z <= i)%Z /\ (i < (depth c))%Z) -> ((bvx i) = (bvx' i))) ->
  (forall (j:Z), ((0%Z <= j)%Z /\ (j < (sum_range c))%Z) ->
   ((bvy j) = (bvy' j))) ->
  (((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
       (ket_part y0 y1 y2 y3))
      c)
     bvx)
    bvy)
   =
   ((((fun (y0:circuit) (y1:Z -> Z) (y2:Z -> Z) (y3:Z) =>
       (ket_part y0 y1 y2 y3))
      c)
     bvx')
    bvy')).

Parameter c: circuit.

Parameter bvx: Z -> Z.

Parameter bvx': Z -> Z.

Parameter bvy: Z -> Z.

Parameter bvy': Z -> Z.

Axiom H :
  forall (i:Z), ((0%Z <= i)%Z /\ (i < (depth c))%Z) -> ((bvx i) = (bvx' i)).

Axiom H1 :
  forall (j:Z), ((0%Z <= j)%Z /\ (j < (sum_range c))%Z) ->
  ((bvy j) = (bvy' j)).

Parameter x: d_frac.

Axiom H2 : ((pre c) = (Rz x)).

(* Why3 goal *)
Theorem VC_phase_part_equiv :
  ((phase_inv (1%Z - (bvx 0%Z))%Z x) = (phase_inv (1%Z - (bvx' 0%Z))%Z x)).
Proof.

Qed.