Content deleted Content added
Omnipaedista (talk | contribs) standardized punct. |
No edit summary |
||
(48 intermediate revisions by 37 users not shown) | |||
Line 1:
{{
{{Distinguish|text = the programming language [[Ada (programming language)|Ada]]}}
{{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
| 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.1▼
| 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
Agda is named after the [[Swedish language|Swedish]] song "Hönan Agda", written by [[Cornelis Vreeswijk]],<ref>{{
== Features ==
Line 38 ⟶ 41:
Here is a definition of [[Peano axioms|Peano numbers]] in Agda:
<
</syntaxhighlight>
Basically, it means that there are two ways to construct a value of type
Here is a definition of the "less than or equal" relation between two natural numbers:
<
</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>
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 [[
<
add : ℕ → ℕ → ℕ
</syntaxhighlight>
<code>?</code> here is a metavariable. When interacting with the system in
▲<code>?</code> here is a metavariable. When interacting with the system in emacs mode, it will show the user expected type and allow them to refine the metavariable, i.e., to replace it with more detailed code. This feature allows incremental program construction in a way similar to tactics-based proof assistants such as Coq.
=== 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>
(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 :
<
</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 122 ⟶ 121:
==See also==
▲* [[HOL (proof assistant)]]
== References ==
{{reflist}}
==Further reading==
* {{cite web |first1=Ana |last1=Bove |first2=Peter |last2=Dybjer |first3=Ulf |last3=Norell |date=n.d.
*
== External links ==
* {{Official website|wiki.portal.chalmers.se/agda}}
* [https://www.youtube.com/playlist?
▲* [http://www.cse.chalmers.se/~ulfn/papers/afp08/tutorial.pdf Dependently Typed Programming in Agda], by [[Ulf Norell]]
* [http://oxij.org/note/BrutalDepTypes/ Brutal
▲* [http://www.cse.chalmers.se/~ulfn/papers/tphols09/tutorial.pdf A Brief Overview of Agda], by Ana Bove, Peter Dybjer, and [[Ulf Norell]]
* [
▲* [https://www.youtube.com/playlist?p=B7F836675DCE009C Introduction to Agda], a five-part YouTube playlist by Daniel Peebles
* [https://www.youtube.com/playlist?list=PLtIZ5qxwSNnzpNqfXzJjlHI9yCAzRzKtx HoTTEST Summer School 2022], 66 lectures on Homotopy Type Theory, including many introductory lectures and exercises on Agda
▲* [http://oxij.org/note/BrutalDepTypes/ Brutal [Meta]Introduction to Dependent Types in Agda]
▲* [http://people.inf.elte.hu/divip/AgdaTutorial/Index.html Agda Tutorial: "explore programming in Agda without theoretical background"]
{{Haskell programming}}
{{
[[Category:Programming languages]]
Line 149 ⟶ 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]]
|