Mode of #cas
denominator
Gives the factored denominator of a rational expression brought to one fraction, with the conditions of the identity.
#cas [denominator] etogether makes of the rational expression e, with the conditions under which equals e.denominator puts a rational expression over a common denominator and gives you that denominator. The theorem is the one of together, so what is proved is the whole identity .
The denominator stays factored as far as the input factors it. The conditions come from the divisors of the input: Lean’s division is total (), so can fail where a divisor vanishes, and the theorem has the hypothesis that none of them does.
Examples (10)#
Basic Examples (2)
A difference of two reciprocals:
#cas [denominator] (1/(x-1) - 1/(x+1))
denominator
(x - 1)*(x + 1)- Input (rational function)
(1/(x-1) - 1/(x+1))- Conditions
- ,
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x : ℝ), x - 1 ≠ 0 → x + 1 ≠ 0 → 1 / (x - 1) - 1 / (x + 1) = 2 / ((x - 1) * (x + 1))
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x : ℝ), x - 1 ≠ 0 → x + 1 ≠ 0 → 1 / (x - 1) - 1 / (x + 1) = 2 / ((x - 1) * (x + 1))
With numbers as divisors, the denominator is a number and there is no condition:
#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
Scope (2)
The denominator is not the product of the divisors. Here and share the factor , which appears once:
#cas [denominator] (1/(x^2-1) + 1/(x-1))
denominator
(x - 1)*(x + 1)- Input (rational function)
(1/(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 → 1 / (x ^ 2 - 1) + 1 / (x - 1) = (x + 2) / ((x - 1) * (x + 1))
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x : ℝ), x ^ 2 - 1 ≠ 0 → x - 1 ≠ 0 → 1 / (x ^ 2 - 1) + 1 / (x - 1) = (x + 2) / ((x - 1) * (x + 1))
The gcd of the two divisors splits , so the denominator is a product of and :
#cas [denominator] (x/(x^2 - 1) + 1/(x + 1))
denominator
(x + 1)*(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))
Applications (1)
The first example as a theorem, with a hypothesis for each divisor. Only the three standard axioms are used:
theorem difference_of_reciprocals (x : ℝ) (h₁ : x - 1 ≠ 0) (h₂ : x + 1 ≠ 0) : 1 / (x - 1) - 1 / (x + 1) = 2 / ((x - 1) * (x + 1)) := by cas #print axioms difference_of_reciprocals
difference_of_reciprocals depends on the axioms propext, Classical.choice, Quot.sound.
Properties and Relations (3)
numerator gives the other part of the same fraction:
#cas [numerator] (1/(x-1) - 1/(x+1))
numerator
2- Input (rational function)
(1/(x-1) - 1/(x+1))- Conditions
- ,
Checked by Lean’s kernel: Identity with the common-denominator form
∀ (x : ℝ), x - 1 ≠ 0 → x + 1 ≠ 0 → 1 / (x - 1) - 1 / (x + 1) = 2 / ((x - 1) * (x + 1))
The certificate: 1 checked step
Identity with the common-denominator form
∀ (x : ℝ), x - 1 ≠ 0 → x + 1 ≠ 0 → 1 / (x - 1) - 1 / (x + 1) = 2 / ((x - 1) * (x + 1))
together prints the whole fraction:
#cas [together] (x/2 + y/3)
common denominator
(3*x + 2*y)/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
apart goes back to partial fractions over the factors of the denominator:
#cas [apart] (1/((x - 1)*(x + 1)))
partial fractions
1/(2*(x - 1)) - 1/(2*(x + 1))- Input (rational function)
(1/((x - 1)*(x + 1)))- Conditions
Checked by Lean’s kernel: Identity with the partial fraction decomposition
∀ (x : ℝ), (x - 1) * (x + 1) ≠ 0 → 1 / ((x - 1) * (x + 1)) = 1 / (2 * (x - 1)) - 1 / (2 * (x + 1))
The certificate: 1 checked step
Identity with the partial fraction decomposition
∀ (x : ℝ), (x - 1) * (x + 1) ≠ 0 → 1 / ((x - 1) * (x + 1)) = 1 / (2 * (x - 1)) - 1 / (2 * (x + 1))
Possible Issues (2)
A divisor must be a polynomial. Multiply the inner fraction out first. For the expression is :
#cas [denominator] (1/(1 + 1/x))
Error
denominator: a divisor is itself a quotient; write the expression with polynomial divisors
Functions other than the field operations are refused:
#cas [denominator] (sin x / x)
Error
denominator: the expression is not a rational function: it has a function other than the field operations and natural powers
