Mode of #cas
numerator
Gives the numerator of a rational expression brought to one fraction, with the conditions of the identity.
#cas [numerator] etogether makes of the rational expression e, with the conditions under which equals e.numerator brings a rational expression to one fraction and gives you its numerator. A numerator means little until you know which fraction it belongs to, so the theorem is the one of together: the report says which fraction that is and where it equals the input.
Lean’s division is total (), so the identity holds where the divisors of are nonzero, and the conditions say so. At a zero of a divisor, the numerator tells you nothing about .
Examples (10)#
Basic Examples (2)
The numerator of :
#cas [numerator] (1/x + 1/y)
numerator
x + y- Input (rational function)
(1/x + 1/y)- Conditions
- ,
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)
The numerator is expanded:
#cas [numerator] (x/(x^2 - 1) + 1/(x + 1))
numerator
2*x - 1- Input (rational function)
(x/(x^2 - 1) + 1/(x + 1))- Conditions
- ,
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x : ℝ), x ^ 2 - 1 ≠ 0 → x + 1 ≠ 0 → x / (x ^ 2 - 1) + 1 / (x + 1) = (2 * x - 1) / ((x + 1) * (x - 1))
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x : ℝ), x ^ 2 - 1 ≠ 0 → x + 1 ≠ 0 → x / (x ^ 2 - 1) + 1 / (x + 1) = (2 * x - 1) / ((x + 1) * (x - 1))
Scope (2)
The fraction is in lowest terms first, so the common factor is gone:
#cas [numerator] ((x^3 - y^3)/(x^2 - y^2))
numerator
x^2 + x*y + y^2- Input (rational function)
((x^3 - y^3)/(x^2 - y^2))- Conditions
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x y : ℝ), x ^ 2 - y ^ 2 ≠ 0 → (x ^ 3 - y ^ 3) / (x ^ 2 - y ^ 2) = (x ^ 2 + x * y + y ^ 2) / (x + y)
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x y : ℝ), x ^ 2 - y ^ 2 ≠ 0 → (x ^ 3 - y ^ 3) / (x ^ 2 - y ^ 2) = (x ^ 2 + x * y + y ^ 2) / (x + y)
Numbers as divisors:
#cas [numerator] (x/2 + y/3)
numerator
3*x + 2*y- Input (rational function)
(x/2 + y/3)
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6
Applications (2)
Multiplying by the denominator clears the fractions. The theorem needs both conditions, and only the three standard axioms are used:
theorem numerator_cleared (x y : ℝ) (hx : x ≠ 0) (hy : y ≠ 0) : (1 / x + 1 / y) * (x * y) = x + y := by cas #print axioms numerator_cleared
numerator_cleared depends on the axioms propext, Classical.choice, Quot.sound.
The numerator of the second example vanishes at , where no divisor does, and so the expression vanishes there:
example : (1 / 2 : ℝ) / ((1 / 2) ^ 2 - 1) + 1 / (1 / 2 + 1) = 0 := by norm_num
Lean accepts the proof.
Properties and Relations (2)
together prints the whole fraction, with the same theorem:
#cas [together] (1/x + 1/y)
common denominator
(x + y)/(x*y)- Input (rational function)
(1/x + 1/y)- Conditions
- ,
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)
denominator gives the other part. For it is :
#cas [denominator] (x/2 + y/3)
denominator
6- Input (rational function)
(x/2 + y/3)
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6
Possible Issues (2)
Only rational expressions are accepted. simplify accepts sqrt:
#cas [numerator] (sqrt x / x)
Error
numerator: the expression is not a rational function: it has a function other than the field operations and natural powers
A divisor must be a polynomial. Multiply the inner fraction out first. For the expression is :
#cas [numerator] (1/(1 + 1/x))
Error
numerator: a divisor is itself a quotient; write the expression with polynomial divisors
