Better HN
topnewbestaskshowjobs
Log inSign up

fmap

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

Submissions

comment 12y ago · link · parent

Answer to auggierose's comment above: Yes you can prove that sqrt(2) is irrational.

This is actually a great example, because it doesn't need excluded middle. Equality of rational numbers is decidable, which means that classical reasoning is provable. And yes, even if it wasn't, it would still work.

Edit: Ok, this was apparently confusing, so let me repeat it here. Yes, the same proof works. This form of excluded middle is entirely unproblematic.

comment 12y ago · link · parent

Sorry if I wasn't clear about this, but you can embed classical mathematics in a type theory with univalence. If you look into the HoTT book, there is a chapter on set theory in type theory. The general form of excluded middle is inconsistent, because it would collapse the structures on which univalence is built.

This means that classical mathematics still works as expected, so long as you have the assumption that you are working with things that are "set-like". Additionally you can make any type "set-like", since this amounts to manually collapsing its equality type.

However... the truth is that most of the time excluded middle is unnecessary (in a type theory). Having nice equality types is so much more useful that, honestly, you are not making an informed decision.

comment 12y ago · link · parent

You get a choice between univalence and excluded middle. The whole argument is that univalence is more useful in practice.

Briefly, in Martin-Löf type theory equalities are very strong, but you do not have many tools for proving new equalities. Univalence is one answer to this problem. So the choice is roughly between "having more equalities" (univalence) or "making everything decidable" (excluded middle).

Additionally, in HoTT you can embed classical set theory at "h-level 1". Basically, you get a slightly weaker form of excluded middle + choice, which is nevertheless sufficient for building a model of classical ZFC. The reverse is not possible, as far as I know.

comment 12y ago · link · parent

Since you are using the word "constructivism" so often, there is probably some sort of misunderstanding. Constructivism usually refers to the philosophical school of thought which rejects the axiom of excluded middle for fairly dogmatic reasons. Most people who learn about this are appalled, since excluded middle appears to be consistent and useful. In particular, intuitionistic set theory is weird and unintuitive - most people don't bother with it.

This has little to do with the reason for constructive logic in HoTT or any type theory. Models of type theory collapse if you add excluded middle and you cannot interpret the resulting structure in any particularly useful way. Without excluded middle you have more freedom in designing new axioms.

This is the reason why HoTT is constructive: You have a choice between classical logic and univalence. The latter turns out to be more useful.

comment 12y ago · link · parent

That's actually what the people at Valve did (GDC 2013): https://developer.nvidia.com/sites/default/files/akamai/game...

Performance improved as a result. The number they give is ~20%. The other nice thing was that you could use D3D10+ on Windows XP...

comment 12y ago · link · parent

For many machine learning problems you can find an equivalent problem which is convex. This seems to be the method of choice for dealing with things like Support Vector Machines. Many academics seem to dislike neural networks because of how easy it is to get stuck in local minima and how hard it is to say anything useful about the result. This won't happen with techniques based on convex optimization.

Outside of machine learning solving a convex relaxation of a discrete optimization problem and then trying to round the result is one of the standard techniques in optimization. This is used all over the place, from straightforward linear relaxations for ILPs through the semidefinite relaxations of problems such as max cut. You start with an intractable problem, embed it into a tractable problem and use the result to gain information about the solutions to your original problem.

comment 13y ago · link · parent

It might be legally significant, but technically, there is no real difference.

Given your social network, and training data consisting of the public members of a group you can use a semi-supervised learning algorithm to determine group membership. Since social networks have a small diameter and the public members are typically well connected, you would expect this approach to be fairly accurate. Or rather, accurate enough to act on, if you do not need to provide legal justification for your decision.

What's the required legal justification for putting someone on a no-fly list?

If you want to give some real world basis to the legal distinction you need oversight and transparency. In particular, global analysis of the whole dataset must be illegal, since it pretty much corresponds to total surveillance. Your results might not be completely accurate, but they don't need to be if you can act once you have something like 51% confidence.

comment 13y ago · link · parent

This came up a few times already and it really isn't as wrong as it sounds. In Haskell all "side effects", which include memory stores, are in the IO monad (with a few exceptions).

Writing a global variable is a side effect, because you change something other than the return value of a function. Reading would still break functional extensionality: Calling a function with equal arguments might yield different results in different contexts.

comment 14y ago · link · parent

Which "parameters" are you optimizing? Where did the corresponding model come from? When is a certain model even applicable? How do you implement the search procedure efficiently? Is the result actually meaningful? Can you expect future predictions to make sense or did you overfit to your training data?

To avoid any fluff, let's go with a concrete example: some of the best performing algorithms for segmentation are based on spectral clustering (http://en.wikipedia.org/wiki/Spectral_clustering). What does an eigenvector corresponding to the second-smallest eigenvalue of the normalized graph laplacian have to do with random walks? How do you compute it?

comment 14y ago · link · parent

