Built with Alectryon, running Coq+SerAPI v8.10.0+0.7.0. Coq sources are in this panel; goals and messages will appear in the other. Bubbles () indicate interactive fragments: hover for details, tap to reveal contents. Use Ctrl+↑ Ctrl+↓ to navigate, Ctrl+🖱️ to focus.
(************************************************************************) (* * The Coq Proof Assistant / The Coq Development Team *) (* v * INRIA, CNRS and contributors - Copyright 1999-2018 *) (* <O___,, * (see CREDITS file for the list of authors) *) (* \VV/ **************************************************************) (* // * This file is distributed under the terms of the *) (* * GNU Lesser General Public License Version 2.1 *) (* * (see LICENSE file for the text of the license) *) (************************************************************************) Require Import Zpow_facts Qfield Qreduction.forall n : positive, Qpower_positive 1 n == 1induction n; simpl; try rewrite IHn; reflexivity. Qed.forall n : positive, Qpower_positive 1 n == 1forall n : Z, 1 ^ n == 1intros [|n|n]; simpl; try rewrite Qpower_positive_1; reflexivity. Qed.forall n : Z, 1 ^ n == 1forall n : positive, Qpower_positive 0 n == 0induction n; simpl; try rewrite IHn; reflexivity. Qed.forall n : positive, Qpower_positive 0 n == 0forall n : Z, n <> 0%Z -> 0 ^ n == 0intros [|n|n] Hn; try (elim Hn; reflexivity); simpl; rewrite Qpower_positive_0; reflexivity. Qed.forall n : Z, n <> 0%Z -> 0 ^ n == 0forall (a : Q) (n : positive), ~ a == 0 -> ~ Qpower_positive a n == 0forall (a : Q) (n : positive), ~ a == 0 -> ~ Qpower_positive a n == 0a:Qn:positiveX:~ a == 0H:Qpower_positive a n == 0Falseinduction n; simpl in *; try assumption; destruct (Qmult_integral _ _ H); try destruct (Qmult_integral _ _ H0); auto. Qed.a:Qn:positiveH:Qpower_positive a n == 0a == 0forall (p : Q) (n : positive), 0 <= p -> 0 <= Qpower_positive p nforall (p : Q) (n : positive), 0 <= p -> 0 <= Qpower_positive p ninduction n; simpl; repeat apply Qmult_le_0_compat;assumption. Qed.p:Qn:positiveHp:0 <= p0 <= Qpower_positive p nforall (p : Q) (n : Z), 0 <= p -> 0 <= p ^ nintros p [|n|n] Hp; simpl; try discriminate; try apply Qinv_le_0_compat; apply Qpower_pos_positive; assumption. Qed.forall (p : Q) (n : Z), 0 <= p -> 0 <= p ^ nforall (a b : Q) (n : positive), Qpower_positive (a * b) n == Qpower_positive a n * Qpower_positive b ninduction n; simpl; repeat rewrite IHn; ring. Qed.forall (a b : Q) (n : positive), Qpower_positive (a * b) n == Qpower_positive a n * Qpower_positive b nforall (a b : Q) (n : Z), (a * b) ^ n == a ^ n * b ^ nintros a b [|n|n]; simpl; try rewrite Qmult_power_positive; try rewrite Qinv_mult_distr; reflexivity. Qed.forall (a b : Q) (n : Z), (a * b) ^ n == a ^ n * b ^ nforall (a : Q) (n : positive), Qpower_positive (/ a) n == / Qpower_positive a ninduction n; simpl; repeat (rewrite IHn || rewrite Qinv_mult_distr); reflexivity. Qed.forall (a : Q) (n : positive), Qpower_positive (/ a) n == / Qpower_positive a nforall (a : Q) (n : Z), (/ a) ^ n == / a ^ nintros a [|n|n]; simpl; try rewrite Qinv_power_positive; reflexivity. Qed.forall (a : Q) (n : Z), (/ a) ^ n == / a ^ nforall (a b : Q) (n : Z), (a / b) ^ n == a ^ n / b ^ nforall (a b : Q) (n : Z), (a / b) ^ n == a ^ n / b ^ nforall (a b : Q) (n : Z), (a * / b) ^ n == a ^ n * / b ^ na, b:Qn:Z(a * / b) ^ n == a ^ n * / b ^ na, b:Qn:Za ^ n * (/ b) ^ n == a ^ n * / b ^ nreflexivity. Qed.a, b:Qn:Za ^ n * / b ^ n == a ^ n * / b ^ nforall (n : Z) (p : positive), (1 # p) ^ n == / inject_Z (Z.pos p) ^ nforall (n : Z) (p : positive), (1 # p) ^ n == / inject_Z (Z.pos p) ^ nn:Zp:positive(1 # p) ^ n == / inject_Z (Z.pos p) ^ nn:Zp:positive(inject_Z 1 / inject_Z (Z.pos p)) ^ n == / inject_Z (Z.pos p) ^ nn:Zp:positiveinject_Z 1 ^ n / inject_Z (Z.pos p) ^ n == / inject_Z (Z.pos p) ^ nn:Zp:positive1 / inject_Z (Z.pos p) ^ n == / inject_Z (Z.pos p) ^ nring. Qed.n:Zp:positive1 * / inject_Z (Z.pos p) ^ n == / inject_Z (Z.pos p) ^ nforall (a : Q) (n m : positive), Qpower_positive a (n + m) == Qpower_positive a n * Qpower_positive a mforall (a : Q) (n m : positive), Qpower_positive a (n + m) == Qpower_positive a n * Qpower_positive a ma:Qn, m:positiveQpower_positive a (n + m) == Qpower_positive a n * Qpower_positive a ma:Qn, m:positivepow_pos Qmult a (n + m) == pow_pos Qmult a n * pow_pos Qmult a ma:Qn, m:positiveEquivalence (fun q q0 : Q => q == q0)a:Qn, m:positiveProper ((fun q q0 : Q => q == q0) ==> (fun q q0 : Q => q == q0) ==> (fun q q0 : Q => q == q0)) Qmulta:Qn, m:positiveforall x y z : Q, x * (y * z) == x * y * za:Qn, m:positiveProper ((fun q q0 : Q => q == q0) ==> (fun q q0 : Q => q == q0) ==> (fun q q0 : Q => q == q0)) Qmulta:Qn, m:positiveforall x y z : Q, x * (y * z) == x * y * zapply Qmult_assoc. Qed.a:Qn, m:positiveforall x y z : Q, x * (y * z) == x * y * zforall (a : Q) (n : Z), a ^ (- n) == / a ^ nforall (a : Q) (n : Z), a ^ (- n) == / a ^ nsymmetry; apply Qinv_involutive. Qed.a:Qn:positiveQpower_positive a n == / / Qpower_positive a nforall (a : Q) (n m : positive), (m < n)%positive -> Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a mforall (a : Q) (n m : positive), (m < n)%positive -> Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveQpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveEQ:a == 0Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveNEQ:~ a == 0Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a mnow rewrite EQ, !Qpower_positive_0.a:Qn, m:positiveH:(m < n)%positiveEQ:a == 0Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveNEQ:~ a == 0Qpower_positive a (n - m) == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveNEQ:~ a == 0Qpower_positive a (n - m) * Qpower_positive a m / Qpower_positive a m == Qpower_positive a n / Qpower_positive a ma:Qn, m:positiveH:(m < n)%positiveNEQ:~ a == 0Qpower_positive a (n - m) * Qpower_positive a m == Qpower_positive a nnow rewrite Pos.sub_add. Qed.a:Qn, m:positiveH:(m < n)%positiveNEQ:~ a == 0Qpower_positive a (n - m + m) == Qpower_positive a nforall (a : Q) (n m : Z), ~ a == 0 -> a ^ (n + m) == a ^ n * a ^ mintros a [|n|n] [|m|m] H; simpl; try ring; try rewrite Qpower_plus_positive; try apply Qinv_mult_distr; try reflexivity; rewrite ?Z.pos_sub_spec; case Pos.compare_spec; intros H0; simpl; subst; try rewrite Qpower_minus_positive; try (field; try split; apply Qpower_not_0_positive); assumption. Qed.forall (a : Q) (n m : Z), ~ a == 0 -> a ^ (n + m) == a ^ n * a ^ mforall (a : Q) (n m : Z), (n + m)%Z <> 0%Z -> a ^ (n + m) == a ^ n * a ^ mforall (a : Q) (n m : Z), (n + m)%Z <> 0%Z -> a ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%Za ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:a == 0a ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:~ a == 0a ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:a == 00 ^ (n + m) == 0 ^ n * 0 ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:~ a == 0a ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:a == 00 == 0 ^ n * 0 ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:~ a == 0a ^ (n + m) == a ^ n * a ^ ma:Qn, m:ZH:(n + m)%Z <> 0%ZX:~ a == 0a ^ (n + m) == a ^ n * a ^ massumption. Qed.a:Qn, m:ZH:(n + m)%Z <> 0%ZX:~ a == 0~ a == 0forall (a : Q) (n m : positive), Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mforall (a : Q) (n m : positive), Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) ma:Qn, m:positiveQpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) ma:Qm:positiveQpower_positive a (1 * m) == Qpower_positive (Qpower_positive a 1) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a (Pos.succ n * m) == Qpower_positive (Qpower_positive a (Pos.succ n)) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a (Pos.succ n * m) == Qpower_positive (Qpower_positive a (Pos.succ n)) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a (m + n * m) == Qpower_positive (Qpower_positive a (Pos.succ n)) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a (m + n * m) == Qpower_positive (Qpower_positive a (1 + n)) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a m * Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a 1 * Qpower_positive a n) ma:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a m * Qpower_positive (Qpower_positive a n) m == Qpower_positive (Qpower_positive a 1 * Qpower_positive a n) mreflexivity. Qed.a:Qn, m:positiveIHn:Qpower_positive a (n * m) == Qpower_positive (Qpower_positive a n) mQpower_positive a m * Qpower_positive (Qpower_positive a n) m == Qpower_positive (Qpower_positive a 1) m * Qpower_positive (Qpower_positive a n) mforall (a : Q) (n m : Z), a ^ (n * m) == (a ^ n) ^ mintros a [|n|n] [|m|m]; simpl; try rewrite Qpower_positive_1; try rewrite Qpower_mult_positive; try rewrite Qinv_power_positive; try rewrite Qinv_involutive; try reflexivity. Qed.forall (a : Q) (n m : Z), a ^ (n * m) == (a ^ n) ^ mforall a n : Z, (0 <= n)%Z -> inject_Z (a ^ n) == inject_Z a ^ nforall a n : Z, (0 <= n)%Z -> inject_Z (a ^ n) == inject_Z a ^ na:Zn:positiveH:(0 <= Z.pos n)%Zinject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos na:ZH:(0 <= 1)%Zinject_Z (a ^ 1) == inject_Z a ^ 1a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos (Pos.succ n)) == inject_Z a ^ Z.pos (Pos.succ n)a:ZH:(0 <= 1)%Zinject_Z a == inject_Z a ^ 1a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos (Pos.succ n)) == inject_Z a ^ Z.pos (Pos.succ n)a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos (Pos.succ n)) == inject_Z a ^ Z.pos (Pos.succ n)a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.succ (Z.pos n)) == inject_Z a ^ Z.succ (Z.pos n)a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ (Z.pos n + 1)) == inject_Z a ^ (Z.pos n + 1)a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos n * a ^ 1) == inject_Z a ^ (Z.pos n + 1)a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos n * a ^ 1) == inject_Z a ^ Z.pos n * inject_Z a ^ 1a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos n * a ^ 1) == inject_Z (a ^ Z.pos n) * inject_Z a ^ 1a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos n * a) == inject_Z (a ^ Z.pos n) * inject_Z a ^ 1reflexivity. Qed.a:Zn:positiveH:(0 <= Z.pos (Pos.succ n))%ZIHn:(0 <= Z.pos n)%Z -> inject_Z (a ^ Z.pos n) == inject_Z a ^ Z.pos ninject_Z (a ^ Z.pos n * a) == inject_Z (a ^ Z.pos n) * inject_Z aforall a : Q, 0 <= a ^ 2forall a : Q, 0 <= a ^ 2a:Q0 <= a ^ 2a:QA:0 < a0 <= a ^ 2a:QA:a <= 00 <= a ^ 2a:QA:a <= 00 <= a ^ 2a:QA:a <= 00 <= - a * - aa:QA:0 <= 0 + - a0 <= - a * - aapply Qmult_le_0_compat; assumption. Qed.a:QA:0 <= - a0 <= - a * - ap:positivex:Zy:positiveQpower_positive (x # y) p = x ^ Z.pos p # y ^ pp:positivex:Zy:positiveQpower_positive (x # y) p = x ^ Z.pos p # y ^ pp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x # y) * ((x ^ Z.pos p # y ^ p) * (x ^ Z.pos p # y ^ p)) = x ^ Z.pos p~1 # y ^ p~1p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x ^ Z.pos p # y ^ p) * (x ^ Z.pos p # y ^ p) = x ^ Z.pos p~0 # y ^ p~0x:Zy:positivex # y = x ^ 1 # y ^ 1p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x # y) * ((x ^ Z.pos p # y ^ p) * (x ^ Z.pos p # y ^ p)) = x ^ Z.pos p~1 # y ^ p~1p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ px * (x ^ Z.pos p * x ^ Z.pos p) # y * (y ^ p * y ^ p) = x ^ Z.pos p~1 # y ^ p~1p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x * (x ^ Z.pos p * x ^ Z.pos p))%Z = (x ^ Z.pos p~1)%Zp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(y * (y ^ p * y ^ p))%positive = (y ^ p~1)%positivenow rewrite <- Z.pow_twice_r, <- Z.pow_succ_r.p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x * (x ^ Z.pos p * x ^ Z.pos p))%Z = (x ^ Z.pos p~1)%Zp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(y * (y ^ p * y ^ p))%positive = (y ^ p~1)%positivenow rewrite <- Z.pow_twice_r, <- Z.pow_succ_r.p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(Z.pos y * (Z.pos y ^ Z.pos p * Z.pos y ^ Z.pos p))%Z = (Z.pos y ^ Z.pos p~1)%Zp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x ^ Z.pos p # y ^ p) * (x ^ Z.pos p # y ^ p) = x ^ Z.pos p~0 # y ^ p~0p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ px ^ Z.pos p * x ^ Z.pos p # y ^ p * y ^ p = x ^ Z.pos p~0 # y ^ p~0p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x ^ Z.pos p * x ^ Z.pos p)%Z = (x ^ Z.pos p~0)%Zp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(y ^ p * y ^ p)%positive = (y ^ p~0)%positivenow rewrite <- Z.pow_twice_r.p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(x ^ Z.pos p * x ^ Z.pos p)%Z = (x ^ Z.pos p~0)%Zp:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(y ^ p * y ^ p)%positive = (y ^ p~0)%positivenow rewrite <- Z.pow_twice_r.p:positivex:Zy:positiveIHp:Qpower_positive (x # y) p = x ^ Z.pos p # y ^ p(Z.pos y ^ Z.pos p * Z.pos y ^ Z.pos p)%Z = (Z.pos y ^ Z.pos p~0)%Znow rewrite Z.pow_1_r, Pos.pow_1_r. Qed.x:Zy:positivex # y = x ^ 1 # y ^ 1