# Formal Calculus #

We introduce formal structures for integration and differentiation. Properties should be added to make these mathematically sound. But correctness can be ensured temporarily by making sure individual definitions are correct.

## Formal Integrals #

class Integrable (f : ) :

Integrability of f, i.e., given an interval [a, b], we can compute the integral of f over that interval. Additivity over intervals is also required.

• integral :
• interval_union : ∀ (a b c : ), = +
Instances
def integral (f : ) [int : ] (a : ) (b : ) :

The integral of a function, with the typeclass derived

Equations
Instances For
theorem integral_point (f : ) [int : ] (a : ) :
integral f a a = 0

The integral over a single point is zero, proved as an illustration.

As an exercise, prove that flip ends of an interval gives the negative of the integral.

## Formal Derivatives #

We define so called one-jets as a value and a derivative at a point. A differentiable function has values a one-jet at each point.

structure OneJet :

A one-jet is a value and a derivative at a point.

Instances For
structure SmoothFunction :

A differentiable function is a function that has a one-jet at each point.

• jet :
Instances For

Derivative of a smooth function, i.e., the derivative of the one-jet at a point.

Equations
• = (f.jet x).derivative
Instances For

The value of a smooth function, i.e., the value of the one-jet at a point.

Equations
• = (f.jet x).value
Instances For
instance fundThm (f : SmoothFunction) :

Integrable functions can be obtained from smooth functions via the fundamental theorem of calculus.

Equations
• = { integral := fun (a b : ) => , interval_union := }

## Constructions of smooth functions #

To use the above we need to construct a few smooth functions

Constant functions as smooth functions.

Equations
• = { jet := fun (x : ) => { value := c, derivative := 0 } }
Instances For

Sum of smooth functions.

Equations
• One or more equations did not get rendered due to their size.
Instances For

Product of smooth functions using Liebnitz rule.

Equations
• One or more equations did not get rendered due to their size.
Instances For

Product of a scalar and a smooth function.

Equations
• = { jet := fun (x : ) => { value := , derivative := } }
Instances For

Equations

Multiplication operation on smooth functions

Equations

Scalar multiplication for smooth functions

Equations

This gives polynomial functions as a special case. As an exercise, prove that smooth functions form a Ring (indeed an Algebra over ℝ).

We will define some polynomials as smooth functions as an example.

The coordinate function

Equations
Instances For

The power function for a smooth function (automatic if ring is proved)

Equations
Instances For
Equations
Equations

A polynomial. We can have cleaner notation but the goal is to illustrate the construction

Equations
Instances For