Mode of #cas

numerator

Gives the numerator of a rational expression brought to one fraction, with the conditions of the identity.

#cas [numerator] e
gives the numerator N of the fraction N/D that together makes of the rational expression e, with the conditions under which N/D 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 (1/0=0), so the identity e=N/D holds where the divisors of e are nonzero, and the conditions say so. At a zero of a divisor, the numerator tells you nothing about e.

Details and Options

  • The theorem is that of #cas [together] e: ∀x1,…,xn,d1≠0→…→dk≠0→e=N/D, over the divisors d1,…,dk of e as written.
  • N is expanded and has no common factor with D.
  • The input is a rational expression as for together: real variables and rational numbers combined by +, -, *, / and natural powers, with polynomial divisors.
  • denominator gives D, and together the whole fraction.
  • There are no options.

Examples (10)#

Basic Examples (2)

The numerator of 1/x+1/y:

In[1]:=
#cas [numerator] (1/x + 1/y)
Out[1]=

numerator

x + y
Input (rational function)
(1/x + 1/y)
Conditions
x≠0, y≠0

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
  1. Identity with the common-denominator form

    ∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)

    Checked by Lean’s kernel


The numerator is expanded:

In[2]:=
#cas [numerator] (x/(x^2 - 1) + 1/(x + 1))
Out[2]=

numerator

2*x - 1
Input (rational function)
(x/(x^2 - 1) + 1/(x + 1))
Conditions
x2−1≠0, x+1≠0

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
  1. 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))

    Checked by Lean’s kernel

Scope (2)

The fraction is in lowest terms first, so the common factor x−y is gone:

In[3]:=
#cas [numerator] ((x^3 - y^3)/(x^2 - y^2))
Out[3]=

numerator

x2+xy+y2
x^2 + x*y + y^2
Input (rational function)
((x^3 - y^3)/(x^2 - y^2))
Conditions
x2−y2≠0

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
  1. 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)

    Checked by Lean’s kernel


Numbers as divisors:

In[4]:=
#cas [numerator] (x/2 + y/3)
Out[4]=

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
  1. Identity with the common-denominator form

    ∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6

    Checked by Lean’s kernel

Applications (2)

Multiplying by the denominator clears the fractions. The theorem needs both conditions, and only the three standard axioms are used:

In[5]:=
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
Out[5]=

numerator_cleared depends on the axioms propext, Classical.choice, Quot.sound.


The numerator 2x−1 of the second example vanishes at x=12, where no divisor does, and so the expression vanishes there:

In[6]:=
example : (1 / 2 : ℝ) / ((1 / 2) ^ 2 - 1) + 1 / (1 / 2 + 1) = 0 := by
  norm_num
Out[6]=

Lean accepts the proof.

Properties and Relations (2)

together prints the whole fraction, with the same theorem:

In[7]:=
#cas [together] (1/x + 1/y)
Out[7]=

common denominator

x+yxy
(x + y)/(x*y)
Input (rational function)
(1/x + 1/y)
Conditions
x≠0, y≠0

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
  1. Identity with the common-denominator form

    ∀ (x y : ℝ), x ≠ 0 → y ≠ 0 → 1 / x + 1 / y = (x + y) / (x * y)

    Checked by Lean’s kernel


denominator gives the other part. For x/2+y/3 it is 6:

In[8]:=
#cas [denominator] (x/2 + y/3)
Out[8]=

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
  1. Identity with the common-denominator form

    ∀ (x y : ℝ), x / 2 + y / 3 = (3 * x + 2 * y) / 6

    Checked by Lean’s kernel

Possible Issues (2)

Only rational expressions are accepted. simplify accepts sqrt:

In[9]:=
#cas [numerator] (sqrt x / x)
Out[9]=

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 x≠0 the expression is x/(x+1):

In[10]:=
#cas [numerator] (1/(1 + 1/x))
Out[10]=

Error

numerator: a divisor is itself a quotient; write the expression with polynomial divisors

See Also

denominator · together · cancel