Better HN
topnewbestaskshowjobs
Log inSign up

fmap

785 karma · joined Jan 15, 2011 (15y ago) · 257 submissions

Submissions

comment 10y ago · link · parent

Yes, this is a good idea. What I'm concerned about is that there is no standard terminology. The paper - and another comment in here! - is talking about the proof being "non-constructive", when in reality it is a constructive proof in 2-EXPTIME.

I'm only nitpicking here, because I'm seeing this a lot...

comment 10y ago · link · parent

This is a nice proof. I just want to mention that it is also completely constructive - all objects involved are finite and so exhaustive search supplies the necessary instance of excluded middle.

We really don't have a good terminology for distinguishing between efficient constructive proofs (those corresponding to efficient algorithms) and inefficient ones...

comment 10y ago · link · parent

Any function f of type

  f : forall a b. (a -> b) -> F a -> F b
Such that f id = id is automatically a functor (respects composition).

In type theory, every equivalence is automatically natural.

There's a lot more and it's made worse by the fact that most of the side conditions are redundant even in normal category theory. For instance, you can specify an adjunction using two functions F : A -> B and G : B -> A, together with an equivalence phi : forall a b. Hom(F a, b) = Hom(a, G b) such that phi satisfies one additional equation. It follows from this that F, G are functors and that the equivalence is natural. Since a lot of definitions in category theory mention adjunctions you can usually simplify the definitions like this. For example the definition of a Cartesian closed category in most textbooks expands to something like 20 equations, but you can simplify it down to the usual few equations which specify a model of simply typed lambda calculus.

comment 10y ago · link · parent

In mathematics, I would describe category theory as an offshoot of structuralism. The main idea is that instead of starting with some "premodel" of what you want to study ("I want to study geometry on surfaces, so I'm looking at subsets of R^3!") and then taking away structure ("...but what is the preferred center of the universe? I better only look at properties which are invariant under translations..."), you try to identify structure in your problem and then determine the consequences. This is obvious in retrospect. If your models describe reality and everything is built out of sets then is 0 an element of 2?

Category theory provides useful tools for identifying structure. It's not necessarily a good vocabulary to talk about these things. Forcing everything into a first-order mold is typically confusing. On the other hand, there has been a lot of work using category theory to solve real problems. This has resulted in some sophisticated tools and a very "scalable" way of looking at things (e.g. universal properties and adjunctions are everywhere).

Category theory is needlessly complicated. There are many redundant side conditions, and the definitions are ... let's be charitable and call them idiosyncratic. This is just more apparent when you apply catgeory theory to programming languages. In semantics you already have a precise way of writing statements (type theory) and you know that everything you can write down is parametric. This eliminates almost all side conditions on most definitions in category theory. So yes, coming from Haskell, catgeory theory probably looks extremely complicated and not worth the effort to learn it.

However, some of the tools from category theory are as useful to computer science as differentiation is to engineering. There are plenty of questions to which you can calculate the answer using some elementary category theory. What is the dual concept to the reader monad transformer? What is the eta law for sum types? Can this data structure be a monad? If not, can I embed it into a monad (e.g. using codensity)? These are all simple questions, but if you don't know the general strategy for dealing with them it seems like I'm asking you to solve a puzzle instead of asking you to compute 7 * 4.

comment 10y ago · link · parent

Very cool project with a great name!

