
Learn you an Agda - pykello
http://learnyouanagda.liamoc.net/
======
eggy
For enlightenment learn Agda. For transcendence, learn Idris ;) I would like
to learn either Idris or Agda for their relationship to mathematics, but I am
tempted by Idris also being able to do general programming with its compile
targets. How does Agda compare to Idris on this point?

~~~
sjolsen
Runtime performance for Agda... well, it leaves a lot to be desired, at least
with respect to the MAlonzo compiler. For example, operations on the natural
numbers à la Data.Nat get very slow very quickly-- but while the
representation used by Data.Bin speeds things up a _lot_ , you just can't do
the same Peano-style structural induction on it.

------
musername
> _Agda’s logic is constructive, which means it’s impossible to prove the
> statement that all statements are either true or false, . This proposition
> is called the law of the excluded middle. This makes it impossible to
> perform, for example, a general proof by contradiction, or other similar
> “classical” proofs from mathematics. There is a large philosophical debate
> among mathematicians (those who follow Hilbert, and those who follow
> Brouwer) as to which is better_

Still, for a subset of statements and properties it is possible to construct a
law of excluded middle, but it has to be a constructive proof. The whole idea
of Constructive Mathematics is that you have to show a proof for both, the
statement and it's negation to hold their respective truth values. The
impossibility to proof the first statement, that of all statements the
negation is implied, is surely tautologic, assuming it would hold true for
_most of all_ statements, just not a class the opening one is part of. This
class is an empty element.

I would basically assume this means nonsense statements can be constructed,
but they can't be used in constructive proofs. It doesn't imply that there has
to be a class of nonsense statements where the opposite still holds value. I'm
cautios of the definition for statements like there or in the multiple
incarnations of the liars paradox (whats the latin plural). IE. a statement
should by definition be provably correct either in positive or negative logic,
hi and low to use ee terms, and one should imply the other polarity (edit:
just not by using negation, because that's the relation you want to prove,
without circular logic). The _empty element_ is like null, but what logic set
the true ^ negative or just the true statements have to be defined in I dont
know.

Interesting to know that there is a tool for this kinda maths, I was under the
impression that the debate tends to inductive methods, but here we have
intuitionistic (constructive) logic, I take it.

~~~
tel
I'm not sure everything you're talking about, but it's relatively easy to
reason about constructive logic by abandoning the idea that your logic is one
of "truth and falsehood"—which are, by modern, western intuition mutually
exclusive options—but instead one concerning evidence.

One might believe that the Collatz conjecture is true or false, but we
certainly lack evidence for either case today. This isn't exactly three value
logic, but instead something else. A logic which incorporates the notion of
time and communication of proof.

~~~
nmrm
> which incorporates the notion of time and communication of proof.

Certainly constructive logics (typically) incorporate a notion of
evidence/proof. But constructive logics don't incorporate notions of time or
communication (of proof, or in general).

~~~
tel
Yeah, to be clear, those notions aren't internalized... they just bring into
clarity the need for those processes to happen in the meta level.

------
sjolsen
This was one of my first encounters with Agda, and it's a language I've
developed something of a soft spot for. I highly recommend playing with it if
you have any interest in Haskell or ~undergraduate-level pure mathematics.

------
pykello
I also found the following very useful:

* A Demonstration of Agda ([https://www.youtube.com/watch?v=8WFMK0hv8bE](https://www.youtube.com/watch?v=8WFMK0hv8bE))

* Agda Tutorial ([http://people.inf.elte.hu/divip/AgdaTutorial/Index.html](http://people.inf.elte.hu/divip/AgdaTutorial/Index.html))

------
msl09
That was the most enjoyable and accessible introduction to Agda that I have
ever seen. If you are the creator, please continue the development of the
tutorial.

------
shocks
> At the time of writing, it is only really feasible to edit Agda code using
> Emacs.

Why?

~~~
CHY872
It's really just basic editor support. Agda is quite an interactive
programming language, so you need lots of shortcuts, syntax highlighting,
autofilling etc in order to get productivity at all (especially since you're
constantly moving stuff in and out of a repl)

[https://youtu.be/pP7ynVdVY9A?t=13m](https://youtu.be/pP7ynVdVY9A?t=13m) gives
a decent example.

As to why support isn't in other editors, it's probably a combination of: more
code to support, no one wants to write it, and the fact that Agda is less
amenable to being sped up by efficient usage of editors (as it is a more
interactive process with less copy pasting).

~~~
black_knight
I have to disagree to that one needs syntax highlighting and autofilling to be
productive in Agda. I have written a fair amount of agda code in Acme, which
has neither. Rather I find these bells and whistles distracting — and prefer
giving my complete attention to the task at hand.

I think that writing agda code interactively in Emacs is fine, but it is
certainly not the only way to write good agda code. In fact writing without
the interactive support encourages better code structure. One is more likely
to factor a complicated line into several help terms (using 'where', for
example), which makes the code more readable.

------
seanwilson
Does Agda have any significant proof automation yet compared to say Coq? If
not, how practical is it to use?

~~~
musername
there is an agda shell for interactice proving in emacs, with some
automations.

 _convenience offered by agda-mode: automatic generation of case analysis,
refinement of holes, autocompletion of code based on types to name a few._
[http://lambda.jstolarek.com/2013/12/idris-first-
impressionsi...](http://lambda.jstolarek.com/2013/12/idris-first-
impressionsions/)

------
platz
don't forget about [https://www.fstar-lang.org/](https://www.fstar-lang.org/)

------
jaseemabid
First step: Learn Haskell :D

