# Documentation

PnP2023.Lec_03_10.FormalCalculus

# 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 : ) :
• integral :
• interval_union : ∀ (a b c : ), integral a c = integral a b + integral b c

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.

Instances
def integral (f : ) [int : ] (a : ) (b : ) :

The integral of a function, with the typeclass derived

Equations
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 :
• jet :

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

Instances For

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

Equations
• = ().derivative

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

Equations
• = ().value
instance fundThm (f : SmoothFunction) :

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

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

## 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 } }

Sum of smooth functions.

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

Product of smooth functions using Liebnitz rule.

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

Product of a scalar and a smooth function.

Equations
• = { jet := fun x => { value := , derivative := } }

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

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

Equations
Equations
Equations

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

Equations