advancedresearch/poi

a pragmatic point-free theorem prover assistant === Poi Reduce 0.2 === Type `help` for more information. > and and or ( and => or ) To run Poi Reduce...
advancedresearch/poi

a pragmatic point-free theorem prover assistant

=== Poi Decrease 0.2 ===
Kind `support` for added knowledge.
> and[not]
and[not]
or			( and[not] => or )

To bustle Poi Decrease from your Terminal, kind:

cargo install --instance poireduce poi

Then, to bustle:

poireduce

Example

When computing the length of two concatenated lists,
there is a quicker formulation, which is to compute the length of every checklist and add them together:

> (len . concat)(a, b)
(len · concat)(a, b)
(len · concat)(a)(b)
(concat[len] · (len · fst, len · snd))(a)(b)
(add · (len · fst, len · snd))(a)(b)
<=>  add((len · fst)(a)(b), (len · snd)(a)(b))
> add((len · fst)(a)(b), (len · snd)(a)(b))
add((len · fst)(a)(b), (len · snd)(a)(b))
add((len · fst)(a)(b))((len · snd)(a)(b))
add(len(a))((len · snd)(a)(b))
add(len(a))(len(b))

Introduction to Poi and Path Semantics

In “point-free” or “tacit” programming, capabilities manufacture no longer title the arguments
(or “aspects”) on which they feature. Eye Wikipedia article.

Poi is an implementation of a limited subset of Path Semantics.
So that you just might possibly possibly present how Poi works, one needs to present a limited bit about Path Semantics.

Path Semantics is a in particular expressive language for mathematical programming,
which has a “direction-home” to boot to to same outdated computation.
If same outdated programming is 2D, then Path Semantics is 3D.
Path Semantics is on the total usual in mixture with Category Plan, Logic, etc.

A “direction” (or “same outdated direction”) is a technique of navigating between capabilities, as an illustration:

and[not] <=> or

Translated into words, this sentence formulation:

Within the event you flip the enter and output bits of an `and` feature,
then you definately might possibly possibly well predict the output straight from the enter bits
using the feature `or`.

In same outdated programming, there will not be any formulation to particular this idea straight,
but it’s most likely you’ll well well symbolize the logical relationship as an equation:

no longer(and(a, b)) = or(no longer(a), no longer(b))

Right here’s is referred to as undoubtedly one of De Morgan’s guidelines.

When represented as a commutative design, one can visualize the dimension:

         no longer x no longer
      o ---------> o           o -------> direction-home
      |            |           |
  and |            | or        |
      V            V           |
      o ---------> o           V
           no longer            computation

Right here’s written in asymmetric direction notation:

and[not x not -> not] <=> or

In symmetric direction notation:

and[not] <=> or

Both computation and direction-home are directional,
that formulation that one can no longer repeatedly gain the inverse.
Composition in direction-home is factual feature composition:

f[g][h] <=> f[h . g]

If one imagines computation = 2D, then computation + direction-home = 3D.

Path Semantics would possibly be regarded as “point-free vogue” sub-position of equations.
This sub-position of equations is in particular purposeful in programming.

The Impart of Complexity

Setting pleasant mathematical knowledge purposeful for programming is counting on interesting
the identity of capabilities. This implies that the extra knowledge you are wanting to kind,
the extra capabilities it’s most likely you’ll well well merely have to title and focus on with symbolically.

This implies that mathematical theories using a “birds-possess behold” are no longer as
purposeful to resolve particular complications, excluding as a handbook to gain the resolution.
The extra general and expressive a idea is, the more durable it’s a long way to manufacture proof search.

As a consequence, theorem proving along both computation + direction-home is
essential more durable than factual theorem proving for computation.

For instance, Kind Plan is purposeful
to take a look at that programs are appropriate, but for greater categories, it turns into
extra and extra hard to floor the semantics while staying efficient and usable.

Path Semantics uses a
diversified formulation, which is in step with symbols.
When a image is created, the hypothesis “commits” to keeping the “paths”
from the impress, which is legendary in Homotopy Kind Plan to correspond to “proofs”.
Since the symbols themselves encode this relationship to proofs,
it formulation that proofs would possibly be arbitrary complicated without affecting complexity.

Right here’s diversified from a pure axiomatic system.
In a pure axiomatic system, the symbols manufacture no longer get that formulation excluding
the connection to every diversified (the axioms).
In consequence, you salvage non-same outdated interpretations of the Peano axioms.
In Path Semantics, in case you roar “the pure numbers”, you mean the pure numbers, no longer the pure numbers as described by the Peano axioms.
The impress “the pure numbers” is the proof of what you mean,
using the background of direction semantical knowledge to clarify it.
Right here’s what the “semantics” in Path Semantics formulation.

It is that it’s most likely you’ll well well take into accout to particular strategies in Path Semantics which would possibly be believed to be factual,
but can no longer be confirmed to be factual in any formal language. One day, a proper
language would possibly be invented to present the sentence factual, but programmers manufacture no longer
live up for this to happen. As a replacement, they default to pragmatic systems, equivalent to
checking out extensively.
For instance, the Goldenbach conjecture
has been tested as much as some restrict, so it holds for all pure numbers under that restrict.
A realistic technique is what you manufacture whenever it’s most likely you’ll well well no longer idealize the anguish away.

