Why can't I call a (non-static) lemma from a ghost field in Dafny?

why can't
why can't i liz phair movie
why can't i lyrics
why can't i meaning
why can't we be friends
liz phair - extraordinary
why can't you grammar
liz phair - supernova

On Dafny, a lemma is implemented as a ghost method, thus, it is only useful for the specification.

However, you cannot call a lemma from a ghost field, like this:

class A {
    var i: int;
    lemma sum_is_commutative(i: int, j: int)
        ensures i + j == j + i
    {}
}
class B {
    ghost var a: A;
    lemma a_sum_is_commutative(i: int, j: int)
        ensures i + j == j + i
    { a.sum_is_commutative(i, j); }
    method test() {
        // a.sum_is_commutative(3, 2); // <- Cannot use directly this
        a_sum_is_commutative(3, 2);
    }
}

What is the rationale for this behavior? How can it be worked around? Is the best choice to just repeat the lemma in the inner class and leverage (usually, call) the other class's lemma?

Thanks for discovering and reporting this. It is a bug. I just pushed a fix for it.

Rustan

Why Can't I?, Provided to YouTube by Universal Music Group Why Can't I? · Liz Phair Liz Phair ℗ 2003 Capitol Duration: 3:29 Posted: Oct 16, 2018 When you get a message that says Windows can't be activated, there are several possible reasons why. Select any of the following topics to see some typical reasons for activation difficulty, along with possible ways to get going again.

I'm not familiar with Dafny, but I think you need to declare your test method as ghost as well to be able to use the ghost parameter in it.

Usually in program verification frameworks, ghost means that the definition will be erased at runtime and is here only for proof purposes. Thus your test method should not contain code whose definition will be erased, or it should be marked as erasable (ghost).

Tear gas and pepper spray are chemical weapons. So, why can , And the fact that toxic chemicals are banned in warfare, but permitted for use against protesters, is at the centre of that debate. A group of  Being overweight, getting too little exercise, and smoking all can work against the good blood flow that is key to erections. For some men, a little alcohol may help take the edge off.

I can't comment on the rationale for this behavior (and I will update the selected answer if there is an academic one, not just a bug or lack of implementation).

For working around this issue, it's semantically the same to define

class A {
  lemma sum_commutative(i: int, j: int) {}
}

as something like

class A {
  static lemma sum_commutative(a: A, i: int, j: int) {}
}

So, even if you need access to a this instance, you may be able to pass it as a parameter instead of relying on it implicitly.

Then, you are able to call from any other class your lemma as A.sum_commutative(a, i, j) without running into the issue of calling a ghost method of a ghost-variable from a non-ghost method.

Why can't you speak English?: Learn English digital book for , At that time, the youngaged, servant, who was engaged in cleaning the room, comes near this man and asks: Why did you do this? (You is used in the pejorative  And I can't recall any love at all Oh baby, this blows 'em all away It's got what it takes So tell me why can't this be love? Straight from my heart Oh tell me why Can't this be love? I tell

Why Can't Philosophers Laugh?, We are all like the warrior looking for pearls that are already there, just by virtue of It all seems so EASY so why do we have to live to see a day like this. Can't  History "Why Can't I Be You?" was the first single released from the album Kiss Me, Kiss Me, Kiss Me—the band's seventh LP.In 14 April 1987, it peaked at number 21 on UK Singles Chart. In the United States that same year, the song reached number 54 on the Billboard Hot 100, while a remix of the track charted at numbers eight and 27 on the Hot Dance Music/Maxi-Singles Sales and the Dance

Amazon.com Help: Why Can't I Log into My Account?, If you're having trouble logging in, you may be entering incorrect account information or you may need to reset your password. Here are some things to check:. Now extend that to management teams with somewhere in the neighborhood of 10 individuals and you can see why disagreement on key issues is so common. And yet, important decisions have to be made.

Why Can't We Be Friends?: Avoidance Is Not Purity: Aimee Byrd , We shy away from healthy friendship, and even our siblingship in Christ, in the name of purity and reputation . . . but is this what we are called to do? Can’t go? You’re not alone. About 20% of Americans have occasional constipation-- bowel movements less than three times a week.Or if they do poop, the output is hard, small, and painful to

Comments
  • This does not solve the stated problem. The goal is that the test() method must be client call, implemented and callable at runtime. The lemma code is ghost code, which means it will be erased at runtime, you are right there; however, calling ghost code from implemented methods is sometimes necessary in order to follow non-trivial reasoning paths. And it seems Dafny does not support this call convention of <ghost variable>.<ghost method>(<params>), but only this.<ghost method>(<params>)
  • @Julien, Dafny allows ghosts at a finer granularity than methods. For example, a non-ghost method can contain assignments to ghost variables, and it can even have a mix of ghost and non-ghost parameters.