Exact interval arithmetic for radical expressions #
A square-root node carries rational lower and upper witnesses. The evaluator checks their squares exactly, so every successful enclosure has a kernel-checked real-number semantics.
Rational expressions with explicitly certified square-root bounds.
- var {n : ℕ} : Fin n → RadicalExpression n
- literal {n : ℕ} : ℚ → RadicalExpression n
- add {n : ℕ} : RadicalExpression n → RadicalExpression n → RadicalExpression n
- neg {n : ℕ} : RadicalExpression n → RadicalExpression n
- mul {n : ℕ} : RadicalExpression n → RadicalExpression n → RadicalExpression n
- inv {n : ℕ} : RadicalExpression n → RadicalExpression n
- sqrt {n : ℕ} : RadicalExpression n → ℚ → ℚ → RadicalExpression n
Instances For
Evaluate a radical expression in a real environment.
Equations
Instances For
Evaluate by exact rational intervals, rejecting unsafe inverses or square-root witnesses.
Equations
- One or more equations did not get rendered due to their size.
- (LeanPool.Besicovitch.RadicalExpression.var i).enclosure x✝ = some (x✝ i)
- (LeanPool.Besicovitch.RadicalExpression.literal q).enclosure x✝ = some (LeanPool.Besicovitch.RationalInterval.singleton q)
- (f.add g).enclosure x✝ = do let I ← f.enclosure x✝ let J ← g.enclosure x✝ pure (I.add J)
- f.neg.enclosure x✝ = do let I ← f.enclosure x✝ pure I.neg
- (f.mul g).enclosure x✝ = do let I ← f.enclosure x✝ let J ← g.enclosure x✝ pure (I.mul J)
- f.inv.enclosure x✝ = do let I ← f.enclosure x✝ if h : 0 < I.lower ∨ I.upper < 0 then pure (I.inv h) else none
Instances For
Check an enclosure and widen it to a simpler rational target interval.
Equations
Instances For
Decide whether the computed enclosure lies in a given rational target interval.
Equations
Instances For
Every successful radical enclosure contains the real value of the expression.
A successful widened enclosure contains the real value of the expression.
A successful Boolean certificate encloses the real value of the expression.