File: Mathlib/Data/NNRat/Defs.lean

full_name: NNRat.instOrderedSub
code: instance NNRat.instOrderedSub : OrderedSub ℚ≥0 
goal: OrderedSub ℚ≥0

full_name: NNRat.val_eq_cast
code: @[simp] lemma val_eq_cast (q : ℚ≥0) : q.1 = q 
goal: ↑q = ↑q

full_name: NNRat.canLift
code: instance canLift : CanLift ℚ ℚ≥0 (↑) fun q ↦ 0 ≤ q 
goal: CanLift ℚ ℚ≥0 NNRat.cast fun q => 0 ≤ q

full_name: NNRat.ext
code: @[ext]
theorem ext : (p : ℚ) = (q : ℚ) → p = q 
goal: ↑p = ↑q → p = q

full_name: NNRat.coe_injective
code: protected theorem coe_injective : Injective ((↑) : ℚ≥0 → ℚ) 
goal: Function.Injective NNRat.cast

full_name: NNRat.coe_inj
code: @[simp, norm_cast]
theorem coe_inj : (p : ℚ) = q ↔ p = q 
goal: ↑p = ↑q ↔ p = q

full_name: NNRat.ext_iff
code: theorem ext_iff : p = q ↔ (p : ℚ) = q 
goal: p = q ↔ ↑p = ↑q

full_name: NNRat.ne_iff
code: theorem ne_iff {x y : ℚ≥0} : (x : ℚ) ≠ (y : ℚ) ↔ x ≠ y 
goal: ↑x ≠ ↑y ↔ x ≠ y

full_name: NNRat.coe_mk
code: @[simp, norm_cast] lemma coe_mk (q : ℚ) (hq) : NNRat.cast ⟨q, hq⟩ = q 
goal: ↑⟨q, hq⟩ = q

full_name: NNRat.forall
code: lemma «forall» {p : ℚ≥0 → Prop} : (∀ q, p q) ↔ ∀ q hq, p ⟨q, hq⟩ 
goal: (∀ (q : ℚ≥0), p q) ↔ ∀ (q : ℚ) (hq : 0 ≤ q), p ⟨q, hq⟩

full_name: NNRat.exists
code: lemma «exists» {p : ℚ≥0 → Prop} : (∃ q, p q) ↔ ∃ q hq, p ⟨q, hq⟩ 
goal: (∃ q, p q) ↔ ∃ q, ∃ (hq : 0 ≤ q), p ⟨q, hq⟩

full_name: Rat.toNNRat
code: /-- Reinterpret a rational number `q` as a non-negative rational number. Returns `0` if `q ≤ 0`. -/
def _root_.Rat.toNNRat (q : ℚ) : ℚ≥0 
goal: ℚ≥0

full_name: Rat.coe_toNNRat
code: theorem _root_.Rat.coe_toNNRat (q : ℚ) (hq : 0 ≤ q) : (q.toNNRat : ℚ) = q 
goal: ↑q.toNNRat = q

full_name: Rat.le_coe_toNNRat
code: theorem _root_.Rat.le_coe_toNNRat (q : ℚ) : q ≤ q.toNNRat 
goal: q ≤ ↑q.toNNRat

full_name: NNRat.coe_nonneg
code: @[simp]
theorem coe_nonneg (q : ℚ≥0) : (0 : ℚ) ≤ q 
goal: 0 ≤ ↑q

full_name: NNRat.coe_zero
code: @[simp, norm_cast] lemma coe_zero : ((0 : ℚ≥0) : ℚ) = 0 
goal: ↑0 = 0

full_name: NNRat.coe_one
code: @[simp, norm_cast] lemma coe_one : ((1 : ℚ≥0) : ℚ) = 1 
goal: ↑1 = 1

full_name: NNRat.coe_add
code: @[simp, norm_cast]
theorem coe_add (p q : ℚ≥0) : ((p + q : ℚ≥0) : ℚ) = p + q 
goal: ↑(p + q) = ↑p + ↑q

full_name: NNRat.coe_mul
code: @[simp, norm_cast]
theorem coe_mul (p q : ℚ≥0) : ((p * q : ℚ≥0) : ℚ) = p * q 
goal: ↑(p * q) = ↑p * ↑q

full_name: NNRat.coe_pow
code: @[simp, norm_cast] lemma coe_pow (q : ℚ≥0) (n : ℕ) : (↑(q ^ n) : ℚ) = (q : ℚ) ^ n 
goal: ↑(q ^ n) = ↑q ^ n

