jstolarek / slicer

Companion code for paper "Imperative Functional Programs that Explain their Work", Wilmer Ricciotti, Jan Stolarek, Roly Perera and James Cheney, ICFP 2017, Oxford, UK
http://dl.acm.org/citation.cfm?id=3110258
GNU General Public License v3.0
6 stars 0 forks source link

Slicing tuple references does not work #59

Closed jstolarek closed 7 years ago

jstolarek commented 7 years ago

@jamescheney reports:

If I do:

let t = trace (
  let p = ref (1,2) in
  (fst (!p))+ (snd (!p))
) in
bwdSlice(t,3)

then the slice I get leaves out one of the components:

val it = let p = ref (1, _)
in (fst !p) + (snd !p) : trace(int)
jamescheney commented 7 years ago

This seems to be fixed, but we get another error in the test suite. A minimal example is:

let y = ref 0 in
let t = trace (
(y := 42);; !y) in
bwdSlice (t, 42)

which yields an exception due to attempting to take the LUB of 0 and 42. However, for some reason

let t = trace (
let y = ref 0 in
(y := 42);; !y) in
bwdSlice (t, 42)

works and does the right thing. So it may be that the problem is not in the slicing code but somewhere else.

jamescheney commented 7 years ago

Ah, I see. In Eval, we are recording the initial store in VTrace, then we are using it as the final store in bwdSlice. That's wrong - we should record the final store, and use it (if at all) to check that any reference-based slicing criteria respect the original result values. The initial store for backward slicing should be empty (unless we add an operator that allows us to give a reference label and part of its value as an initial slicing criterion).

jstolarek commented 7 years ago

Right, that's how I understood the rules. Sorry about that.