Definition addq (x y : rat) := nosimpl fracq (addq_subdef (valq x) (valq y)).Definition oppq (x : rat) := nosimpl fracq (oppq_subdef (valq x)).Fact addq_subdefC : commutative addq_subdef.Fact addq_subdefA : associative addq_subdef.Fact oppq_frac x : oppq (fracq x) = fracq (oppq_subdef x).Fact addqC : commutative addq.Fact addqA : associative addq.Fact add0q : left_id zeroq addq.Fact addNq : left_inverse (fracq (0, 1)) oppq addq.Definition rat_ZmodMixin := ZmodMixin addqA addqC add0q addNq.Canonical rat_ZmodType := ZmodType rat rat_ZmodMixin.Definition mulq (x y : rat) := nosimpl fracq (mulq_subdef (valq x) (valq y)).Fact mulq_subdefC : commutative mulq_subdef.Fact mul_subdefA : associative mulq_subdef.Definition invq (x : rat) := nosimpl fracq (invq_subdef (valq x)).Fact mulq_frac x y : (mulq (fracq x) (fracq y)) = fracq (mulq_subdef x y).Fact mulqC : commutative mulq.Fact mulqA : associative mulq.Fact mul1q : left_id oneq mulq.Fact mulq_addl : left_distributive mulq addq.Definition rat_comRingMixin :=
  ComRingMixin mulqA mulqC mul1q mulq_addl nonzero1q.Canonical rat_Ring := Eval hnf in RingType rat rat_comRingMixin.Canonical rat_comRing := Eval hnf in ComRingType rat mulqC.Fact invq0 : invq 0 = 0.Definition RatFieldUnitMixin := FieldUnitMixin mulVq invq0.Canonical rat_unitRing :=
  Eval hnf in UnitRingType rat RatFieldUnitMixin.Fact rat_field_axiom : GRing.Field.mixin_of rat_unitRing.Definition RatFieldIdomainMixin := (FieldIdomainMixin rat_field_axiom).Canonical rat_iDomain :=
  Eval hnf in IdomainType rat (FieldIdomainMixin rat_field_axiom).Canonical rat_fieldType := FieldType rat rat_field_axiom.Definition subq (x y : rat) : rat := (addq x (oppq y)).Definition divq (x y : rat) : rat := (mulq x (invq y)).Infix "/" := divq : rat_scope.

Lemma ratP x : rat_spec x (numq x) (denq x).