Agrofertil Panama
Image default
Internet

Agda — among the most advanced programming languages

Agda is a functional programming language with dependent typing originally developed by Ulf Norell of the Chalmers University of Technology, with the implementation described in his Ph.D. thesis. The original Agda system was developed at Chalmers by Katharina Kokand in 1999. 

The current version is a completely rewritten language. Agda is also a proof assistant based on the sentence-as-types paradigm, but, unlike Coq, it has no separate language for tactics and proof written in a functional programming style. The language has the usual programming constructs, such as data types, pattern matching, records, expressions, and let modules, as well as Haskell-like syntax. The system has Emacs and Atom interfaces run in batch mode from the command line. Wish to learn the basics of Agda? Here is my favorite tutorial on Agda.

Agda is based on Zhaohui Luo’s Unified Dependent Type Theory (UTT), which is similar to Martin-Lööf. Language is named after the Swedish song “Hönan Agda,” written by Cornelis Vreeswijk.

Features

Let’s take a look at the main features of Agda.

Inductive types

The best way to define data in Agda is inductive data types, which are similar to algebraic in programming languages with independent typing. Essentially, this means that there are two ways to construct a value of type N, representing a natural number.

Dependently typed mapping

In basic type theory, principles of induction/recursion used to prove inductive type theorems. Agda uses dependent-type matching instead. This way of writing recursive functions/inductive proofs is more natural than using raw induction principles. In Agda, the dependent-type pattern matching is a primitive of a language; there are no induction/recursion principles in the underlying language into which the pattern matching is translated.

Metavariables

One of the distinguishing features of Agda compared to other similar systems such as Coq is its reliance on meta-variables for program construction. For example, you can write functions as a meta-variable. When interacting with the system in emacs mode, it will show the type expected by the user and allow you to refine the meta-variable, i.e., replace it with more detailed code. This function allows the step-by-step creation of programs similar to tactical proof assistants such as Coq.

Completion check

In Agda, every program must be complete and patterns match. Without this feature, the logic of the language becomes inconsistent, and it becomes possible to prove arbitrary statements. Agda uses the Fetus termination checker method to verify completion.

Standard library

Agda’s library includes many definitions and theorems about basic data structures such as natural numbers, lists, and vectors. The library is in beta and is under active development.

Concrete syntax 

Agda’s syntax is inspired by Haskell. It also contains a few distinctive features, such as mix operators and full support for Unicode identifiers and keywords.

Module system

The Agda module system supports split compilation and allows the use of parameterized modules. Together with Agda record types, the module system provides a powerful mechanism for structuring large developments.

Emacs interface

Using the Agda interface in Emacs, programs can be developed, leaving parts of the program unfinished. By checking the type of incomplete program, the programmer can get useful information about how to complete the missing parts of the program. The Emacs interface also provides syntax highlighting and code navigation tools.

Conclusion

Agda is one of the most advanced functional programming languages, advanced feature explanation for Agda programming language you can check here. Despite the fact that such languages are mainly used for research and educational purposes, it is worth learning, since they may become as common as the functional approach to working with collections.