What is your point? There are optimizations for dynamic languages which are typically implemented as self modifying code (e.g. polymorphic inline caching) and need writable and executable pages. Without this you could still create writable pages, compile the code and then mark the pages read only and executable. The performance penalty is negligible compared to not using a just in time compiler at all.

On the other hand, with address space layout randomization this is almost impossible to exploit. Furthermore, without ADSR and stack canaries you can use return oriented programming to circumvent the lack of writable & executable memory.

comment 15y ago · link · parent

The data structure is not better than a normal hash table. It is a different trade-off.

For instance, you don't have to do a rehashing step, which is important for real time applications. Memory usage is also very deterministic at 2*(n-1) words in an n element table (with 2 words per node).

If none of this matters to you and you merely want a map with fast lookups then a simple hash table is probably a better choice.

comment 15y ago · link · parent

That's a very good point. One way to circumvent this problem is to combine hashing and crit-bit trees, by constructing an unordered tree on the hash values of the set elements. The nice thing here is that if the hash function behaves like a uniform random variable the resulting tree will be balanced. Furthermore, without ordering the implementation is trivial.

At the same time you will not need rehashing once the table "fills up" and since you use don't discard bits from the hash function the expected number of collisions after inserting n elements with a 32 bit hash is n / 2^32 - or 0 for reasonable values of n.

Additionally you can use clustering (e.g. build a crit-nibble tree, with 16 pointers per node - one 64 byte cache line) to reduce the number of cache misses. This can backfire spectacularly unless the data is essentially random, so the hashing step remains important.

It may not be a silver bullet, but there are some interesting trade-offs.

comment 15y ago · link · parent

Because of the way nested functions are implemented in GCC.

If you call a nested function it has to know the frame address of the containing function in order to refer to its local variables. So if you take the address of such a function the program actually receives the address of a "trampoline": a small sequence of instructions which first loads the frame address and then calls the real function.

The trampoline itself is generated dynamically and putting it on the stack turns out to be cheaper than heap allocating it.

comment 15y ago · link · parent

You are right, the problem is undecidable in general. If the compiler is unsure whether a constraint is satisfied it will have to add a runtime check.

This is similar to the behavior of array accesses in Java: If you access an invalid index the JVM is required to throw an out of bounds exception. In practice this would be unacceptably slow and if the compiler can prove that such an exception can never happen, the check will be removed.

As for the "simple" example of testing "y == 0", this is actually already undecidable. If you are interested, you might have a look at Nielson's "Principles of Program Analysis", I think that this particular example (undecidability of MOP Constant Propagation) is worked out there. Also, the book is a nice introduction to the subject.

comment 15y ago · link · parent

I don't really know Microsoft's C compiler well enough to answer why your specific example fails so spectacularly, but I can make a guess: You are using inline assembly containing a computed jump instruction. In this situation the compiler no longer has a complete view of the control flow graph of your function, and it is likely that all optimizations which need a control flow graph will be disabled. Common subexpression elimination needs a CFG since it determines if two computations are the same for all paths in the program.

Now I'm reasonably certain that the C standard does not allow inline assembly like this. However, given the decades of legacy software that Microsoft has to contend with I would not be too surprised if this was part of the reason.

By the way, GCC's computed gotos are not actually much better. In this case you get a control flow graph where you cannot split all critical edges. There is a workaround for this, but it's probably easier to just disable all optimizations that depend on it.

comment 15y ago · link · parent

I'm sure that someone has already mentioned this, but "A concurrent lambda-calculus with Futures" is a paper about AliceML. The problem is that the full syntax and semantics of StandardML contain a lot of features which are not very relevant to the discussion of the semantics of futures.

Instead, the authors describe the semantics as an extension of lambda calculus. This is both more compact and more useful to other researchers (who might not be working on an ML dialect).

That said I would be grateful to you or anyone with a backup who could restore the article. Looking at the google cache for this page, it was more than a stub and actually did link to a page with references...

Alice is still one of the first semester languages for CS students at Saarland university. I think it would be advantageous if you could find information about related languages and additional features on Wikipedia.

comment 15y ago · link · parent

I just read the original paper on samplesort, so this might not be the most up to date description, but the basic idea is as follows:

- From an input sequence of length n, choose a random subsequence of length k.

- Sort the subsequence.

- Partition the remaining (n-k) elements of the original sequence into the (k+1) partitions given by the subsequence.

- Sort the (k+1) partitions.

In the paper, the partitioning and sorting is always done using quicksort. Any n*log(n) sorting algorithm should work though, which includes using samplesort recursively.

If you use an optimal value for k (and this might be a significant fraction of n), you can prove that lim_{n->infty} E(C_n)/log(n!) = 1, where E(C_n) is the expected number of comparisons for a sequence of length n.

Now, using samplesort recursively, quicksort is samplesort with k = 1. Double-Pivot quicksort is samplesort with k = 2.

1
56789