
Cosette: An Automated SQL Solver - mpweiher
http://cosette.cs.washington.edu/
======
j_s
So can you brute-force queries until you find something faster, then verify
it?

~~~
timClicks
Would much rather a computer did that than me

------
pjdorrell
Does this really use advanced features of Homotopic Type Theory? Does it
really require the Univalence Axiom? (Caveat: I don't yet properly understand
either of those two things.)

It seems to me that the representation of cardinalities as "Univalent Types"
could just as easily be done using Decidable Setoids (eg the number 3 is
represented by a Setoid with a decidable equivalence relationship that divides
its members into 3 equivalence classes).

There are only four things in this system that require a notion of equality
and/or equivalence: tuples, cardinalities, relations (as functions from tuples
to cardinalities) and queries (as functions from relations to relations).

I think this could all be done with in ordinary plain dependent type theory,
without any HOTT or Univalence Axiom (for example, in Idris, which is
apparently incompatible with the Univalence Axiom). Each of the four notions
of equivalence would be represented by a corresponding type function.

Have I missed something?

------
romanovcode
> Please register (if you are first time user) or login (if you have
> registered)

No, thank you.

------
equalunique
Amazing.

------
Scotrix
Why?

~~~
parshimers
Because it's awesome! You've never had to rewrite a query for some sort of
reason other than the results returned (e.g. performance) and really wondered
if the original and rewritten query were exactly the same?

~~~
infogulch
I ended up building some tooling scripts to do this for stored procedures. It
compares the output of the current and proposed stored procedures for all
possible parameters and displays the differences and the set of parameters
that it used.

It's not formal verification by any means, but it seemed to work pretty well
in practice. It would take forever though. I'd start it and walk away for a
couple hours when I wanted a thorough test. But my confidence in correctness
and performance gain (it measured perf too) was well worth the effort.

