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 Export Field. Require Export QArith_base. Require Import NArithRing.
ring_theory 0 1 Qplus Qmult Qminus Qopp Qeqring_theory 0 1 Qplus Qmult Qminus Qopp Qeqforall x : Q, 0 + x == xforall x y : Q, x + y == y + xforall x y z : Q, x + (y + z) == x + y + zforall x : Q, 1 * x == xforall x y : Q, x * y == y * xforall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y : Q, x + y == y + xforall x y z : Q, x + (y + z) == x + y + zforall x : Q, 1 * x == xforall x y : Q, x * y == y * xforall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y z : Q, x + (y + z) == x + y + zforall x : Q, 1 * x == xforall x y : Q, x * y == y * xforall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x : Q, 1 * x == xforall x y : Q, x * y == y * xforall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y : Q, x * y == y * xforall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y z : Q, x * (y * z) == x * y * zforall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x - y == x + - yforall x : Q, x + - x == 0forall x y : Q, x - y == x + - yforall x : Q, x + - x == 0exact Qplus_opp_r. Qed.forall x : Q, x + - x == 0field_theory 0 1 Qplus Qmult Qminus Qopp Qdiv Qinv Qeqfield_theory 0 1 Qplus Qmult Qminus Qopp Qdiv Qinv Qeqring_theory 0 1 Qplus Qmult Qminus Qopp Qeq~ 1 == 0forall p q : Q, p / q == p * / qforall p : Q, ~ p == 0 -> / p * p == 1~ 1 == 0forall p q : Q, p / q == p * / qforall p : Q, ~ p == 0 -> / p * p == 1forall p q : Q, p / q == p * / qforall p : Q, ~ p == 0 -> / p * p == 1forall p : Q, ~ p == 0 -> / p * p == 1p:QHp:~ p == 0/ p * p == 1p:QHp:~ p == 0p * / p == 1exact Hp. Qed.p:QHp:~ p == 0~ p == 0power_theory 1 Qmult Qeq Z.of_N Qpowerpower_theory 1 Qmult Qeq Z.of_N Qpowerintros r [|n]; reflexivity. Qed. Ltac isQcst t := match t with | inject_Z ?z => isZcst z | Qmake ?n ?d => match isZcst n with true => isPcst d | _ => false end | _ => false end. Ltac Qcst t := match isQcst t with true => t | _ => NotConstant end. Ltac Qpow_tac t := match t with | Z0 => N0 | Zpos ?n => Ncst (Npos n) | Z.of_N ?n => Ncst n | NtoZ ?n => Ncst n | _ => NotConstant end. Add Field Qfield : Qsft (decidable Qeq_bool_eq, completeness Qeq_eq_bool, constants [Qcst], power_tac Qpower_theory [Qpow_tac]).forall (r : Q) (n : N), r ^ Z.of_N n == pow_N 1 Qmult r n
Exemple of use:
Section Examples.forall x y z : Q, (x + y) * z == x * z + y * zring. Qed.x, y, z:Q(x + y) * z == x * z + y * zex1:forall x y z : Q, (x + y) * z == x * z + y * zforall x y : Q, x + y == y + xring. Qed.ex1:forall x0 y0 z : Q, (x0 + y0) * z == x0 * z + y0 * zx, y:Qx + y == y + xex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xforall x y z : Q, x + y + z == x + (y + z)ring. Qed.ex1:forall x0 y0 z0 : Q, (x0 + y0) * z0 == x0 * z0 + y0 * z0ex2:forall x0 y0 : Q, x0 + y0 == y0 + x0x, y, z:Qx + y + z == x + (y + z)ring. Qed.ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)inject_Z 1 + inject_Z 1 == inject_Z 2ring. Qed.ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 21 + 1 == 2ring. Qed.ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5:1 + 1 == 21 + 1 == 2ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2forall x : Q, x - x == 0ring. Qed.ex1:forall x0 y z : Q, (x0 + y) * z == x0 * z + y * zex2:forall x0 y : Q, x0 + y == y + x0ex3:forall x0 y z : Q, x0 + y + z == x0 + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2x:Qx - x == 0ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x : Q, x - x == 0forall x : Q, x ^ 1 == xring. Qed.ex1:forall x0 y z : Q, (x0 + y) * z == x0 * z + y * zex2:forall x0 y : Q, x0 + y == y + x0ex3:forall x0 y z : Q, x0 + y + z == x0 + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x0 : Q, x0 - x0 == 0x:Qx ^ 1 == xex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x : Q, x - x == 0ex8:forall x : Q, x ^ 1 == xforall x : Q, x ^ 0 == 1ring. Qed.ex1:forall x0 y z : Q, (x0 + y) * z == x0 * z + y * zex2:forall x0 y : Q, x0 + y == y + x0ex3:forall x0 y z : Q, x0 + y + z == x0 + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x0 : Q, x0 - x0 == 0ex8:forall x0 : Q, x0 ^ 1 == x0x:Qx ^ 0 == 1ex1:forall x y z : Q, (x + y) * z == x * z + y * zex2:forall x y : Q, x + y == y + xex3:forall x y z : Q, x + y + z == x + (y + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x : Q, x - x == 0ex8:forall x : Q, x ^ 1 == xex9:forall x : Q, x ^ 0 == 1forall x y : Q, ~ y == 0 -> x / y * y == xex1:forall x0 y0 z : Q, (x0 + y0) * z == x0 * z + y0 * zex2:forall x0 y0 : Q, x0 + y0 == y0 + x0ex3:forall x0 y0 z : Q, x0 + y0 + z == x0 + (y0 + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x0 : Q, x0 - x0 == 0ex8:forall x0 : Q, x0 ^ 1 == x0ex9:forall x0 : Q, x0 ^ 0 == 1x, y:QH:~ y == 0x / y * y == xauto. Qed. End Examples.ex1:forall x0 y0 z : Q, (x0 + y0) * z == x0 * z + y0 * zex2:forall x0 y0 : Q, x0 + y0 == y0 + x0ex3:forall x0 y0 z : Q, x0 + y0 + z == x0 + (y0 + z)ex4:inject_Z 1 + inject_Z 1 == inject_Z 2ex5, ex6:1 + 1 == 2ex7:forall x0 : Q, x0 - x0 == 0ex8:forall x0 : Q, x0 ^ 1 == x0ex9:forall x0 : Q, x0 ^ 0 == 1x, y:QH:~ y == 0~ y == 0forall a b : Q, - (a + b) == - a + - bintros; ring. Qed.forall a b : Q, - (a + b) == - a + - bforall q : Q, - - q == qintros; ring. Qed.forall q : Q, - - q == q