If you haven't looked at it already, you may be interested in Arthur Charguéraud's work on program verification using characteristic formulas (http://www.chargueraud.org/softs/cfml). CFML is a similar tool for ocaml verification using Coq.

comment 10y ago · link · parent

If you demand that the program terminates (through higher order structural recursion, i. e. by induction) then this would be a proof in type theory. It's called proof by reflection. When Martin Löf (the father of type theory) saw this trick for the first time he apparently exclaimed "but this is not a proof!" so make of that what you will.

comment 10y ago · link · parent

I can't speak for applications in physics, but in combinatorics and analytic number theory there is no magic involved. The idea in combinatorics is that you start by looking at the ring of infinite sequences over C with componentwise addition and Dirichlet multiplication as the product. That is, if a, b : nat -> C we define

  (a <*> b)(n) = \sum_{k | n} a(k) * b(n/k)
It is easy to check that this is a ring, and it has wonderful properties which make it very easy to solve many equations of interest in this ring. This is usually called the ring of "arithmetic functions".

However, it is difficult to get asymptotic estimates for the coefficients of a series by purely algebraic means. This is the first and last time that complex valued functions enter the picture, but it's a very neat trick. Let's consider two series a, b and define the functions

  A(s) = \sum_{n >= 1} a(n) * n^-s
  B(s) = \sum_{n >= 1} b(n) * n^-s
then we have

  A(s) * B(s) = \sum_{n >= 1} (\sum_{k | n} a(k) * b(n/k)) * n^-s = \sum_{n >= 1}  (a <*> b)(n) n^-s
So this mapping, from the ring of arithmetic functions to the ring of (partial) complex functions with pointwise addition and multiplication. Glossing over some details for now, this allows you to analyze the function belonging to a sequence to gain information about the sequence itself. In particular, you can use the theory of complex integration and Cauchy's residue theorem to gain information about (partial sums of) coefficients.

Unfortunately, the world is not quite this simple. The functions we are mapping into typically aren't very well behaved and usually aren't defined on large parts of the complex plane (consider a(n) = n^n). This means that all of our nice tools from complex analysis actually won't work very well!

The whole idea behind "analytic continuations" is that we aren't actually using this mapping! We are constructing a different (partial, injective) ring homomorphism from arithmetic functions to meromorphic complex functions.

The idea behind this is that meromorphic functions are rather restricted in what they can do. In particular, there is at most one meromorphic function A with A(s) = \sum_{n >= 1} a(n) n^-s for s with Re(s) > k, for some k. We define our mapping from sequences to functions by mapping the sequence a(n) to the meromorphic function A(s) with A(s) = \sum_{n >= 1} a(n) n^-s for Re(s) > k for some k, if this function exists.

By the same argument as above, this is a ring homomorphism, and since it is injective we can still use information about the functions to gain information about the underlying sequences.

For example, the Riemann zeta function is not really defined by the equation Zeta(s) = \sum_{n >= 1} n^-s. It is defined to be the unique meromorphic function with Zeta(s) = \sum_{n >= 1} n^-s for all s with R(s) > 1. In particular, Zeta(-1) has nothing to do with \sum_{n >= 1} n. The latter expression doesn't define a complex number at all, but for the former it is not too difficult to show that Zeta(-1) = -1/12.

The main advantage, though, is that meromorphic functions are very well behaved. This allows us to use Cauchy's residue theorem and Mellin transforms to get very deep results about the underlying sequences. If you play this game with the "von Mangoldt" sequence you can, for instance, derive an asymptotic bound on the density of the prime numbers. This is a surprisingly simple derivation, given that this problem had the worlds greatest mathematicians stumped for a hundred years!

Summing up, the mapping or "continuation" you use is choosen (!) so that multiplication of functions corresponds to your chosen multiplication in the ring of sequences and so that you get functions which are as well-behaved as possible. There is a large design space here, and you can find different "analytic continuations" for a given sequence.

comment 10y ago · link · parent

It isn't so simple, unfortunately. The idea behind set theory was to describe some universal building blocks of mathematics. The problem is that - unlike in the case of computable functions - such a universal building block can't exist.

There's a lot of mathematics which can't be formalized in classical first-order logic with the ZFC axioms. For most things you can get around this by adding enough Grothendieck universes, but this is still incomplete and always will be.

comment 10y ago · link · parent

I think it's a nice analogy. It's a bit tongue in cheek, but it does give you the right idea when you compare it to programming languages.

Set theory is a reductionistic system. It's supposed to give a foundation which is as "small" as possible. In set theory you start with almost nothing and you have to encode all useful concepts into sets before you can start proving/programming.

Compare this to Turing machines, where you start with a very primitive model of computation. The first step in most treatments of Turing machines is similar to set theory, you show that some useful concepts (associative memory, high-level control flow, etc.) can be encoded into Turing machines. You then use this encoding to construct arbitrary programs.

Type theory starts out with a functional programming language and you derive new concepts from free constructions. In type theory you shouldn't be encoding things at all. You should be describing concepts (~adding an API) and possibly extending your model (~the compiler).

As analogies go, I'd say that this one is pretty accurate.

comment 10y ago · link · parent

In particular, there has been a ton of work on automating inductive proofs.

So while I enjoyed the article, I'm not sure what's up with the first sentence. This is definitely not the first inductive theorem prover.

Funnily enough, the most advanced prover with auto induction (ACL2) is also based on pattern matching and cleverly chosen heuristics. There are more specialized methods such as rippling, implicit induction, etc., but making this work well is apparently difficult.

comment 10y ago · link · parent

It comes down to levels of assurance. The rules of inference you are using are part of your design space. Mathematics at its core is about clever problem solving. When you encounter a problem you have to decide what you would accept as a proof, and this forces you to accept certain reasoning principles.

The caveat is that this is non-trivial and it's very easy to make people accept assumptions which are completely wrong. That's really the main reason to accept the axioms of set theory: People have been trying to poke holes in them for a hundred years and nobody has managed it yet. If you can use set theory (or something equiconsistent) to solve your problem, chances are that nobody will be able to call you out on a mistake.

comment 10y ago · link · parent

If there are ever more compelling use cases for smart contracts this will create a market for smart contract validation or development.

Interactive theorem proving is already at the level that verifying something like the DAO (a few hundred lines of code!) isn't too complicated. By the time smart contracts become relevant we'll probably have all the tools in place to make this an industry instead of a research project.

comment 10y ago · link · parent

They make their money off of advertising. Facebook is competing with them in this regard and if they can't replace them, the next best thing would be to undercut the competition.

I think that's the scenario the parent was thinking of. But, as you said, Google is still going for replacing Facebook. We'll have to wait and see how this turns out...

comment 10y ago · link · parent

That is an actual engineering job. A colleague of mine used to work as a research programmer at cmu. This is what he was doing.

comment 10y ago · link · parent

Let's talk again in a few years. :)

In all seriousness, though, I'm also just speaking from personal experience. That said, if you are working in type theory, chances are that you will end up skimming almost everything on this list...

comment 10y ago · link · parent

It's more of a vocabulary issue. In PL theory "type inference" is a well-defined concept. It means that you have the ability to reconstruct the types of a program without annotations.

No mainstream (imperative) programming language has type inference in this sense (for good reasons). That's why the term is usually used with a different meaning when talking about mainstream programming languages.

comment 10y ago · link · parent

You're seriously underestimating the amount of work that goes into a phd, or into writing a textbook...

comment 10y ago · link · parent

There is a lot of room for improvement with the implementation. The way we are using deep neural networks at the moment is exellent for prototyping, but far from optimal. For instance, this paper http://arxiv.org/abs/1511.00363 shows that you can replace floating point operations by simple bitwise operations without losing too much precision in DNNs for image recognition. Together with a better (that is, compiled, instead of interpreted) representation of the inference step I would expect an order of magnitude improvement at a small loss in precision. More software tuning, especially the kind of low-level optimizations that most chess programs do, should yield another big improvement.

Finally, the hardware we are using to run these programs is insane. Sure the silicon is approaching some hard physical limits, but your processor spends most of that power trying to make old programs run fast...

My prediction is that with enough ressources it is possible to write a Go AI which runs on general purpose hardware that's manufactured on current process nodes and fits in your pocket.

comment 10y ago · link · parent

Computer science is a broad field and not all of us are doing our PhDs in software engineering. There are some things which you just can't do in the industry yet, since the technology is not at a point where it is commercially viable. The question you really need to ask is "will this project make money in 5 months?" If the answer is no, and you currently have no credentials, then it'll be a very though sell...

comment 10y ago · link · parent

This is a wonderful series of articles and I find myself nodding along with most of it. However, these lines really made me cringe:

  A child was sent to me for tutoring because of failing a geometry class, and gave this excuse: " I must have been absent on the day when they explained how to prove a theorem." 

  No wonder this child was confused—and seemed both amazed and relieved when I explained that there was no standard way to make proofs—and that “you have to figure it out for yourself”.  One could say that this child simply wasn’t told the rules of the game he was asked to play.  However, this is a very peculiar case in which the ‘rule’ is that there are no rules! (In fact, automatic theorem-provers do exist, but I would not recommend their use.)
I think interactive theorem provers would go a long way towards making children understand symbolic reasoning. The way these programs work is that you have feedback available at every step of a proof. Children can learn basic causal relationships by looking at the world around them. By visualizing the basic relationships between logical formulae you can similarly learn to inuit the effects of reasoning steps. Interactive theorem provers provide the visualization.

The game has rules, and you can learn them.

comment 11y ago · link · parent

Neat! Do you have some pointers to your work? I would be especially interested in example verifications of lock free data structures and in comparing the proof effort to logics custom built for this purpose.

All the constructions I know use at least second order logic and something like Iris is - as far as I know - most elegantly described internal to the topos of trees. If you have found a good way to avoid this complexity then that's a significant contribution.

comment 11y ago · link · parent

I am honestly unconvinced on "most of mathematics" being just ZFC. You see this claim a lot, but when reading formal developments in mathematics I often see justifications involving "small categories" or statements which should hold in ZFC with "enough universes a la Tarski".

But this is missing the point. There is a lot of active research work on program logics for reasoning about e.g., concurrent programs in weak memory models. You may be able to encode the model of something like Iris (http://plv.mpi-sws.org/iris/) in TLA, but the challenge lies in doing this in a usable format...

comment 11y ago · link · parent

There are several good reasons to call it Coq:

- The person who implemented the first version (?) is called Coquand.

- The french have a tradition of naming their software projects after animals.

- Coq is french for Rooster.

But to be honest, there is a rather persistent tale that Thierry Coquand's advisor, Gérard Huet, did it on purpose to offend his American colleagues who were too "politically correct" for his tastes.

He also named a certain programming language "Caml". This does have a perfect innocuous explanation, but also happens to be the name of a certain cigarette brand. This was in 1985, when smoking started to be banned in many public places...

comment 11y ago · link · parent

Ok, there are a number of points you can make comparing set theory and type theory... but the most important point here is that it is a false dichotomy! From a logical point of view "type theory" is a particular formalism for describing logical frameworks. ZFC is the "type theory" of first-order predicate logic plus a few axioms which add a type of sets, a predicate for set membership and assert certain properties of set membership. You can add function types to ZFC and you do obtain a strictly stronger system (Higher-Order ZFC). The main practical advantage is that you do not need to encode your problem into first-order logic.

For instance, in higher-order set theory a (very strong) form of the axiom of choice asserts that there is a function "epsilon : set -> set", such that "epsilon x \in x" for x not empty. Expressing the same in first-order ZFC turns the whole statement on its head since you need to encode this function somehow. This leads to (almost) equivalent but misleading statements, such as "the intersection of a set all of whose inhabitants are non-empty is non-empty". Now if you look into TLA+, you will find that this choice operator epsilon has been added to the language, because it is so useful in practice! And this is just one instance of something that "type-theory" can add over classical ZFC. More to the point, higher-order specifications are crucial for the verification of higher-order programs. Higher-order programs are in turn one of the most useful tools for writing modular code.

Sorry for the nitpicking; let me get back on topic.

The main advantage of Martin-Löf style type theory is that it makes it easy to build new abstractions. For instance, the Bedrock project (http://plv.csail.mit.edu/bedrock/) builds an extensible program verification environment within Coq. This is only possible because the underlying logic is so expressive that you can build internal models for whichever pet logic you want to reason in. From a practical point of view dependent types and the conversion rule - computations in proofs - allows you to build scalable (reflective) proof automation while retaining a small trusted base.

The constructive aspect of Martin-Löf type theory is very pleasing from a philosophical point of view, but again in practice it's not the most relevant aspect. The main reason for me to use something other than classical logic is that there are more models of intuitionistic logic than of classical logic. This gives you more freedom in designing a logic which makes it easy to reason about your particular problem domain. For instance, if you work with Cyberphysical systems, you might like to work within the framework of synthetic differential geometry where all functions are smooth and the real numbers are as simple as they can ever be.

What so many people seem to be ignoring is that the logic you use for reasoning is part of your design space. Saying "I'll just use ZFC" is exactly the same as a programmer exclaiming "I'll just use COBOL". Leslie Lamport designed TLA+ to make it easy to reason about distributed systems. There may well be a nicer logic for reasoning about distributed systems, but you will probably not find it among the models of classical ZFC, since there aren't really that many of them...

On the other hand, there are many different flavors of type theory, just waiting to be discovered. And in my view that's the main advantage of looking beyond set theory.

comment 11y ago · link · parent

KCC is certainly an achievement, but it doesn't subsume Robert's work. If you look into the linked thesis you'll find that a lot of the work deals with finding high-level descriptions of the C semantics. A major part of CH2O is developing an axiomatic semantics for large parts of the C language, which is novel (as far as I know).

There are a few real gems in this thesis. In particular, I really liked the explanation of sequence points in terms of separating conjunction. This is much more compact than the imperative program to decide definedness that is implicitly described in the C standard.

The proofs of equivalence between the different semantic descriptions also go beyond what KCC does, or for that matter what you can do within the K framework (at the moment).

comment 11y ago · link · parent

There are many classically equivalent formulations of the axiom of choice, the one I gave is just the one I like best. :)

But you are right, the devil is in the details, so let me spell it out precisely:

The axiom states that for every set X, there is a function

  \epsilon : P(X)/{\empty} -> X
If you want to restrict yourself to first-order logic, then you have to encode the function \epsilon (e.g. as a functional relation, where relations are in turn encoded as sets of ordered pairs, which are in turn encoded with Kuratowsky's construction). Set theorists like first-order logic and this encoding overhead is the reason why it's not the standard definition, even though it's arguably what the axiom is trying to express(1,2). Apart from that the statements are (classically) equivalent:

To go from the higher-order version to the cartesian product, note that the cartesian product of an I-indexed family of sets is a set of functions f from I to the union of all X_i's, such that f(i) \in X_i for all i. Let (X_i)_{i\in I} be an I-indexed family of sets, all of which are non-empty, then (i -> \epsilon(X_i)) is in the cartesian product of the X_i's, where we use \epsilon for the union of all X_i's. The reason we couldn't build that element without AC is precisely that we have no way of selecting exacly one element from each X_i, even though we know that they are non-empty.

In the other direction we can use Zermelo's well-ordering theorem to construct a well-order on X. We define \epsilon to pick out the minimum with respect to this order.

(1) This really is what the axiom of choice was meant to express. If you can read German, you can refer to Zermelo's own work:

  https://eudml.org/doc/158167
Under point 2 in this paper, Zermelo assumes that there is such a choice function on a given set and from this he derives the well-ordering of that set.

(2) Another example of the drawbacks of working with a first-order axiomatization is the axiom of regularity. The idea we want to express is that there are no infinitely descending element chains ("every set is well-founded"), but expressing this in first-order logic leads to a convoluted statement which obscures the simple idea... and is also not a correct encoding of this idea in intuitionistic logic!

comment 11y ago · link · parent

The point is that there is one ordering in which every subset of real numbers has a minimum.

For the rational numbers, this is not difficult, since we can enumerate the rational numbers. As the ordering we could then pick "a <= b" if the index of "a" in the enumeration is less than the index of "b". The least element of any set of rational numbers is then the rational number with the least index in that set.

However, the real numbers are uncountable. Tricks like this cannot work.

----

The real culprit is the axiom of excluded middle, which confounds the notions of existence and embodiment. Under classical logic it may be proven that P = NP, even though no algorithm actually exists. This already happened for certain graph problems... (=> Graph minor theorem, moving from minor-closed graph property to finite set of excluded minors is essentially non-constructive.)

Without excluded middle, the axiom of choice is exactly as trivial as it sounds: Given a non-empty set, give me an element in that set. In order to show that a set is non-empty you need to give enough information to construct an element in that set. So the proof contains the information to validate the "axiom".

With excluded middle, the proof that a set is non-empty doesn't contain enough information to pick an element from that set. So adding both excluded middle and choice takes you into an axiomatic system whose connection with the real world is rather tenuous.

----

The article is spot on: Not only is mathematics a designed system, but the analogy between programming languages and logic is perfect in view of the Curry-Howard correspondence. Elevating Zermelo-Fraenkel set theory is like insisting that your software project has to be built using Turing machines. After all, everything else is just encoding. There is a huge design space in logics as well as in programming languages. For instance, you can do physics in the setting of synthetic differential geometry and work without preconditions and use theorems which are literally impossible in ZFC.

A soundness proof for a new logic is, by the way, the logical equivalent of building a compiler. :)

comment 12y ago · link · parent

If I remember correctly there was even a special clause in the C standard definition of union types which allows you to write:

struct A { Data header; ... }

struct B { Data header; ... }

union AB { Data header; A a; B b }

and then access the header field in AB. If this is syntactically the first field in each of the constituent records the result is well-defined.

This is a great solution if you need to map to a specific wire format. If you do not have that constraint and have code which uses algebraic data types a lot you should probably switch to OCaml or Haskell. There are specific optimizations to work with complex matches and for representing algebraic types in a compact and efficient way. In C++ the compiler has to work with reinterpret_casts and cannot change the representation of your data types (much). Doing the optimizations by hand is possible, but chances are that a simple-minded OCaml prototype will already perform reasonably well.

comment 12y ago · link · parent

There'd be 10+ different platforms which would be competing and innovating? Did I miss the implied sarcasm tag?

If you look at OS research from the 80s it seems pretty clear that the industry never caught up.

comment 12y ago · link · parent

Yes. You can translate the classical proof, assuming excluded middle for propositions.
1
56789