Nonnegative rationals #
THIS FILE IS SYNCHRONIZED WITH MATHLIB4. Any changes to this file require a corresponding PR to mathlib4.
This file defines the nonnegative rationals as a subtype of rat and provides its algebraic order
structure.
We also define an instance can_lift ℚ ℚ≥0. This instance can be used by the lift tactic to
replace x : ℚ and hx : 0 ≤ x in the proof context with x : ℚ≥0 while replacing all occurences
of x with ↑x. This tactic also works for a function f : α → ℚ with a hypothesis
hf : ∀ x, 0 ≤ f x.
Notation #
Nonnegative rational numbers.
Instances for nnrat
- nnrat.canonically_ordered_comm_semiring
- nnrat.canonically_linear_ordered_semifield
- nnrat.linear_ordered_comm_group_with_zero
- nnrat.has_sub
- nnrat.has_ordered_sub
- nnrat.densely_ordered
- nnrat.archimedean
- nnrat.inhabited
- nnrat.rat.has_coe
- nnrat.can_lift
- nnrat.rat.algebra
- nnrat.mul_action
- nnrat.distrib_mul_action
- nnrat.module
Equations
- nnrat.rat.has_coe = {coe := subtype.val (λ (q : ℚ), 0 ≤ q)}
Reinterpret a rational number q as a non-negative rational number. Returns 0 if q ≤ 0.
Equations
- q.to_nnrat = ⟨linear_order.max q 0, _⟩
to_nnrat and coe : ℚ≥0 → ℚ form a Galois insertion.
Coercion ℚ≥0 → ℚ as a ring_hom.
Equations
- nnrat.coe_hom = {to_fun := coe coe_to_lift, map_one' := nnrat.coe_one, map_mul' := nnrat.coe_mul, map_zero' := nnrat.coe_zero, map_add' := nnrat.coe_add}
The rational numbers are an algebra over the non-negative rationals.
Equations
A distrib_mul_action over ℚ restricts to a distrib_mul_action over ℚ≥0.
Alias of the reverse direction of rat.to_nnrat_eq_zero.