Giter Site home page Giter Site logo

Comments (9)

martinschaef avatar martinschaef commented on July 20, 2024

Sorry about that. Here is a quick fix:
In each generated Boogie file, you will find the following two lines:

axiom (forall t : javaType :: $heap[$null,$type] <: t);

procedure $new(obj_type:javaType) returns ($obj:ref); requires $heap[$obj,$alloc] == false; ensures $obj != $null; ensures $heap[$obj,$type] == obj_type; ensures $heap[$obj,$alloc] == true;

which are generated as part of the prelude. Replace this by:

procedure $new(obj_type:javaType) returns ($obj:ref);

Then it should work. I'll try to change the code accordingly asap.

from jar2bpl.

crhf avatar crhf commented on July 20, 2024

@martinschaef in this case, how do you make sure that $null is a subtype of everything?

from jar2bpl.

martinschaef avatar martinschaef commented on July 20, 2024

Ha ... that conversation started 9 years ago; I had to think about that for a minute :D. In terms of casting-rules, shouldn't null be a subtype of everything? Because you cast null to everything but you can't cast anything to null.

That is you can write:

String foo = null;
Integer bar = null;

where the null constant is implicitly cast to whatever type you have on the left.
In the opposite direction, there is no Null type that you could cast to.

So if you think of the type lattice, you have java.lang.Object at the top and the null type at the bottom and everything else at the middle (with the exception of primitive types like int which you have to handle separately) ... does that sound right?

from jar2bpl.

crhf avatar crhf commented on July 20, 2024

Ah, didn't expect such a quick response :) I totally agree that null is a subtype of everything. I mean, since you suggest removing axiom (forall t : javaType :: $heap[$null,$type] <: t); from the prelude, how do you enforce that null is a subtype of everything in the boogie program?

from jar2bpl.

martinschaef avatar martinschaef commented on July 20, 2024

Oh ... that again, I would need to think about longer. I assume Boogie changed in the last 9 years, so I'm not sure how you would have to write that axiom. Depending on what type of properties you want to prove, you might not even need to state that subtype relation for null explicitly

from jar2bpl.

crhf avatar crhf commented on July 20, 2024

It happens that I'm doing a proof about null pointer exception, so I think I need that axiom.., Did you have any way to specify that 9 years ago? Or other workaround that does not need the axiom?

from jar2bpl.

martinschaef avatar martinschaef commented on July 20, 2024

That, I don't remember ... note that this issue is 9 years old, but the code is a lot older than that. So my recommendation would be to check the literature of the past 10 years, I'm sure there is a better way to model the heap by now.

from jar2bpl.

crhf avatar crhf commented on July 20, 2024

I see, thanks for making jar2bpl and helping here :)

from jar2bpl.

crhf avatar crhf commented on July 20, 2024

btw, would you mind taking a look at the other issue I just created ;)

from jar2bpl.

Related Issues (6)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.