background preloader

Lambda calculus

Facebook Twitter

Monad (category theory) If and are a pair of adjoint functors, with left adjoint to , then the composition is a monad. Are inverse functors, the corresponding monad is the identity functor. . , is discussed under the dual theory of comonads. The monad axioms can be seen at work in a simple example: let we can take the free group functor. This means that the monad takes a set and returns the underlying set of the free group . By including any set in in the natural way, as strings of length 1. Can be made out of a natural concatenation or 'flattening' of 'strings of strings'. They will satisfy some axioms about identity and associativity that result from the adjunction properties. Those axioms are formally similar to the monoid axioms.

If we specialize to categories arising from partially ordered sets (with a single morphism from to iff ), then the formalism becomes much simpler: adjoint pairs are Galois connections and monads are closure operators. Every monad arises from some adjunction, in fact typically from many adjunctions. Monade (Kategorientheorie) Eine Monade ist im mathematischen Teilgebiet der Kategorientheorie eine Struktur, die gewisse formale Ähnlichkeit mit den Monoiden der Algebra aufweist. Eine Monade ist ein Tripel aus so dass die folgenden Bedingungen erfüllt sind: , d. h. das folgende Diagramm kommutiert: , d. h. das folgende Diagramm kommutiert: Explizit bedeutet die Kommutativität der Diagramme, dass für jedes Objekt in die beiden Diagramme kommutieren.

Ist eine Monade, so ist ein Paar eine (Eilenberg-Moore-)Algebra für diese Monade, wenn und gelten. Nach ist ein Pfeil mit Für beliebige Objekte ist daher z.B. eine Algebra, und ist ein Homomorphismus von Der Endofunktor auf der Kategorie der partiell geordneten Mengen und monotonen Abbildungen ordne jedem die partiell geordnete Menge zu. Sei . Und eine Teilmenge ist hierbei Die Abbildungsfamilien und ergänzen den Funktor zu einer Monade. Die Strukturabbildung einer -Algebra ist nun gerade . (und somit jede gerichtete Teilmenge) hat also ein Supremum in . -Algebra ist dasselbe wie eine Dcpo. Bzw. . Ist. Monad (functional programming) Formally, a monad consists of a type constructor M and two operations, bind and return (where return is often also called unit). The operations must fulfill several properties to allow the correct composition of monadic functions (i.e. functions that use values from the monad as their arguments or return value). The return operation takes a value from a plain type and puts it into a monadic container using the constructor, creating a monadic value.

The bind operation performs the reverse process, extracting the original value from the container and passing it to the associated next function in the pipeline, possibly with additional checks and transformations. Because a monad can insert additional operations around a program's domain logic, monads can be considered a sort of aspect-oriented programming.[7] The domain logic can be defined by the application programmer in the pipeline, while required aside bookkeeping operations can be handled by a pre-defined monad built in advance.

Monade (Informatik) In der funktionalen Programmierung sind Monaden ein abstrakter Datentyp. Wesentliche Eigenschaft von Monaden ist die Fähigkeit der Übertragung von Werten und Berechnungen in einem „einfacheren” Typ zu Berechnungen in einem „höheren Typ”, der mittels eines Typkonstruktors aus dem einfacheren Typ hervorgeht, sowie die Verknüpfung mehrerer solcher Übertragungen zu einer einzigen. Die übliche Formulierung einer Monade in der Programmierung hat folgende Komponenten: Ein Typkonstruktor, der für jeden zugrunde liegenden Typ definiert, wie der korrespondierende Monadentyp zu erhalten ist. Der Name dieses Typkonstruktors wird dabei oft synonym mit der ganzen Monade verwendet. Die folgenden Operationen sind typisch für Monaden und können für deren Definition Verwendung finden: Die Einheitsfunktion Der bind-Operator (>>=) :: m a -> (a -> m b) -> m b erlaubt, einen monadischen Typ an eine Funktion zu übergeben, die nur den zugrundeliegenden Typ verwendet.

