
Programming Language Theory in Agda - ingve
https://wenkokke.github.io/sf/
======
mbid
This looks like it's (going to be) about a theory of programming languages as
based on some form of the lambda calculus. I think it doesn't get pointed out
enough that this is not a descriptive science but more of a normative theory
with mathematical elements. It doesn't try to analyze and compare existing
programming languages. It asserts how they _ought_ to be and derives
consequences from this. In this sense, it's less like the theory of evolution
and more like a political or aesthetical movement.

Wadler himself seems to dislike calling this "computer science": _" You don't
put science in your name if you're a real science."_ I'm quite sure he meant
it differently, but it fits my argument to quote him out of context :)

The book itself is still unfinished obviously. Most of it seems to be a
formalization of the absolute basics of constructive logic currently. I'm also
not sure how far they are really going to go here; feasibly formalizing the
meta theory of agda (Martin-Löf type theory) in agda itself seems to be an
open problem. Yes, seriously.

I found agda much less opaque than coq and especially isabel. It seems much
more cumbersome to work with in practice though. I doubt agda will ever be
used for serious proofs beyond hello world or very specialized areas as long
as there is not more automation... at which point you're back at a variant of
coq.

~~~
pron
It doesn't assert how they ought to be (theorists, like everyone else, may
express their opinion but this is not what the theory studies). It is a study
of formal systems; basically, it's formal logic under a different name: A
formal system is defined, and its properties studied; another system is
defined and _its_ properties are studied, and so on.

Unfortunately, most texts on PL theory, and this one does not seem to be an
exception, do not explain what a formal system is -- namely what syntax is,
what semantics is, and what the relationship between them is. This leads to
confusion later on.

~~~
mbid
_> It doesn't assert how they ought to be (theorists, like everyone else, may
express their opinion but this is not what the theory studies). It is a study
of formal systems; basically, it's formal logic under a different name: A
formal system is defined, and its properties studied; another system is
defined and its properties are studied, and so on._

This document is called "programming language theory". I would expect from
this the study of programming languages in general. Yet only a tiny fraction
of programming languages are studied, namely exactly one: The simply typed
lambda calculus. So I think it's fair to say that the authors seem to think
that the the simply typed lambda calculus is absolutely central. Yet among
existing programming languages with real world adoption, the pure simply typed
lambda calculus is completely irrelevant. Nobody programs in it. So I can't
take this as a description of the status quo of "programming languages". Then
how am I to interpret the mere existence of this, if not as an endorsement?

 _> Unfortunately, most texts on PL theory, and this one does not seem to be
an exception, do not explain what a formal system is -- namely what syntax is,
what semantics is, and what the relationship between them is. This leads to
confusion later on._

I doubt you'll find a general definition of what _a_ type system is. You'll
find many examples, sure, but no general definition. (BTW, thanks for assuming
I'm confused about this. I think I've talked with enough type theory
researchers to conclude that they are the confused ones.) Case in point: The
plethora of papers whose first sections have to introduce the type system in
question. This also relates to your first point, where you argue that PL
theory is not normative. If the type theory in question has to be introduced,
it automatically means that the reader has to be convinced that what he's
reading is not just random noise encoded as formulae and proofs. Most of the
type systems studied are not used in the wild, so they can't be interesting
because they describe something people are already interested in. The only
other possible explanation for the relevance of these papers is that the
authors hope to improve upon what already exists.

Finally, take some of Wadler's papers. If "Theorems for free" (spoiler: the
theormes there are not freer than other theorems) or "Linear types can [!]
change the world" are not endorsements, I don't know what is.

~~~
rntz
> Most of the type systems studied are not used in the wild, so they can't be
> interesting because they describe something people are already interested
> in. The only other possible explanation for the relevance of these papers is
> that the authors hope to improve upon what already exists.

Your argument here amounts to: if it's not descriptive, it must be
prescriptive. By this argument, the entirety of pure mathematics is
prescriptive. Is the idea of a semiring a description of a particular natural
object? But it makes little sense to claim the idea of semirings is normative.
After all, math studies many structures that _don 't_ satisfy the semiring
laws, as well!

Likewise, computer science studies many forms of "computation" which aren't
physically realistic. Is computational complexity theory "normative" in
studying Turing machines, or PRAM machines? No, they are merely convenient
abstractions which get at the essence of a particular problem.

The lambda calculus is similar: it is a convenient abstraction which gets at
the essence of a particular way of computing. It's a useful starting point for
a certain kind of PL theory because its semantics are relatively simple. But
it's certainly not the case that all PL theory studies the lambda calculus. PL
theory includes work on verification of imperative programs; on macro
expanders; on compilation techniques; and on pure logic.

What is certainly true is that many people who study PL theory _do_ have
normative (usually aesthetic) ideas about PL design, and these seep into the
kinds of systems they tend to study. I agree that computer science isn't a
natural science. But it isn't as simple as "anything not descriptive is
normative", or that (quoting a sibling comment) PL theory is just "a theory of
some variant of the lambda calculus".

~~~
mbid
_> Your argument here amounts to: if it's not descriptive, it must be
prescriptive. By this argument, the entirety of pure mathematics is
prescriptive. Is the idea of a semiring a description of a particular natural
object? But it makes little sense to claim the idea of semirings is normative.
After all, math studies many structures that don't satisfy the semiring laws,
as well!_

Yes, to some extent, mathematics is prescriptive. Publishing a paper on
semirings or computable functions means that you think these objects are
interesting and should be studied. But pure mathematicians usually stop here,
they don't pretend their research has value because it related to the real
world somehow. It's just supposed to be interesting on its own. On the other
hand, type theorists push their theory with the expectation that it is useful
for creating computer programs despite decades of contrary, if any, evidence.
I wouldn't mind types studied the same way that, say, first order predicate
logic is studied. The fact that most of the type theory researchers seem to
hail from CS departments seems to suggest that types would simply fade into
irrelevance however.

I also see a difference in the extent that mainstream mathematics is
prescriptive vs descriptive. Certainly you would agree that most mainstream
maths, say number theory or differential topology, is much less definition-
heavy than type theory is. And most definitions in pure maths have auxiliary
character, they are only interesting in that they help clarify proofs.
Sometimes it happens that definitions turn from auxiliary to interesting in
their own right; this happens mostly when the same construction makes sense in
multiple context.

In type theory, on the other hand, definitions, and not of the auxiliary kind,
make up most of the work. The proofs are usually mere bureaucracy, with
definitions set up so that the facts the researcher wants to hold do so
essentially by definition. Thus the definitions, i.e. the prescriptive part,
is really the main contribution of type research.

 _> But it's certainly not the case that all PL theory studies the lambda
calculus. PL theory includes work on verification of imperative programs; on
macro expanders; on compilation techniques; and on pure logic._

Well, the linked document is called "PL theory", so I simply assumed that it
would cover all of it to some depth and not just a particular subfield. May
impression is that the "type" paradigm is the dominant one in PL research and
I simply assumed the authors of the linked paper have the same impression
given their selection of material. I certainly didn't mean to discredit the
other fields you mentioned, I simply can't have an informed opinion about
them.

