The definition of the Rational Numbers #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
Summary #
We define a rational number q
as a structure { num, denom, pos, cop }
, where
num
is the numerator ofq
,denom
is the denominator ofq
,pos
is a proof thatdenom > 0
, andcop
is a proofnum
anddenom
are coprime.
Basic constructions and results are set up in data.rat.defs
.
As we transition to Lean 4, these two files can probably be merged again,
as so much of the needed material will be in Std4 anyway.
For now, this split allows us to give the definitions of division rings and fields without significant theory imports.
The definition of the field structure on ℚ
will be done in data.rat.basic
once the
field
class has been defined.
Main Definitions #
rat
is the structure encodingℚ
.
Notations #
Tags #
rat, rationals, field, ℚ, numerator, denominator, num, denom
rat
, or ℚ
, is the type of rational numbers. It is defined
as the set of pairs ⟨n, d⟩ of integers such that d
is positive and n
and
d
are coprime. This representation is preferred to the quotient
because without periodic reduction, the numerator and denominator can grow
exponentially (for example, adding 1/2 to itself repeatedly).
Instances for rat
- rat.smul_division_ring
- rat.distrib_smul
- rat.cast_coe
- rat.has_sizeof_inst
- rat.has_repr
- rat.has_to_string
- rat.has_to_format
- rat.has_int_cast
- rat.has_zero
- rat.has_one
- rat.inhabited
- rat.has_add
- rat.has_neg
- rat.has_mul
- rat.has_inv
- rat.has_div
- rat.comm_ring
- rat.comm_group_with_zero
- rat.is_domain
- rat.nontrivial
- rat.comm_semiring
- rat.semiring
- rat.add_comm_group
- rat.add_group
- rat.add_comm_monoid
- rat.add_monoid
- rat.add_left_cancel_semigroup
- rat.add_right_cancel_semigroup
- rat.add_comm_semigroup
- rat.add_semigroup
- rat.comm_monoid
- rat.monoid
- rat.comm_semigroup
- rat.semigroup
- rat.can_lift
- rat.field
- rat.division_ring
- rat.has_le
- rat.linear_order
- rat.has_lt
- rat.distrib_lattice
- rat.lattice
- rat.semilattice_inf
- rat.semilattice_sup
- rat.has_inf
- rat.has_sup
- rat.partial_order
- rat.preorder
- rat.linear_ordered_field
- rat.linear_ordered_comm_ring
- rat.linear_ordered_ring
- rat.ordered_ring
- rat.linear_ordered_semiring
- rat.ordered_semiring
- rat.linear_ordered_add_comm_group
- rat.ordered_add_comm_group
- rat.ordered_cancel_add_comm_monoid
- rat.ordered_add_comm_monoid
- rat.is_scalar_tower_right
- rat.reflect
- is_scalar_tower.rat
- smul_comm_class.rat
- smul_comm_class.rat'
- algebra_rat
- self_adjoint.has_qsmul
- rat.floor_ring
- rat.archimedean
- subfield_class.has_smul
- rat.metric_space
- rat.noncompact_space
- rat.uniform_add_group
- rat.topological_add_group
- rat.order_topology
- rat.topological_ring
- rat.normed_add_comm_group
- rat.normed_field
- rat.densely_normed_field
- normed_algebra_rat
- division_ring.has_continuous_const_smul_rat
- rat.normed_linear_ordered_field
- rat.is_fraction_ring
Equations
- rat.has_repr = {repr := rat.repr}