Module prop::fun

source ·
Expand description

Functional programming as propositions

Model is derived from PSQ, PSI and HOOO EP.

Types

A type x : T uses Ty<X, T> from the path_semantics module (PSI).

A function type f : X -> Y uses Ty<F, Pow<Y, X>> from the hooo module (HOOO EP).

Imaginary Inverse

The syntax ~x uses Qu<X> from the qubit module, and the syntax x ~~ y uses Q<X, Y> from the quality module.

This model uses imaginary inverse inv(f) with ~inv(f) as a proof of bijective inverse. Here, ~ means the path semantical qubit operator, such that:

(inv(f) ~~ g) => ~inv(f)

It means that one uses path semantical quality instead of equality for inverses. Path semantical quality inv(f) ~~ g also implies inv(f) == g, which is useful in proofs.

The inv_val_qu axiom makes it possible to compute using the inverse:

(~inv(f) ⋀ (f(x) == y)) => (inv(f)(y) == x)

The reason for this design is that inv(f) == inv(f) is a tautology, and Rust’s type system can’t pattern match on 1-avatars with inequality in rules like in Avatar Logic.

By using a partial equivalence operator ~~ instead of ==, one can not prove inv(f) ~~ inv(f) without any assumptions. This solves the problem such that axioms can be added, only for functions that have inverses.

If a function f has no inverse, it is useful to prove false^(inv(f) ~~ g).

Modules

Boolean algebra

Structs

Applied function.
Composition.
Identity function.
Imaginary inverse.
Cumulative type hierarchy.

Functions

Get type of applied binary operator.
Indiscernibility of identicals (Leibniz’s law).
Get type of applied function.
Lift equality of maps to application.
g(f(x)) => (g . f)(x).
(g . f) ⋀ (g == h) => (h . f).
(g . f) ⋀ (f == h) => (g . h).
(inv(f) . inv(g)) => inv(g . f).
(inv(f) . f) => id.
(f . inv(f)) => id.
(g . f)(x) => g(f(x)).
Type of composition.
Definition of identity function.
inv(id) ~~ id.
Type of Id.
inv(g . f) => (inv(f) . inv(g)).
Inverse type (f : x -> y) => (inv(f) : y -> x).
Get inverse map of f if there exists a proof g.
Get inverse map of f by g.
Get inverse map of f if there exists a proof ~inv(f).
(a -> b) : type(0).
(f : A -> B) ⋀ (inv(f) ~~ g) => ((f ~~ g) : ((A -> B) ~~ (B -> A))).
(f : A -> B) => ((f ~~ inv(f)) : ((A -> B) ~~ (B -> A))).
type(n) : type(n+1).

Type Definitions

Apply 2 function arguments.