4 ms·
some tools such as Verum Dezyne and Quantum Leaps can generate 100% correct source code in C, C++, Java ... The input into these tools, from which they generat
by gizi 11y ago
some tools such as Verum Dezyne and Quantum Leaps can generate 100% correct source code in C, C++, Java ...
The input into these tools, from which they generate source code, is therefore, the real program and the real source code. How do they prove that this real source code, from which they generate C,C++, or Java, is "correct"?
In fact, this input just constitutes a new programming language -- a DSL -- and the tool is just another compiler or scripting engine. If existing compilers are unprovable, this new compiler is for the same reasons unprovable too. In other words, they did not solve the problem.
- dllthomas 11y agoThat doesn't follow at all. It could easily be the case if the proving requires restrictions that other languages don't provide. I'm a little skeptical that they did "solve the problem", bit we can't know much about that without actually looking.
- djcapelis 11y agoSpot on. :) This has often been the problems with formal methods work. And the spec languages are often worse to find bugs in than the original source! So not only does this essentially become another DSL, it is usually a pretty bad one.
- munin 11y agoto be fair it's not just the problem with formal methods work - if you start off with a spec with a bug and implement it faithfully in a non-verified context, you'll still have the bug due to the buggy spec, along with a whole bunch of implementation bugs that you make due to not verifying things...
- l_dopa 11y agoThis is exactly why a lot of formal methods work isn't, imho, terribly compelling. Something like http://vst.cs.princeton.edu/ http://vst.cs.princeton.edu/ has a much, much stronger case for enabling "100% correct software".
- tunesmith 11y agoBecause the code will literally not compile if it isn't correct. As opposed to weaker languages where bugs (run-time problems) can exist. I'm still something of a layman on this, and I know less about formal specification languages like TLA+, but languages like Coq work by using things like dependent types. Here's an example: if you have a method that takes (through specifying type parameters) an Int and returns an Array of Integers, and it compiles, then you have effectively proven that it is possible to take an Int and return an Array of Integers. This is not particularly useful to the method author that is only using that method signature to write some more specific business logic. Dependent types allow you to spruce up that method signature until it actually reflects your business logic. So then you know that if it compiles, the actual intent of your method/function is bug free. Yes, it is true that there is a "turtles all the way down" element to this kind of thing - "how do they prove that this real source code is correct?" The answer is that languages like Coq rely on a small kernel of code that cannot be proven. It's like their axiom from which everything flows. But the kernel is small enough that people verify it with eyeballs. Bugs can still happen there, and I think they even found one a few years ago, but it didn't have any impact on all the mathematical proofs that have been written using Coq. I'm sure some experts can jump all over what I just wrote but that's the gist as I understand it so far.
- munin 11y ago> proven that it is possible to take an Int and return an Array of Integers. proving that something is POSSIBLE is very easy: just write this function in an untyped language and call it with an int, and show that you get back an array. proven: it's possible. static type systems give you something much stronger: the guarantee that, always, Int -> [Int]. sometimes languages weaken this to exceptions, sometimes, certain kinds of exceptions. these systems are pretty straightforward, we've had them for a while, and they're even in environments like c++ and java. the "dependent types" area of the world that you talk about is more exciting: a desire to push more information about the program, as a specification, into the type system. so for example session types are a technology by which you can encode the state machine of a network protocol into the types of data values and functions. then, if your state machine is correct, and the process of translating the state machine into a session types implementation is correct, you can prove that your implementation is a correct implementation of a given protocol. the dynamic typing half of this, as I understand it, is contracts. you write executable guards around the beginnings of functions that check, at runtime (usually), that the environment the function is in is something the function expects. both of these technologies come from, I think, the same place: the desire to control the steps that a program makes during runtime. static type systems don't permit programs to be compiled that could take invalid steps, dynamic type systems don't permit programs that run to advance past an invalid step.
- taeric 11y agoI think you are missing the point. In the same way that you can prove there are no out of bounds accesses in java, you can prove that this code represents the correct source code from these languages. How do they accomplish this? The same way Java does. By flat out disallowing many of the things that the underlying language allows. Consider, it all ends up as machine code in the end. So, how do they prove this "real" source code is correct? By greatly increasing the burden on producing it. In many contexts, this increase is necessary. In others... not so much.