full_name: NNRat.num_pow
code: @[simp] lemma num_pow (q : ℚ≥0) (n : ℕ) : (q ^ n).num = q.num ^ n 
goal: (q ^ n).num = q.num ^ n

full_name: NNRat.den_pow
code: @[simp] lemma den_pow (q : ℚ≥0) (n : ℕ) : (q ^ n).den = q.den ^ n 
goal: (q ^ n).den = q.den ^ n

full_name: NNRat.coe_sub
code: @[simp, norm_cast]
theorem coe_sub (h : q ≤ p) : ((p - q : ℚ≥0) : ℚ) = p - q 
goal: ↑(p - q) = ↑p - ↑q

full_name: NNRat.coe_eq_zero
code: @[simp]
theorem coe_eq_zero : (q : ℚ) = 0 ↔ q = 0 
goal: ↑q = 0 ↔ q = 0

full_name: NNRat.coe_ne_zero
code: theorem coe_ne_zero : (q : ℚ) ≠ 0 ↔ q ≠ 0 
goal: ↑q ≠ 0 ↔ q ≠ 0

full_name: NNRat.coe_le_coe
code: @[norm_cast] -- Porting note (#10618): simp can prove this
theorem coe_le_coe : (p : ℚ) ≤ q ↔ p ≤ q 
goal: ↑p ≤ ↑q ↔ p ≤ q

full_name: NNRat.coe_lt_coe
code: @[norm_cast] -- Porting note (#10618): simp can prove this
theorem coe_lt_coe : (p : ℚ) < q ↔ p < q 
goal: ↑p < ↑q ↔ p < q

full_name: NNRat.coe_pos
code: @[simp, norm_cast, nolint simpNF]
theorem coe_pos : (0 : ℚ) < q ↔ 0 < q 
goal: 0 < ↑q ↔ 0 < q

full_name: NNRat.coe_mono
code: theorem coe_mono : Monotone ((↑) : ℚ≥0 → ℚ) 
goal: Monotone NNRat.cast

full_name: NNRat.toNNRat_mono
code: theorem toNNRat_mono : Monotone toNNRat 
goal: Monotone Rat.toNNRat

full_name: NNRat.toNNRat_coe
code: @[simp]
theorem toNNRat_coe (q : ℚ≥0) : toNNRat q = q 
goal: (↑q).toNNRat = q

full_name: NNRat.toNNRat_coe_nat
code: @[simp]
theorem toNNRat_coe_nat (n : ℕ) : toNNRat n = n 
goal: (↑n).toNNRat = ↑n

full_name: NNRat.gi
code: /-- `toNNRat` and `(↑) : ℚ≥0 → ℚ` form a Galois insertion. -/
protected def gi : GaloisInsertion toNNRat (↑) 
goal: GaloisInsertion Rat.toNNRat NNRat.cast

full_name: NNRat.coeHom
code: /-- Coercion `ℚ≥0 → ℚ` as a `RingHom`. -/
def coeHom : ℚ≥0 →+* ℚ 
goal: ℚ≥0 →+* ℚ

full_name: NNRat.coe_natCast
code: @[simp, norm_cast] lemma coe_natCast (n : ℕ) : (↑(↑n : ℚ≥0) : ℚ) = n 
goal: ↑↑n = ↑n

full_name: NNRat.mk_natCast
code: @[simp]
theorem mk_natCast (n : ℕ) : @Eq ℚ≥0 (⟨(n : ℚ), n.cast_nonneg⟩ : ℚ≥0) n 
goal: ⟨↑n, ⋯⟩ = ↑n

full_name: NNRat.coe_coeHom
code: @[simp]
theorem coe_coeHom : ⇑coeHom = ((↑) : ℚ≥0 → ℚ) 
goal: ⇑NNRat.coeHom = NNRat.cast

full_name: NNRat.nsmul_coe
code: @[norm_cast]
theorem nsmul_coe (q : ℚ≥0) (n : ℕ) : ↑(n • q) = n • (q : ℚ) 
goal: ↑(n • q) = n • ↑q

full_name: NNRat.bddAbove_coe
code: theorem bddAbove_coe {s : Set ℚ≥0} : BddAbove ((↑) '' s : Set ℚ) ↔ BddAbove s 
goal: BddAbove (NNRat.cast '' s) ↔ BddAbove s

full_name: NNRat.bddBelow_coe
code: theorem bddBelow_coe (s : Set ℚ≥0) : BddBelow (((↑) : ℚ≥0 → ℚ) '' s) 
goal: BddBelow (NNRat.cast '' s)

full_name: NNRat.coe_max
code: @[simp, norm_cast, nolint simpNF]
theorem coe_max (x y : ℚ≥0) : ((max x y : ℚ≥0) : ℚ) = max (x : ℚ) (y : ℚ) 
goal: ↑(max x y) = max ↑x ↑y

full_name: NNRat.coe_min
code: @[simp, norm_cast, nolint simpNF]
theorem coe_min (x y : ℚ≥0) : ((min x y : ℚ≥0) : ℚ) = min (x : ℚ) (y : ℚ) 
goal: ↑(min x y) = min ↑x ↑y

full_name: NNRat.sub_def
code: theorem sub_def (p q : ℚ≥0) : p - q = toNNRat (p - q) 
goal: p - q = (↑p - ↑q).toNNRat

full_name: NNRat.abs_coe
code: @[simp]
theorem abs_coe (q : ℚ≥0) : |(q : ℚ)| = q 
goal: |↑q| = ↑q

full_name: Rat.toNNRat_zero
code: @[simp]
theorem toNNRat_zero : toNNRat 0 = 0 
goal: Rat.toNNRat 0 = 0

full_name: Rat.toNNRat_one
code: @[simp]
theorem toNNRat_one : toNNRat 1 = 1 
goal: Rat.toNNRat 1 = 1

full_name: Rat.toNNRat_pos
code: @[simp]
theorem toNNRat_pos : 0 < toNNRat q ↔ 0 < q 
goal: 0 < q.toNNRat ↔ 0 < q

full_name: Rat.toNNRat_eq_zero
code: @[simp]
theorem toNNRat_eq_zero : toNNRat q = 0 ↔ q ≤ 0 
goal: q.toNNRat = 0 ↔ q ≤ 0

full_name: Rat.toNNRat_le_toNNRat_iff
code: @[simp]
theorem toNNRat_le_toNNRat_iff (hp : 0 ≤ p) : toNNRat q ≤ toNNRat p ↔ q ≤ p 
goal: q.toNNRat ≤ p.toNNRat ↔ q ≤ p

full_name: Rat.toNNRat_lt_toNNRat_iff'
code: @[simp]
theorem toNNRat_lt_toNNRat_iff' : toNNRat q < toNNRat p ↔ q < p ∧ 0 < p 
goal: q.toNNRat < p.toNNRat ↔ q < p ∧ 0 < p

full_name: Rat.toNNRat_lt_toNNRat_iff
code: theorem toNNRat_lt_toNNRat_iff (h : 0 < p) : toNNRat q < toNNRat p ↔ q < p 
goal: q.toNNRat < p.toNNRat ↔ q < p

full_name: Rat.toNNRat_lt_toNNRat_iff_of_nonneg
code: theorem toNNRat_lt_toNNRat_iff_of_nonneg (hq : 0 ≤ q) : toNNRat q < toNNRat p ↔ q < p 
goal: q.toNNRat < p.toNNRat ↔ q < p

full_name: Rat.toNNRat_add
code: @[simp]
theorem toNNRat_add (hq : 0 ≤ q) (hp : 0 ≤ p) : toNNRat (q + p) = toNNRat q + toNNRat p 
goal: (q + p).toNNRat = q.toNNRat + p.toNNRat

full_name: Rat.toNNRat_add_le
code: theorem toNNRat_add_le : toNNRat (q + p) ≤ toNNRat q + toNNRat p 
goal: (q + p).toNNRat ≤ q.toNNRat + p.toNNRat

full_name: Rat.toNNRat_le_iff_le_coe
code: theorem toNNRat_le_iff_le_coe {p : ℚ≥0} : toNNRat q ≤ p ↔ q ≤ ↑p 
goal: q.toNNRat ≤ p ↔ q ≤ ↑p

full_name: Rat.le_toNNRat_iff_coe_le
code: theorem le_toNNRat_iff_coe_le {q : ℚ≥0} (hp : 0 ≤ p) : q ≤ toNNRat p ↔ ↑q ≤ p 
goal: q ≤ p.toNNRat ↔ ↑q ≤ p

full_name: Rat.le_toNNRat_iff_coe_le'
code: theorem le_toNNRat_iff_coe_le' {q : ℚ≥0} (hq : 0 < q) : q ≤ toNNRat p ↔ ↑q ≤ p 
goal: q ≤ p.toNNRat ↔ ↑q ≤ p

full_name: Rat.toNNRat_lt_iff_lt_coe
code: theorem toNNRat_lt_iff_lt_coe {p : ℚ≥0} (hq : 0 ≤ q) : toNNRat q < p ↔ q < ↑p 
goal: q.toNNRat < p ↔ q < ↑p

full_name: Rat.lt_toNNRat_iff_coe_lt
code: theorem lt_toNNRat_iff_coe_lt {q : ℚ≥0} : q < toNNRat p ↔ ↑q < p 
goal: q < p.toNNRat ↔ ↑q < p

full_name: Rat.toNNRat_mul
code: theorem toNNRat_mul (hp : 0 ≤ p) : toNNRat (p * q) = toNNRat p * toNNRat q 
goal: (p * q).toNNRat = p.toNNRat * q.toNNRat

full_name: Rat.nnabs
code: /-- The absolute value on `ℚ` as a map to `ℚ≥0`. -/
@[pp_nodot]
def Rat.nnabs (x : ℚ) : ℚ≥0 
goal: ℚ≥0

full_name: Rat.coe_nnabs
code: @[norm_cast, simp]
theorem Rat.coe_nnabs (x : ℚ) : (Rat.nnabs x : ℚ) = abs x 
goal: ↑(Rat.nnabs x) = |x|

full_name: NNRat.num_coe
code: @[norm_cast] lemma num_coe (q : ℚ≥0) : (q : ℚ).num = q.num 
goal: (↑q).num = ↑q.num

full_name: NNRat.natAbs_num_coe
code: theorem natAbs_num_coe : (q : ℚ).num.natAbs = q.num 
goal: (↑q).num.natAbs = q.num

full_name: NNRat.den_coe
code: @[norm_cast] lemma den_coe : (q : ℚ).den = q.den 
goal: (↑q).den = q.den

full_name: NNRat.num_ne_zero
code: @[simp] lemma num_ne_zero : q.num ≠ 0 ↔ q ≠ 0 
goal: q.num ≠ 0 ↔ q ≠ 0

full_name: NNRat.num_pos
code: @[simp] lemma num_pos : 0 < q.num ↔ 0 < q 
goal: 0 < q.num ↔ 0 < q

full_name: NNRat.den_pos
code: @[simp] lemma den_pos (q : ℚ≥0) : 0 < q.den 
goal: 0 < q.den

full_name: NNRat.den_ne_zero
code: @[simp] lemma den_ne_zero (q : ℚ≥0) : q.den ≠ 0 
goal: q.den ≠ 0

full_name: NNRat.coprime_num_den
code: lemma coprime_num_den (q : ℚ≥0) : q.num.Coprime q.den 
goal: q.num.Coprime q.den

full_name: NNRat.num_natCast
code: @[simp, norm_cast] lemma num_natCast (n : ℕ) : num n = n 
goal: (↑n).num = n

full_name: NNRat.den_natCast
code: @[simp, norm_cast] lemma den_natCast (n : ℕ) : den n = 1 
goal: (↑n).den = 1

full_name: NNRat.num_ofNat
code: @[simp] lemma num_ofNat (n : ℕ) [n.AtLeastTwo] : num (no_index (OfNat.ofNat n)) = OfNat.ofNat n 
goal: (OfNat.ofNat n).num = OfNat.ofNat n

full_name: NNRat.den_ofNat
code: @[simp] lemma den_ofNat (n : ℕ) [n.AtLeastTwo] : den (no_index (OfNat.ofNat n)) = 1 
goal: (OfNat.ofNat n).den = 1

full_name: NNRat.ext_num_den
code: theorem ext_num_den (hn : p.num = q.num) (hd : p.den = q.den) : p = q 
goal: p = q

full_name: NNRat.ext_num_den_iff
code: theorem ext_num_den_iff : p = q ↔ p.num = q.num ∧ p.den = q.den 
goal: p = q ↔ p.num = q.num ∧ p.den = q.den

full_name: NNRat.divNat
code: /-- Form the quotient `n / d` where `n d : ℕ`.

See also `Rat.divInt` and `mkRat`. -/
def divNat (n d : ℕ) : ℚ≥0 
goal: ℚ≥0

full_name: NNRat.coe_divNat
code: @[simp, norm_cast] lemma coe_divNat (n d : ℕ) : (divNat n d : ℚ) = .divInt n d 
goal: ↑(NNRat.divNat n d) = Rat.divInt ↑n ↑d

full_name: NNRat.mk_divInt
code: lemma mk_divInt (n d : ℕ) :
    ⟨.divInt n d, Rat.divInt_nonneg n.cast_nonneg d.cast_nonneg⟩ = divNat n d 
goal: ⟨Rat.divInt ↑n ↑d, ⋯⟩ = NNRat.divNat n d

full_name: NNRat.divNat_inj
code: lemma divNat_inj (h₁ : d₁ ≠ 0) (h₂ : d₂ ≠ 0) : divNat n₁ d₁ = divNat n₂ d₂ ↔ n₁ * d₂ = n₂ * d₁ 
goal: NNRat.divNat n₁ d₁ = NNRat.divNat n₂ d₂ ↔ n₁ * d₂ = n₂ * d₁

full_name: NNRat.divNat_zero
code: @[simp] lemma divNat_zero (n : ℕ) : divNat n 0 = 0 
goal: NNRat.divNat n 0 = 0

full_name: NNRat.num_divNat_den
code: @[simp] lemma num_divNat_den (q : ℚ≥0) : divNat q.num q.den = q 
goal: NNRat.divNat q.num q.den = q

full_name: NNRat.natCast_eq_divNat
code: lemma natCast_eq_divNat (n : ℕ) : (n : ℚ≥0) = divNat n 1 
goal: ↑n = NNRat.divNat n 1

full_name: NNRat.divNat_mul_divNat
code: lemma divNat_mul_divNat (n₁ n₂ : ℕ) {d₁ d₂} (hd₁ : d₁ ≠ 0) (hd₂ : d₂ ≠ 0) :
    divNat n₁ d₁ * divNat n₂ d₂ = divNat (n₁ * n₂) (d₁ * d₂) 
goal: NNRat.divNat n₁ d₁ * NNRat.divNat n₂ d₂ = NNRat.divNat (n₁ * n₂) (d₁ * d₂)

full_name: NNRat.divNat_mul_left
code: lemma divNat_mul_left {a : ℕ} (ha : a ≠ 0) (n d : ℕ) : divNat (a * n) (a * d) = divNat n d 
goal: NNRat.divNat (a * n) (a * d) = NNRat.divNat n d

full_name: NNRat.divNat_mul_right
code: lemma divNat_mul_right {a : ℕ} (ha : a ≠ 0) (n d : ℕ) : divNat (n * a) (d * a) = divNat n d 
goal: NNRat.divNat (n * a) (d * a) = NNRat.divNat n d

full_name: NNRat.mul_den_eq_num
code: @[simp] lemma mul_den_eq_num (q : ℚ≥0) : q * q.den = q.num 
goal: q * ↑q.den = ↑q.num

full_name: NNRat.den_mul_eq_num
code: @[simp] lemma den_mul_eq_num (q : ℚ≥0) : q.den * q = q.num 
goal: ↑q.den * q = ↑q.num

full_name: NNRat.numDenCasesOn
code: /-- Define a (dependent) function or prove `∀ r : ℚ, p r` by dealing with nonnegative rational
numbers of the form `n / d` with `d ≠ 0` and `n`, `d` coprime. -/
@[elab_as_elim]
def numDenCasesOn.{u} {C : ℚ≥0 → Sort u} (q) (H : ∀ n d, d ≠ 0 → n.Coprime d → C (divNat n d)) :
    C q 
goal: C q

full_name: NNRat.add_def
code: lemma add_def (q r : ℚ≥0) : q + r = divNat (q.num * r.den + r.num * q.den) (q.den * r.den) 
goal: q + r = NNRat.divNat (q.num * r.den + r.num * q.den) (q.den * r.den)

full_name: NNRat.mul_def
code: lemma mul_def (q r : ℚ≥0) : q * r = divNat (q.num * r.num) (q.den * r.den) 
goal: q * r = NNRat.divNat (q.num * r.num) (q.den * r.den)

full_name: NNRat.lt_def
code: theorem lt_def {p q : ℚ≥0} : p < q ↔ p.num * q.den < q.num * p.den 
goal: p < q ↔ p.num * q.den < q.num * p.den

full_name: NNRat.le_def
code: theorem le_def {p q : ℚ≥0} : p ≤ q ↔ p.num * q.den ≤ q.num * p.den 
goal: p ≤ q ↔ p.num * q.den ≤ q.num * p.den