Whiley / WhileyTheoremProver

The Whiley Theorem Prover (WyTP) is an automatic and interactive theorem prover designed to discharge verification conditions generated by the Whiley Compiler. WyTP operates over a variant of first-order logic which includes integer arithmetic, arrays and quantification.
Apache License 2.0
8 stars 2 forks source link

Problems with Normal-Form Representation #56

Closed DavePearce closed 7 years ago

DavePearce commented 7 years ago

There are several reasons why we want to represent expressions in a normal form:

On the negative side, there is the problem of "lost representation". Consider this example:

define contains(int[] items, int item) is:
    exists(int k).(items[k] == item)

assert:
   forall(int[] xs, int x):
       if:
          |xs| > 0
          !contains(xs,x)
       then:
          xs[0] > x      

In a proof-by-contradiction, we'll end up with the equivalence xs[0] == x. In order to prove the contradiction, we need to instantiate against xs[0]. But, if we had decided xs[0] was the representative of the equivalence class containing both xs[0] and x, then we can end up missing xs[0] and not triggering instantiation. This happens because automatically substitution moves terms to their normal form.

Other situations where normal form representation can cause problems:

The other difficult thing caused by normal form representation is that the printed proofs don't resemble their original form. The normal form tends to be a bit ugly in places as well (especially with have inequalities always represented by >= because you end with gross things like |A| >= (i+1) which is much better denoted as i < |A|.

DavePearce commented 7 years ago

Merged into #68