(dabei steht m für den Typkonstruktor) . Haskell (Programmiersprache) Haskell ist eine rein funktionale Programmiersprache, benannt nach dem US-amerikanischen Mathematiker Haskell Brooks Curry, dessen Arbeiten zur mathematischen Logik eine Grundlage funktionaler Programmiersprachen bilden. Haskell basiert auf dem Lambda-Kalkül, weshalb auch der griechische Buchstabe Lambda als Logo verwendet wird. Die wichtigste Implementierung ist der Glasgow Haskell Compiler (GHC). first x y = x quadrat x = x * x Die Funktion first liefert bei Eingabe zweier Parameter den ersten als Ergebnis zurück. Bei der Eingabe von first x (3+7) ist die Auswertung der Summe (3+7) zur Ergebnisbestimmung nicht notwendig, sollte also unberücksichtigt bleiben. Die Funktion quadrat berechnet bei Eingabe eines Parameters dessen Quadrat.

Die Bedarfsauswertung ist vor allem wegen der strengen Einhaltung des funktionalen Konzepts möglich. Die Bedarfsauswertung erlaubt das Arbeiten mit undefinierten Werten und potentiell unendlich großen Datenmengen. Map :: (a -> b) -> [a] -> [b] oder schreiben. Lambda-Kalkül. Geschichte[Bearbeiten] Alonzo Church benutzte ihn, um 1936 sowohl eine negative Antwort auf das Entscheidungsproblem zu geben als auch eine Fundierung eines logischen Systems zu finden, wie es Russells und Whiteheads Principia Mathematica zugrunde lag. Mittels des untypisierten Lambda-Kalküls kann man klar definieren, was eine berechenbare Funktion ist. Die Frage, ob zwei Lambda-Ausdrücke (s. u.) äquivalent sind, kann im Allgemeinen nicht algorithmisch entschieden werden. In seiner typisierten Form kann der Kalkül benutzt werden, um Logik höherer Stufe darzustellen. Der Lambda-Kalkül hat die Entwicklung funktionaler Programmiersprachen, die Forschung um Typsysteme von Programmiersprachen im Allgemeinen sowie moderne Teildisziplinen in der Logik wie die Typtheorie wesentlich beeinflusst.

Meilensteine der Entwicklung waren im Einzelnen: Der untypisierte Lambda-Kalkül[Bearbeiten] Motivation[Bearbeiten] Gehen wir von einem mathematischen Term aus, so lässt sich daraus die Funktion bilden, die auf. Haskell (programming language) Haskell /ˈhæskəl/[19] is a standardized, general-purpose purely functional programming language, with non-strict semantics and strong static typing. It is named after logician Haskell Curry. In Haskell, "a function is a first-class citizen" of the programming language.[22] As a functional programming language, the primary control construct is the function. The first version of Haskell ("Haskell 1.0") was defined in 1990. The committee's efforts resulted in a series of language definitions (1.0, 1.1, 1.2, 1.3, 1.4). In February 1999, the Haskell 98 language standard was originally published as "The Haskell 98 Report".

In January 2003, a revised version was published as "Haskell 98 Language and Libraries: The Revised Report". The language continues to evolve rapidly, with the Glasgow Haskell Compiler (GHC) implementation representing the current de facto standard.[24] The following is a Hello world program written in Haskell (note that all but the last line can be omitted): JVM-based: Lambda calculus. The lowercase lambda, the 11th letter of the Greek alphabet, is used to symbolize the lambda calculus. Because of the importance of the notion of variable binding and substitution, there is not just one system of lambda calculus, and in particular there are typed and untyped variants. Historically, the most important system was the untyped lambda calculus, in which function application has no restrictions (so the notion of the domain of a function is not built into the system). In the Church–Turing Thesis, the untyped lambda calculus is claimed to be capable of computing all effectively calculable functions.

The typed lambda calculus is a variety that restricts function application, so that functions can only be applied if they are capable of accepting the given input's "type" of data. Lambda calculus in history of mathematics[edit] Informal description[edit] Motivation[edit] Computable functions are a fundamental concept within computer science and mathematics. (read as "the pair of and ").

Lambda calculus.