Mode of #cas
derive
The derivative of an expression, with the conditions it needs and a theorem about Mathlib’s HasDerivAt.
#cas [derive x] e#cas [derive] efun x ↦ e in its parameter.derive computes a derivative and gives its HasDerivAt statement. You get the derivative printed the way you would write it, and under it the theorem SymLean proved: a statement about Mathlib’s HasDerivAt for the real functions, with every condition it needs as a hypothesis. For me those conditions are as much a part of the answer as the derivative. The derivative of is claimed only where , and the derivative of only where .
Examples (24)#
Basic Examples (3)
The derivative of :
#cas [derive x] (x ^ 2 * sin x)
x*(2*sin(x) + x*cos(x))Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 2 * Real.sin x) (x * (2 * Real.sin x + x * Real.cos x)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 2 * Real.sin x) (x * (2 * Real.sin x + x * Real.cos x)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin)).rawDerivative = CAS.Verified.Expr.diff 0 ((𝕏[0].pow 2).mul 𝕏[0].sin)
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin)).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin)).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin)).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((𝕏[0].pow 2).mul 𝕏[0].sin) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((𝕏[0].pow 2).mul 𝕏[0].sin)) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 2).mul 𝕏[0].sin))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 2*x^1*1*sin(x) + x^2*cos(x)*1
2. Normalize the symbolic derivative unconditionally
normalized result: 2*x*sin(x) + x^2*cos(x)
3. Apply checked side-conditioned cleanup
displayed result: x*(2*sin(x) + x*cos(x)) additional nonzero requirements: (none)
A square root needs a positive argument, and the report says so. Its “Conditions” line prints the hypothesis 0 < 2 * x + 2 of the theorem as :
#cas [derive x] (sqrt (2 * x + 2))
1/sqrt(2*x + 2)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), 0 < 2 * x + 2 → HasDerivAt (fun x ↦ √(2 * x + 2)) (1 / √(2 * x + 2)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), 0 < 2 * x + 2 → HasDerivAt (fun x ↦ √(2 * x + 2)) (1 / √(2 * x + 2)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).rawDerivative = CAS.Verified.Expr.diff 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: 2*x + 2
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (0*x + 2*1 + 0)/(2*sqrt(2*x + 2))
2. Normalize the symbolic derivative unconditionally
normalized result: 1/sqrt(2*x + 2)
3. Apply checked side-conditioned cleanup
displayed result: 1/sqrt(2*x + 2) additional nonzero requirements: (none)
With one variable you can leave its name out:
#cas [derive] (x ^ 3)
3*x^2Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 3) (3 * x ^ 2) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 3) (3 * x ^ 2) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3)).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].pow 3)
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3)).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3)).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3)).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].pow 3) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].pow 3)) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 3))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 3*x^2*1
2. Normalize the symbolic derivative unconditionally
normalized result: 3*x^2
3. Apply checked side-conditioned cleanup
displayed result: 3*x^2 additional nonzero requirements: (none)
Scope (6)
Every variable other than the one you name is a parameter:
#cas [derive x] (sin (x * y))
cos(x*y)*yChecked by Lean’s kernel: Derivative of the input
∀ (x y : ℝ), HasDerivAt (fun x ↦ Real.sin (x * y)) (Real.cos (x * y) * y) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x y : ℝ), HasDerivAt (fun x ↦ Real.sin (x * y)) (Real.cos (x * y) * y) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].mul 𝕏[1]).sin
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].mul 𝕏[1]).sin → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].mul 𝕏[1]).sin) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].mul 𝕏[1]).sin)).rhs
The computation
Variables: x, y
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: cos(x*y)*(1*y + x*0)
2. Normalize the symbolic derivative unconditionally
normalized result: cos(x*y)*y
3. Apply checked side-conditioned cleanup
displayed result: cos(x*y)*y additional nonzero requirements: (none)
The trigonometric, hyperbolic and inverse functions come with the conditions Mathlib’s theorems need:
#cas [derive x] (tan x)
1/cos(x)^2- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), Real.cos x ≠ 0 → HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), Real.cos x ≠ 0 → HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].sin.div 𝕏[0].cos)
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].sin.div 𝕏[0].cos) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].sin.div 𝕏[0].cos)) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: cos(x) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (cos(x)*1*cos(x) - sin(x)*-sin(x)*1)/cos(x)^2
2. Normalize the symbolic derivative unconditionally
normalized result: 1/cos(x)^2
3. Apply checked side-conditioned cleanup
displayed result: 1/cos(x)^2 additional nonzero requirements: (none)
#cas [derive x] (arcsin x)
1/sqrt(1 - x^2)- Conditions
- ,
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), x + 1 ≠ 0 → x - 1 ≠ 0 → HasDerivAt (fun x ↦ Real.arcsin x) (1 / √(1 - x ^ 2)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), x + 1 ≠ 0 → x - 1 ≠ 0 → HasDerivAt (fun x ↦ Real.arcsin x) (1 / √(1 - x ^ 2)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin).rawDerivative = CAS.Verified.Expr.diff 0 𝕏[0].asin
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp 𝕏[0].asin → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp 𝕏[0].asin) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 𝕏[0].asin)).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: x + 1, x - 1 Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 1/sqrt(1 - x^2)
2. Normalize the symbolic derivative unconditionally
normalized result: 1/sqrt(1 - x^2)
3. Apply checked side-conditioned cleanup
displayed result: 1/sqrt(1 - x^2) additional nonzero requirements: (none)
#cas [derive x] (sinh x)
1/2*(exp(x) + exp(-x))Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ Real.sinh x) (1 / 2 * (Real.exp x + Real.exp (-x))) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ Real.sinh x) (1 / 2 * (Real.exp x + Real.exp (-x))) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))).rawDerivative = CAS.Verified.Expr.diff 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2)))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2)))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2)) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2)))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].exp.sub 𝕏[0].neg.exp).div (CAS.Verified.Expr.nat 2)))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: 2 Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: ((exp(x)*1 - exp(-x)*-1)*2 - (exp(x) - exp(-x))*0)/2^2
2. Normalize the symbolic derivative unconditionally
normalized result: 1/2*(exp(x) + exp(-x))
3. Apply checked side-conditioned cleanup
displayed result: 1/2*(exp(x) + exp(-x)) additional nonzero requirements: (none)
The absolute value is differentiable away from 0. The condition is stated as :
#cas [derive x] (|x|)
x/|x|- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), 0 < x ^ 2 → HasDerivAt (fun x ↦ |x|) (x / |x|) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), 0 < x ^ 2 → HasDerivAt (fun x ↦ |x|) (x / |x|) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].pow 2).sqrt
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].pow 2).sqrt → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].pow 2).sqrt) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].pow 2).sqrt)).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: x^2
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 2*x^1*1/(2*|x|)
2. Normalize the symbolic derivative unconditionally
normalized result: x/|x|
3. Apply checked side-conditioned cleanup
displayed result: x/|x| additional nonzero requirements: (none)
Powers with a real or a negative exponent. A negative integer exponent is read as the reciprocal of a natural power, so the second theorem is about 1 / x ^ 2:
#cas [derive x] (x ^ (3/2 : ℝ))
3/2*sqrt(x)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ (3 / 2 : ℝ)) (3 / 2 * √x) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ (3 / 2 : ℝ)) (3 / 2 * √x) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2))))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2))))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2))) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2))))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2)))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow ((CAS.Verified.Expr.nat 3).div (CAS.Verified.Expr.nat 2))))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: 2 Raw checked positivity requirements: x
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 1*3/2*x^(3/2 - 1) + (0*2 - 3*0)/2^2*x^(3/2)*log(x)
2. Normalize the symbolic derivative unconditionally
normalized result: 3/2*x^(1/2)
3. Apply checked side-conditioned cleanup
displayed result: 3/2*sqrt(x) additional nonzero requirements: (none)
#cas [derive x] (x ^ (-2))
-(2/x^3)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), x ^ 2 ≠ 0 → HasDerivAt (fun x ↦ 1 / x ^ 2) (-2 / x ^ 3) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), x ^ 2 ≠ 0 → HasDerivAt (fun x ↦ 1 / x ^ 2) (-2 / x ^ 3) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))).rawDerivative = CAS.Verified.Expr.diff 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2)))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2)))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2)) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2)))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div (𝕏[0].pow 2)))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: x^2 Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (0*x^2 - 1*2*x^1*1)/(x^2)^2
2. Normalize the symbolic derivative unconditionally
normalized result: -(2/x^3)
3. Apply checked side-conditioned cleanup
displayed result: -(2/x^3) additional nonzero requirements: (none)
#cas [derive x] (x ^ y)
y*x^(y - 1)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x y : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ y) (y * x ^ (y - 1)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x y : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ y) (y * x ^ (y - 1)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1])).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].rpow 𝕏[1])
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1])).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1])).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1]))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1]))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1])).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].rpow 𝕏[1]) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1]))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].rpow 𝕏[1])) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[1]))).rhs
The computation
Variables: x, y
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: x
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 1*y*x^(y - 1) + 0*x^y*log(x)
2. Normalize the symbolic derivative unconditionally
normalized result: y*x^(y - 1)
3. Apply checked side-conditioned cleanup
displayed result: y*x^(y - 1) additional nonzero requirements: (none)
The error function, whose derivative is a Gaussian. The theorem is about SymLean’s CAS.erf:
#cas [derive x] (erf x)
derivative
2/sqrt(pi)*exp(-x^2)- Input (sum of c * erf (A x + B))
(erf x)
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ CAS.erf x) (2 / √Real.pi * Real.exp (-x ^ 2)) x
from CAS.hasDerivAt_erf
The certificate: 1 checked step
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ CAS.erf x) (2 / √Real.pi * Real.exp (-x ^ 2)) x
A function is differentiated in its parameter:
#cas [derive] (fun x ↦ a * x + b)
aChecked by Lean’s kernel: Derivative of the input
∀ (x a b : ℝ), HasDerivAt (fun x ↦ a * x + b) a x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x a b : ℝ), HasDerivAt (fun x ↦ a * x + b) a x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2])).rawDerivative = CAS.Verified.Expr.diff 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2])
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 3 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2])).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2])).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 3 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2]))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2]))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2])).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^3), CAS.Verified.Expr.ValidAt x.ofLp ((𝕏[1].mul 𝕏[0]).add 𝕏[2]) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2]))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((𝕏[1].mul 𝕏[0]).add 𝕏[2])) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[1].mul 𝕏[0]).add 𝕏[2]))).rhs
The computation
Variables: x, a, b
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 0*x + a*1 + 0
2. Normalize the symbolic derivative unconditionally
normalized result: a
3. Apply checked side-conditioned cleanup
displayed result: a additional nonzero requirements: (none)
Options (3)
With cas.suggest, the report ends with the theorem as an example, ready to paste:
set_option cas.suggest true in #cas [derive x] (tan x)
1/cos(x)^2- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), Real.cos x ≠ 0 → HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), Real.cos x ≠ 0 → HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].sin.div 𝕏[0].cos)
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos)).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].sin.div 𝕏[0].cos) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].sin.div 𝕏[0].cos)) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].sin.div 𝕏[0].cos))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: cos(x) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (cos(x)*1*cos(x) - sin(x)*-sin(x)*1)/cos(x)^2
2. Normalize the symbolic derivative unconditionally
normalized result: 1/cos(x)^2
3. Apply checked side-conditioned cleanup
displayed result: 1/cos(x)^2 additional nonzero requirements: (none)
Try this
example (x : ℝ) (h : Real.cos x ≠ 0) : HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x := by cas
Here it is pasted, and cas proves it:
example (x : ℝ) (h : Real.cos x ≠ 0) : HasDerivAt (fun x ↦ Real.tan x) (1 / Real.cos x ^ 2) x := by cas
Lean accepts the proof.
With cas.verbose, “The computation” shows every differentiation rule that was applied:
set_option cas.verbose true in #cas [derive x] (sqrt (2 * x + 2))
1/sqrt(2*x + 2)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), 0 < 2 * x + 2 → HasDerivAt (fun x ↦ √(2 * x + 2)) (1 / √(2 * x + 2)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), 0 < 2 * x + 2 → HasDerivAt (fun x ↦ √(2 * x + 2)) (1 / √(2 * x + 2)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).rawDerivative = CAS.Verified.Expr.diff 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 2).mul 𝕏[0]).add (CAS.Verified.Expr.nat 2)).sqrt)).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: 2*x + 2
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (0*x + 2*1 + 0)/(2*sqrt(2*x + 2))
square-root chain rule
input: sqrt(2*x + 2) raw derivative: (0*x + 2*1 + 0)/(2*sqrt(2*x + 2)) representation: indexed DiffDerivation node
sum rule
input: 2*x + 2 raw derivative: 0*x + 2*1 + 0 representation: indexed DiffDerivation node
product rule
input: 2*x raw derivative: 0*x + 2*1 representation: indexed DiffDerivation node
constant rule
input: 2 raw derivative: 0 representation: indexed DiffDerivation node
variable rule
input: x raw derivative: 1 representation: indexed DiffDerivation node
constant rule
input: 2 raw derivative: 0 representation: indexed DiffDerivation node
2. Normalize the symbolic derivative unconditionally
normalized result: 1/sqrt(2*x + 2)
3. Apply checked side-conditioned cleanup
displayed result: 1/sqrt(2*x + 2) additional nonzero requirements: (none)
Applications (2)
A derivative in a proof. The tactic cas proves the statement, and only the three standard axioms are used:
theorem derive_product (x : ℝ) : HasDerivAt (fun x ↦ x ^ 2 * Real.sin x) (2 * x * Real.sin x + x ^ 2 * Real.cos x) x := by cas #print axioms derive_product
derive_product depends on the axioms propext, Classical.choice, Quot.sound.
The critical points of : differentiate, then solve :
#cas [derive x] (x ^ 3 - 3 * x)
3*x^2 - 3Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 3 - 3 * x) (3 * x ^ 2 - 3) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ x ^ 3 - 3 * x) (3 * x ^ 2 - 3) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))).rawDerivative = CAS.Verified.Expr.diff 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0])))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0])))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0])) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0])))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0]))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((𝕏[0].pow 3).sub ((CAS.Verified.Expr.nat 3).mul 𝕏[0])))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 3*x^2*1 - 0*x - 3*1
2. Normalize the symbolic derivative unconditionally
normalized result: 3*x^2 - 3
3. Apply checked side-conditioned cleanup
displayed result: 3*x^2 - 3 additional nonzero requirements: (none)
#cas [solve x] (3 * x ^ 2 - 3 = 0)
equivalent real solution predicate
x = 1 ∨ x = -1- Input (real relation)
(3 * x ^ 2 - 3 = 0)
Checked by Lean’s kernel: Complete solution predicate for every real value
∀ (x : ℝ), 3 * x ^ 2 - 3 = 0 ↔ x = 1 ∨ x = -1
The certificate: 1 checked step
Complete solution predicate for every real value
∀ (x : ℝ), 3 * x ^ 2 - 3 = 0 ↔ x = 1 ∨ x = -1
The computation
Guarantee: the input and output are equivalent for every real value
Properties and Relations (2)
The gradient collects the partial derivatives:
#cas [grad x, y] (x ^ 2 * y + y ^ 3)
vector ℝ^2; order x, y
(2*x*y, x^2 + 3*y^2)Checked by Lean’s kernel: Gradient of the input
∀ (x y : ℝ), HasGradientAt (fun p ↦ p.ofLp 0 ^ 2 * p.ofLp 1 + p.ofLp 1 ^ 3) !₂[2 * x * y, x ^ 2 + 3 * y ^ 2] !₂[x, y]
from CAS.Verified.Expr.hasGradientAt_of_closedGradient
The certificate: 10 checked steps
Gradient of the input
∀ (x y : ℝ), HasGradientAt (fun p ↦ p.ofLp 0 ^ 2 * p.ofLp 1 + p.ofLp 1 ^ 3) !₂[2 * x * y, x ^ 2 + 3 * y ^ 2] !₂[x, y]
Gradient component ∂_x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).rawDerivative = CAS.Verified.Expr.diff 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))
Gradient component ∂_x: normalization preserves evaluation
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).rawDerivative
Gradient component ∂_x: side-conditioned display normalization
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).simplifiedDerivative
Gradient component ∂_x: analytic semantics of the displayed result
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).rhs
Gradient component ∂_y: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).rawDerivative = CAS.Verified.Expr.diff 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))
Gradient component ∂_y: normalization preserves evaluation
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).rawDerivative
Gradient component ∂_y: side-conditioned display normalization
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))).simplifiedDerivative
Gradient component ∂_y: analytic semantics of the displayed result
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))) x) (EuclideanSpace.single 1 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 1 (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)))).rhs
Analytic gradient assembly
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3)) → (WithLp.toLp 2 fun i ↦ CAS.Verified.Expr.eval x.ofLp ((∇ₛ (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))) i)) = gradient (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((𝕏[0].pow 2).mul 𝕏[1]).add (𝕏[1].pow 3))) x
The computation
Variables and component order: x, y
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Checked gradient computation
Gradient component ∂_x
Output: 2*x*y
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 2*x^1*1*y + x^2*0 + 3*y^2*0
2. Normalize the symbolic derivative unconditionally
normalized result: 2*x*y
3. Apply checked side-conditioned cleanup
displayed result: 2*x*y additional nonzero requirements: (none)
Gradient component ∂_y
Output: x^2 + 3*y^2
Partial derivative in y
1. Apply symbolic differentiation rules
raw result: 2*x^1*0*y + x^2*1 + 3*y^2*1
2. Normalize the symbolic derivative unconditionally
normalized result: x^2 + 3*y^2
3. Apply checked side-conditioned cleanup
displayed result: x^2 + 3*y^2 additional nonzero requirements: (none)
#cas [derive y] (x ^ 2 * y + y ^ 3)
x^2 + 3*y^2Checked by Lean’s kernel: Derivative of the input
∀ (y x : ℝ), HasDerivAt (fun y ↦ x ^ 2 * y + y ^ 3) (x ^ 2 + 3 * y ^ 2) y
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (y x : ℝ), HasDerivAt (fun y ↦ x ^ 2 * y + y ^ 3) (x ^ 2 + 3 * y ^ 2) y
Partial derivative in y: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))).rawDerivative = CAS.Verified.Expr.diff 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))
Partial derivative in y: normalization preserves evaluation
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))).rawDerivative
Partial derivative in y: side-conditioned display normalization
∀ (ρ : Fin 2 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3)))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3)))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))).simplifiedDerivative
Partial derivative in y: analytic semantics of the displayed result
∀ (x : ℝ^2), CAS.Verified.Expr.ValidAt x.ofLp (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3)) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3)))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((𝕏[1].pow 2).mul 𝕏[0]).add (𝕏[0].pow 3)))).rhs
The computation
Variables: y, x
Analytic domain conditions
Raw checked nonzero requirements: (none) Raw checked positivity requirements: (none)
Partial derivative in y
1. Apply symbolic differentiation rules
raw result: 2*x^1*0*y + x^2*1 + 3*y^2*1
2. Normalize the symbolic derivative unconditionally
normalized result: x^2 + 3*y^2
3. Apply checked side-conditioned cleanup
displayed result: x^2 + 3*y^2 additional nonzero requirements: (none)
Differentiating an antiderivative gives back the integrand:
#cas [integrate x] (x * sin (x ^ 2))
antiderivative
-(1/2*cos(x^2))Checked by Lean’s kernel: Integral of the input
∀ (a b : ℝ), ∫ (x : ℝ) in a..b, x * Real.sin (x ^ 2) = -(1 / 2 * Real.cos (b ^ 2)) + 1 / 2 * Real.cos (a ^ 2)
from CAS.IntegrationCheck.AntiderivativeCert.intervalIntegral_eq_sub_of_line
The certificate: 9 checked steps
Integral of the input
∀ (a b : ℝ), ∫ (x : ℝ) in a..b, x * Real.sin (x ^ 2) = -(1 / 2 * Real.cos (b ^ 2)) + 1 / 2 * Real.cos (a ^ 2)
Primitive derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg).rawDerivative = CAS.Verified.Expr.diff 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg
Primitive derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg).rawDerivative
Primitive derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg)).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg)).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg).simplifiedDerivative
Primitive derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg)).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg)).rhs
Residual route reaches zero
(CAS.IntegrationCheck.route 0 (𝕏[0].mul (𝕏[0].pow 2).sin) { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.candidate).rhs = 0
Symbolic antiderivative identity under the displayed requirements
∀ (x : ℝ^1), { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.requirements.Holds x.ofLp → CAS.Verified.Expr.eval x.ofLp (CAS.Verified.Expr.diff 0 { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.candidate) = CAS.Verified.Expr.eval x.ofLp (𝕏[0].mul (𝕏[0].pow 2).sin)
Coordinate-line derivative theorem
∀ (x : ℝ^1) (t : ℝ), { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.requirements.Holds (x.ofLp + t • (EuclideanSpace.single 0 1).ofLp) → HasDerivAt (fun s ↦ CAS.Verified.Expr.eval (x + s • EuclideanSpace.single 0 1).ofLp { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.candidate) (CAS.Verified.Expr.eval (x + t • EuclideanSpace.single 0 1).ofLp (𝕏[0].mul (𝕏[0].pow 2).sin)) t
Coordinate-line fundamental theorem of calculus
∀ (x : ℝ^1) (a b : ℝ), (∀ t ∈ Set.uIcc a b, { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.requirements.Holds (x.ofLp + t • (EuclideanSpace.single 0 1).ofLp)) → ∫ (t : ℝ) in a..b, CAS.Verified.Expr.eval (x + t • EuclideanSpace.single 0 1).ofLp (𝕏[0].mul (𝕏[0].pow 2).sin) = CAS.Verified.Expr.eval (x + b • EuclideanSpace.single 0 1).ofLp { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.candidate - CAS.Verified.Expr.eval (x + a • EuclideanSpace.single 0 1).ofLp { candidate := ((CAS.Verified.Expr.rat 1 2).mul (𝕏[0].pow 2).cos).neg, routeZero := ⋯ }.candidate
The computation
Variables: x
Checked antiderivative computation
1. Differentiate the proposed primitive
Raw derivative: -(0*cos(x^2) + 1/2*-sin(x^2)*2*x^1*1)
2. Form the derivative residual
Raw residual: -(0*cos(x^2)) - 1/2*-sin(x^2)*2*x^1*1 - x*sin(x^2) Definition: CAS.IntegrationCheck.residual
3. Check the residual normal form
Checked residual normal form: 0 Certificate condition: checked residual normal form = 0
4. Record analytic domain requirements
Certificate nonzero requirements (compacted): (none) Certificate positivity requirements (compacted): (none)
#cas [derive x] (-(1/2) * cos (x ^ 2))
x*sin(x^2)Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ -(1 / 2) * Real.cos (x ^ 2)) (x * Real.sin (x ^ 2)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ -(1 / 2) * Real.cos (x ^ 2)) (x * Real.sin (x ^ 2)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)).rawDerivative = CAS.Verified.Expr.diff 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos)) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (((CAS.Verified.Expr.nat 1).div (CAS.Verified.Expr.nat 2)).neg.mul (𝕏[0].pow 2).cos))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: 2 Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: -((0*2 - 1*0)/2^2)*cos(x^2) - 1/2*-sin(x^2)*2*x^1*1
2. Normalize the symbolic derivative unconditionally
normalized result: -(-1/2*sin(x^2)*2*x)
3. Apply checked side-conditioned cleanup
displayed result: x*sin(x^2) additional nonzero requirements: (none)
Possible Issues (5)
Only the functions listed above are differentiated. The Gamma function is not one of them:
#cas [derive x] (gamma x)
Error
unsupported symbolic function 'gamma'; expected abs, sin, cos, tan, sinh, cosh, tanh, atan/arctan, asin/arcsin, acos/arccos, exp, log, or sqrt. `gamma x` is evaluated as the whole input of `#cas (gamma x)`
The error function is differentiated only in the sums described above. A product with it is refused:
#cas [derive x] (x * erf x)
Error
unsupported symbolic function 'erf'; expected abs, sin, cos, tan, sinh, cosh, tanh, atan/arctan, asin/arcsin, acos/arccos, exp, log, or sqrt. `erf x` is evaluated as the whole input of `#cas [N d] (erf x)`
The name in brackets has to be the parameter of the function:
#cas [derive x] (fun t : ℝ ↦ t ^ 2)
Error
coordinate 'x' does not match the function parameter 't'; use the parameter name or omit the coordinate
Without a name, the expression must have exactly one variable:
#cas [derive] (x * y)
Error
the expression has multiple variables: x, y; use [derive x] for a partial derivative or [grad x, y] for a gradient
A condition is part of the answer. Here the theorem says nothing at , where Lean’s makes a function with no derivative:
#cas [derive x] (1 / x)
-(1/x^2)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), x ≠ 0 → HasDerivAt (fun x ↦ 1 / x) (-1 / x ^ 2) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), x ≠ 0 → HasDerivAt (fun x ↦ 1 / x) (-1 / x ^ 2) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0])).rawDerivative = CAS.Verified.Expr.diff 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0])
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0])).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0])).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0]))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0]))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0])).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((CAS.Verified.Expr.nat 1).div 𝕏[0]) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0]))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((CAS.Verified.Expr.nat 1).div 𝕏[0])) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div 𝕏[0]))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: x Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (0*x - 1^2)/x^2
2. Normalize the symbolic derivative unconditionally
normalized result: -(1/x^2)
3. Apply checked side-conditioned cleanup
displayed result: -(1/x^2) additional nonzero requirements: (none)
Neat Examples (3)
A rational function with a degree 6 denominator:
#cas [derive x] (1 / (x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3))
-((6*x^5 + 12*x^3 + 12*x^2 + 4*x + 5)/(x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3)^2)- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3 ≠ 0 → HasDerivAt (fun x ↦ 1 / (x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3)) (-((6 * x ^ 5 + 12 * x ^ 3 + 12 * x ^ 2 + 4 * x + 5) / (x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3) ^ 2)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3 ≠ 0 → HasDerivAt (fun x ↦ 1 / (x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3)) (-((6 * x ^ 5 + 12 * x ^ 3 + 12 * x ^ 2 + 4 * x + 5) / (x ^ 6 + 3 * x ^ 4 + 4 * x ^ 3 + 2 * x ^ 2 + 5 * x + 3) ^ 2)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))).rawDerivative = CAS.Verified.Expr.diff 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3))))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3))))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3))) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3))))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3)))) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 ((CAS.Verified.Expr.nat 1).div ((((((𝕏[0].pow 6).add ((CAS.Verified.Expr.nat 3).mul (𝕏[0].pow 4))).add ((CAS.Verified.Expr.nat 4).mul (𝕏[0].pow 3))).add ((CAS.Verified.Expr.nat 2).mul (𝕏[0].pow 2))).add ((CAS.Verified.Expr.nat 5).mul 𝕏[0])).add (CAS.Verified.Expr.nat 3))))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3 Raw checked positivity requirements: (none)
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: (0*(x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3) - 1*(6*x^5*1 + 0*x^4 + 3*4*x^3*1 + 0*x^3 + 4*3*x^2*1 + 0*x^2 + 2*2*x^1*1 + 0*x + 5*1 + 0))/(x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3)^2
2. Normalize the symbolic derivative unconditionally
normalized result: -((6*x^5 + 12*x^3 + 12*x^2 + 4*x + 5)/(x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3)^2)
3. Apply checked side-conditioned cleanup
displayed result: -((6*x^5 + 12*x^3 + 12*x^2 + 4*x + 5)/(x^6 + 3*x^4 + 4*x^3 + 2*x^2 + 5*x + 3)^2) additional nonzero requirements: (none)
A combination of error functions:
#cas [derive x] (2 * erf (3 * x + 1) - erf (x / 2))
derivative
12/sqrt(pi)*exp(-(3*x + 1)^2) - exp(-(x/2)^2)/sqrt(pi)- Input (sum of c * erf (A x + B))
(2 * erf (3 * x + 1) - erf (x / 2))
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ 2 * CAS.erf (3 * x + 1) - CAS.erf (x / 2)) (12 / √Real.pi * Real.exp (-(3 * x + 1) ^ 2) - Real.exp (-(x / 2) ^ 2) / √Real.pi) x
from CAS.hasDerivAt_erf
The certificate: 1 checked step
Derivative of the input
∀ (x : ℝ), HasDerivAt (fun x ↦ 2 * CAS.erf (3 * x + 1) - CAS.erf (x / 2)) (12 / √Real.pi * Real.exp (-(3 * x + 1) ^ 2) - Real.exp (-(x / 2) ^ 2) / √Real.pi) x
The function :
#cas [derive x] (x ^ x)
x^x*(1 + log(x))- Conditions
Checked by Lean’s kernel: Derivative of the input
∀ (x : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ x) (x ^ x * (1 + Real.log x)) x
from CAS.Command.hasDerivAt_of_displayRoute
The certificate: 5 checked steps
Derivative of the input
∀ (x : ℝ), 0 < x → HasDerivAt (fun x ↦ x ^ x) (x ^ x * (1 + Real.log x)) x
Partial derivative in x: indexed rules compute Expr.diff
(CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0])).rawDerivative = CAS.Verified.Expr.diff 0 (𝕏[0].rpow 𝕏[0])
Partial derivative in x: normalization preserves evaluation
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0])).simplifiedDerivative = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0])).rawDerivative
Partial derivative in x: side-conditioned display normalization
∀ (ρ : Fin 1 → ℝ), CAS.Verified.Expr.Alg.SideHolds ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0]))).nonzero → CAS.Verified.Expr.eval ρ (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0]))).rhs = CAS.Verified.Expr.eval ρ (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0])).simplifiedDerivative
Partial derivative in x: analytic semantics of the displayed result
∀ (x : ℝ^1), CAS.Verified.Expr.ValidAt x.ofLp (𝕏[0].rpow 𝕏[0]) → CAS.Verified.Expr.Alg.SideHolds x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0]))).nonzero → (fderiv ℝ (fun y ↦ CAS.Verified.Expr.eval y.ofLp (𝕏[0].rpow 𝕏[0])) x) (EuclideanSpace.single 0 1) = CAS.Verified.Expr.eval x.ofLp (CAS.Command.displayDerivativeRoute (CAS.Verified.Expr.DiffDerivation.build 0 (𝕏[0].rpow 𝕏[0]))).rhs
The computation
Variables: x
Analytic domain conditions
Raw checked nonzero requirements: sqrt(x) Raw checked positivity requirements: x
Partial derivative in x
1. Apply symbolic differentiation rules
raw result: 1*x*x^(x - 1) + 1*x^x*log(x)
2. Normalize the symbolic derivative unconditionally
normalized result: x*x^(x - 1) + x^x*log(x)
3. Apply checked side-conditioned cleanup
displayed result: x^x*(1 + log(x)) additional nonzero requirements: sqrt(x)