Poi uses a pragmatic formulation in its manufacture because heaps of proofs in
Path Semantics requires no or limited kind checking within the “point-free vogue”.

Rep of Poi

Poi is designed to be usual as a Rust library.

It formulation that anybody might possibly possibly well make their possess tools on prime of Poi,
without desiring heaps of dependencies.

Poi uses essentially rewriting-guidelines for theorem proving.
This implies that the core manufacture is “tedious” and might possibly possibly well merely manufacture dreary issues esteem running
in limitless loops when given the depraved guidelines.

On the opposite hand, this manufacture makes furthermore Poi very versatile, because it can well sample match
in any formulation, impartial of computational route.
It is moderately easy to clarify such guidelines in Rust code.

Syntax

Poi uses Piston-Meta to characterize its syntax. Piston-Meta is a meta parsing language for human readable textual voice material paperwork.
It makes it that it’s most likely you’ll well well take into accout to without anguish create changes to Poi’s grammar,
and furthermore retain backward compatibility.

Since Piston-Meta can characterize its possess grammar guidelines, it formulation that future
versions of Piston-Meta can parse grammars of used versions of Poi.
The used paperwork can then be transformed into peaceful versions of Poi using synthesis.

Core Rep

At the core of Poi, there is the Expr structure:

/// Feature expression.
#[derive(Clone, PartialEq, Debug)]
pub enum Expr {
    /// A image that is common on the side of symbolic knowledge.
    Sym(Symbol),
    /// Some feature that returns a worth, ignoring the argument.
    ///
    /// This might possibly possibly well be usual to retailer values, since zero arguments is a worth.
    Ret(Note),
    /// A binary operation on capabilities.
    Op(Op, Field, Field),
    /// A tuple for greater than one argument.
    Tup(Vec),
    /// A checklist.
    List(Vec),
}

The simplicity of the Expr structure is obligatory and heavily in step with
evolved direction semantical knowledge.

A image incorporates every domain-particular image and “avatar extensions”
of symbols. An “avatar extension” is a scheme of integrating knowledge
processing from building blocks that don’t get any relatives for introspection.
This means, that even some variants of Symbol are no longer symbols in a bid sense,
they’re build there because they “integrate knowledge” of symbols.
For instance, a variable is classed as a 1-avatar since it “integrates knowledge” of a single image or expression. “Avatar extensions” happen
normally in Path Semantics for very subtle mathematical relatives, but on the total manufacture no longer wish to be represented explicitly.
As a replacement, they’re usual as a “handbook” to manufacture.
Eye the paper Avatar Graphs for added knowledge.

The Ret variant comes from the notation usual in Bigger Reveal Operator Overloading. As a replacement of describing a worth as cost,
it’s a long way taken into story a feature of some unknown enter kind, which returns a known cost. For instance, if a feature returns 2 for all inputs, that is written 2.
This implies that point-free transformations on capabilities in most cases can compute stuff, without explicitly desiring to reference the concrete cost straight.
Eye paper Bigger Reveal Operator Overloading and Existential Path Equations for added knowledge.

The Op variant generalizes binary operators on capabilities,
equivalent to Composition, Path (same outdated direction),
Be conscious (name a feature) and Constrain (partial capabilities).

The Tup variant represents tuples of expressions, where a singleton (a tuple of 1 aspect) is
“lifted up” one level. Right here’s usual e.g. to transition from and[not x not -> not] to and[not] without having to write guidelines for asymmetric conditions.

The List variant represents lists of expressions, e.g. [1, 2, 3].
This differs from Tup by the property that singletons are no longer “lifted up”.

Representing Files

In greater dimensions of purposeful programming, the definition of “normalization”
is counting on the domain particular exercise of a idea. Intuitively, since there are
extra directions, what counts as development toward an resolution is critically
chosen arbitrarily. Therefore, the subjectivity of this desire might possibly possibly well merely peaceful be
mirrored within the illustration of knowledge.

Poi’s illustration of knowledge is designed for multi-capabilities.
In difference to in same outdated programming, you manufacture no longer are wanting to continually manufacture e.g. evaluation.
As a replacement, you manufacture diversified tools for diversified capabilities, using the same
knowledge.

The Files struct represents mathematical knowledge in own of guidelines:

/// Represents knowledge about symbols.
pub enum Files {
    /// A image has some definition.
    Def(Symbol, Expr),
    /// A reduction from a extra complicated expression into every other by normalization.
    Pink(Expr, Expr),
    /// Two expressions which would possibly be identical but neither normalizes the diversified.
    Eqv(Expr, Expr),
}

The Def variant represents a definition.
A definition is inlined when evaluating an expression.

The Pink variant represents what counts as “normalization” in a online page particular idea.
It might possibly possibly possibly well exercise computation within the sense of traditional evaluation, or exercise direction-home.
This rule is directional, which formulation it sample fits on the important thing expression
and binds variables, which would possibly be synthesized using the 2nd expression.

The Eqv variant represents alternatives that one can create when touring along a direction.
Going in a single route would possibly be as factual as every other.
Right here’s usual when it’s a long way no longer obvious which route one might possibly possibly well merely peaceful saunter.
This rule is bi-directional, which formulation one can treat it as a discount both ways.

Read More

Categories
Internet of Things
No Comment

Leave a Reply

*

*

RELATED BY