Skip to content

Commit

Permalink
Some TODOs. We're almost there!
Browse files Browse the repository at this point in the history
@TiarkRompf -- Do you agree that the TODO I am not sure about is weird,
or not?
  • Loading branch information
namin committed Jul 6, 2013
1 parent 8225ca6 commit fcf9563
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/dafny/MiniDot.dfy
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,8 @@ ghost method lemma_lookup_safe(n: nat, H: heap, G: context, x: int)
ghost method lemma_eval_safe(ntyp: nat, nev: nat, nenv: nat, H: heap, G: context, t: tm, T: ty) returns (nv: nat)
requires typ(ntyp, G, t, T);
requires wfenv(nenv, H, G);
// TODO(namin): We should ensure that if a term is well-typed, then it doesn't get stuck!
// It is not enough to check that if it's a result, it has the correct type...
requires eval(nev, H, t).Result?;
ensures vtyp_rec(nv, G, eval(nev, H, t).get, T);
decreases nev, t, ntyp;
Expand All @@ -555,9 +557,10 @@ ghost method lemma_eval_safe(ntyp: nat, nev: nat, nenv: nat, H: heap, G: context
var nfi, T1', T2' := inv_wf_arrow(nf, nf, G, vf, T1, T2);
var G' := context.Extend(vf.mx, T1', G);

This comment has been minimized.

Copy link
@TiarkRompf

TiarkRompf Jul 6, 2013

it seems like you're extending the caller environment, not the callee environment? or am i overlooking something?

var H' := heap.Extend(vf.mx, va, H);
assume wfenv(nenv, H', G'); // TODO
assume wfenv(nenv, H', G'); // TODO(namin): This one should be a formality.
var nr := lemma_eval_safe(nfi, nev-1, nenv, H', G', vf.mf, T2');
assume vtyp_rec(nr, G, eval(nev, H, t).get, T2'); // TODO
assert vtyp_rec(nr, G', eval(nev, H, t).get, T2');
assume vtyp_rec(nr, G, eval(nev, H, t).get, T2'); // TODO(namin): I am not sure about this. The heap does grow with the computation.
var nt := lemma_sub_rec_trans(nfi, ni, G, T2', G, T2, G, T, true);

This comment has been minimized.

Copy link
@TiarkRompf

TiarkRompf Jul 6, 2013

shouldn't this be G', T2', ...?

nv := hint_vtyp_rec_sub(nt, nr, ntyp, G, v, T2', T);
case tnew(mx, mf, tv, Tt) =>
Expand Down

2 comments on commit fcf9563

@adriaanm
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is fascinating stuff -- wish I had time to follow in more detail! I've always wanted to do a (truly) constructive soundness proof :-)

@namin
Copy link
Owner Author

@namin namin commented on fcf9563 Jul 9, 2013

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. Tiark had the great suggestions of trying bottom up. It's not "almost there" though because there are some mistakes with the context. I'll revisit this after my trip to the US. Will be back in Switzerland in August.

Please sign in to comment.