Content deleted Content added
No edit summary Tags: Reverted Mobile edit Mobile web edit |
No edit summary |
||
(20 intermediate revisions by 14 users not shown) | |||
Line 1:
{{
{{
{{Use dmy dates|date=September 2024}}
{{Infobox programming language
| name = Agda
| logo = Agda's official logo.svg
| logo_size = 220px
| logo alt = A stylized chicken in black lines and dots, to the left of the name "Agda" in sans-serif test with the first letter slanted to the right.
| paradigm = [[Total functional programming|
| year = {{Start date and age|2007}} (1.0 in {{Start date and age|1999}})▼
| designer = Ulf Norell; Catarina Coquand (1.0)
| developer =
▲|
| latest release version = 2.6.3▼
| latest release
| latest
| latest
| typing = [[Strong and weak typing|strong]], [[Static typing|static]], [[Dependent typing|dependent]], [[Nominal typing|nominal]], [[Manifest typing|manifest]], [[Inferred typing|inferred]]
| implementations =
| dialects =
| influenced = [[Idris (programming language)|Idris]]
| programming language = [[
| influenced by = [[Coq (software)|Coq]], [[Epigram (programming language)|Epigram]], [[
| license = [[BSD licenses|BSD-like]]<ref>[http://code.haskell.org/Agda/LICENSE Agda license file]</ref>
| file ext = <code>.agda</code>, <code>.lagda</code>, <code>.lagda.md</code>, <code>.lagda.rst</code>, <code>.lagda.tex</code>
| operating system = [[Cross-platform software|Cross-platform]]
| website = {{URL|https://wiki.portal.chalmers.se/agda}}
}}
'''Agda''' is a [[Dependent type|dependently typed]] [[
</ref> The original Agda system was developed at Chalmers by Catarina Coquand in 1999.<ref>{{Cite web |url
Agda is also a [[proof assistant]] based on the
Agda is based on Zhaohui Luo's unified theory of dependent types (UTT),<ref>Luo, Zhaohui. ''Computation and reasoning: a type theory for computer science''. Oxford University Press, Inc., 1994.</ref> a type theory similar to [[Intuitionistic type theory|Martin-Löf type theory]].
Agda is named after the [[Swedish language|Swedish]] song "Hönan Agda", written by [[Cornelis Vreeswijk]],<ref>{{cite web |title
== Features ==
Line 40 ⟶ 42:
Here is a definition of [[Peano axioms|Peano numbers]] in Agda:
<syntaxhighlight lang="agda">
</syntaxhighlight>
Basically, it means that there are two ways to construct a value of type <math>\mathbb{N}</math>, representing a natural number. To begin, <code>zero</code> is a natural number, and if <code>n</code> is a natural number, then <code>suc n</code>, standing for the [[Successor function|successor]] of <code>n</code>, is a natural number too.
Line 48 ⟶ 50:
Here is a definition of the "less than or equal" relation between two natural numbers:
<syntaxhighlight lang="agda">
</syntaxhighlight>
The first constructor, <code>z≤n</code>, corresponds to the axiom that zero is less than or equal to any natural number. The second constructor, <code>s≤s</code>, corresponds to an inference rule, allowing to turn a proof of <code>n ≤ m</code> into a proof of <code>suc n ≤ suc m</code>.<ref>{{Cite web |url
=== Dependently typed pattern matching ===
In core type theory, induction and recursion principles are used to prove theorems about [[inductive type]]s. In Agda, dependently typed pattern matching is used instead. For example, natural number addition can be defined like this:
<syntaxhighlight lang="agda">
</syntaxhighlight>
This way of writing recursive functions/inductive proofs is more natural than applying raw induction principles. In Agda, dependently typed pattern matching is a primitive of the language; the core language lacks the induction/recursion principles that pattern matching translates to.
=== Metavariables ===
One of the distinctive features of Agda, when compared with other similar systems such as [[
<syntaxhighlight lang="agda">
add : ℕ → ℕ → ℕ
</syntaxhighlight>
<code>?</code> here is a metavariable. When interacting with the system in
=== Proof automation ===
Programming in pure type theory involves a lot of tedious and repetitive proofs. Although Agda has no separate tactics language, it is possible to program useful tactics within Agda
<syntaxhighlight lang="agda">
</syntaxhighlight>
(The pattern <code>()</code>, called ''absurd'', matches if the type checker finds that its type is uninhabited, i.e. proves that it stands for a false proposition, typically because all possible constructors have arguments that are unavailable, i.e. they have unsatisfiable premisses. Here no value of type <code>isJust A</code> can be constructed because, in that context, no value of type <code>A</code> exists to which we could apply the constructor <code>Just</code>. The right hand side is omitted from any equation that contains absurd patterns.) Given a function <code>check-even : (n : <math>\mathbb{N}</math>) → Maybe (Even n)</code> that inputs a number and optionally returns a proof of its evenness, a tactic can then be constructed as follows:
<syntaxhighlight lang="agda">
</syntaxhighlight>
The actual proof of each lemma will be automatically constructed at type-checking time. If the tactic fails, type-checking will fail.
</ref>
Another mechanism for proof automation is proof search action in
</ref>
=== Termination checking ===
Agda is a [[
=== Standard library ===
Agda has an extensive de facto [[standard library]], which includes many useful definitions and theorems about basic data structures, such as natural numbers, lists, and vectors. The [[Library (computing)|library]] is in beta, and is under active development.
=== Unicode ===
One of the more notable features of Agda is a heavy reliance on [[Unicode]] in program source code. The standard
=== Backends ===
Line 137 ⟶ 135:
* [https://www.youtube.com/playlist?list=PLB7F836675DCE009C Introduction to Agda], a five-part YouTube playlist by Daniel Peebles
* [http://oxij.org/note/BrutalDepTypes/ Brutal {{bracket|Meta}}Introduction to Dependent Types in Agda]
* [
* [https://www.youtube.com/playlist?list=PLtIZ5qxwSNnzpNqfXzJjlHI9yCAzRzKtx HoTTEST Summer School 2022], 66 lectures on Homotopy Type Theory, including
{{Haskell programming}}
Line 153 ⟶ 151:
[[Category:Haskell programming language family]]
[[Category:Cross-platform free software]]
[[Category:Free
[[Category:Chalmers University of Technology]]
[[Category:Programming languages created in 2007]]
[[Category:2007 software]]
<!-- Hidden categories below -->
[[Category:Articles with example Haskell code]]
|