Search in sources :

Example 1 with HighLocation

use of dartagnan.program.HighLocation in project Dat3M by hernanponcedeleon.

the class Encodings method initsUniquePath.

public static BoolExpr initsUniquePath(Program p, Context ctx) {
    BoolExpr prec = ctx.mkTrue();
    BoolExpr post = ctx.mkTrue();
    for (Event e : p.getEvents().stream().filter(e -> e instanceof MemEvent).collect(Collectors.toSet())) {
        prec = ctx.mkAnd(prec, ctx.mkOr(e.getGuard(), ctx.mkNot(e.executes(ctx))));
    }
    for (Event e : p.getEvents().stream().filter(e -> e instanceof Init && e.getLoc() instanceof HighLocation).collect(Collectors.toSet())) {
        BoolExpr guards = ctx.mkAnd(ctx.mkLt(ctx.mkSub(uniqueValue(e, ctx), ctx.mkInt(1)), initValue(e, ctx)), ctx.mkGt(ctx.mkAdd(uniqueValue(e, ctx), ctx.mkInt(1)), initValue(e, ctx)));
        post = ctx.mkAnd(post, guards);
    }
    return ctx.mkImplies(prec, post);
}
Also used : HighLocation(dartagnan.program.HighLocation) Utils.lastValueReg(dartagnan.utils.Utils.lastValueReg) Utils.uniqueValue(dartagnan.utils.Utils.uniqueValue) com.microsoft.z3(com.microsoft.z3) Event(dartagnan.program.Event) Set(java.util.Set) If(dartagnan.program.If) Collectors(java.util.stream.Collectors) Utils.initValue(dartagnan.utils.Utils.initValue) Init(dartagnan.program.Init) Register(dartagnan.program.Register) Utils.initValue2(dartagnan.utils.Utils.initValue2) Local(dartagnan.program.Local) Load(dartagnan.program.Load) MemEvent(dartagnan.program.MemEvent) Utils.ssaReg(dartagnan.utils.Utils.ssaReg) Program(dartagnan.program.Program) Utils.edge(dartagnan.utils.Utils.edge) Utils.lastValueLoc(dartagnan.utils.Utils.lastValueLoc) Store(dartagnan.program.Store) MapSSA(dartagnan.utils.MapSSA) Location(dartagnan.program.Location) HighLocation(dartagnan.program.HighLocation) Init(dartagnan.program.Init) MemEvent(dartagnan.program.MemEvent) Event(dartagnan.program.Event) MemEvent(dartagnan.program.MemEvent)

Example 2 with HighLocation

use of dartagnan.program.HighLocation in project Dat3M by hernanponcedeleon.

the class Encodings method getReachedStateLow.

public static BoolExpr getReachedStateLow(Program p, Model model, Context ctx) {
    Set<Location> locs = p.getEvents().stream().filter(e -> e instanceof MemEvent).map(e -> e.getLoc()).filter(l -> !(l instanceof HighLocation)).collect(Collectors.toSet());
    BoolExpr reachedState = ctx.mkTrue();
    for (Location loc : locs) {
        reachedState = ctx.mkAnd(reachedState, ctx.mkEq(lastValueLoc(loc, ctx), model.getConstInterp(lastValueLoc(loc, ctx))));
    }
    return reachedState;
}
Also used : HighLocation(dartagnan.program.HighLocation) Utils.lastValueReg(dartagnan.utils.Utils.lastValueReg) Utils.uniqueValue(dartagnan.utils.Utils.uniqueValue) com.microsoft.z3(com.microsoft.z3) Event(dartagnan.program.Event) Set(java.util.Set) If(dartagnan.program.If) Collectors(java.util.stream.Collectors) Utils.initValue(dartagnan.utils.Utils.initValue) Init(dartagnan.program.Init) Register(dartagnan.program.Register) Utils.initValue2(dartagnan.utils.Utils.initValue2) Local(dartagnan.program.Local) Load(dartagnan.program.Load) MemEvent(dartagnan.program.MemEvent) Utils.ssaReg(dartagnan.utils.Utils.ssaReg) Program(dartagnan.program.Program) Utils.edge(dartagnan.utils.Utils.edge) Utils.lastValueLoc(dartagnan.utils.Utils.lastValueLoc) Store(dartagnan.program.Store) MapSSA(dartagnan.utils.MapSSA) Location(dartagnan.program.Location) HighLocation(dartagnan.program.HighLocation) MemEvent(dartagnan.program.MemEvent) HighLocation(dartagnan.program.HighLocation) Location(dartagnan.program.Location)

Example 3 with HighLocation

use of dartagnan.program.HighLocation in project Dat3M by hernanponcedeleon.

the class Encodings method diffInitialHigh.

public static BoolExpr diffInitialHigh(Program p, Context ctx) {
    Set<Event> highInits = p.getEvents().stream().filter(e -> e instanceof Init).filter(e -> e.getLoc() instanceof HighLocation).collect(Collectors.toSet());
    BoolExpr initState = ctx.mkTrue();
    for (Event e : highInits) {
        if (e.getLoc().getIValue() == null) {
            initState = ctx.mkAnd(initState, ctx.mkNot(ctx.mkEq(initValue(e, ctx), initValue2(e, ctx))));
        }
    }
    return initState;
}
Also used : HighLocation(dartagnan.program.HighLocation) Utils.lastValueReg(dartagnan.utils.Utils.lastValueReg) Utils.uniqueValue(dartagnan.utils.Utils.uniqueValue) com.microsoft.z3(com.microsoft.z3) Event(dartagnan.program.Event) Set(java.util.Set) If(dartagnan.program.If) Collectors(java.util.stream.Collectors) Utils.initValue(dartagnan.utils.Utils.initValue) Init(dartagnan.program.Init) Register(dartagnan.program.Register) Utils.initValue2(dartagnan.utils.Utils.initValue2) Local(dartagnan.program.Local) Load(dartagnan.program.Load) MemEvent(dartagnan.program.MemEvent) Utils.ssaReg(dartagnan.utils.Utils.ssaReg) Program(dartagnan.program.Program) Utils.edge(dartagnan.utils.Utils.edge) Utils.lastValueLoc(dartagnan.utils.Utils.lastValueLoc) Store(dartagnan.program.Store) MapSSA(dartagnan.utils.MapSSA) Location(dartagnan.program.Location) HighLocation(dartagnan.program.HighLocation) Init(dartagnan.program.Init) Event(dartagnan.program.Event) MemEvent(dartagnan.program.MemEvent)

Example 4 with HighLocation

use of dartagnan.program.HighLocation in project Dat3M by hernanponcedeleon.

the class Encodings method getInitialHigh.

public static BoolExpr getInitialHigh(Program p, Model model, Context ctx, boolean var1, boolean val1) {
    Set<Event> highInits = p.getEvents().stream().filter(e -> e instanceof Init).filter(e -> e.getLoc() instanceof HighLocation).collect(Collectors.toSet());
    BoolExpr reachedState = ctx.mkTrue();
    for (Event e : highInits) {
        IntExpr var = var1 ? initValue(e, ctx) : initValue2(e, ctx);
        IntExpr val = val1 ? initValue(e, ctx) : initValue2(e, ctx);
        if (e.getLoc().getIValue() == null) {
            reachedState = ctx.mkAnd(reachedState, ctx.mkEq(var, model.getConstInterp(val)));
        }
    }
    return reachedState;
}
Also used : HighLocation(dartagnan.program.HighLocation) Utils.lastValueReg(dartagnan.utils.Utils.lastValueReg) Utils.uniqueValue(dartagnan.utils.Utils.uniqueValue) com.microsoft.z3(com.microsoft.z3) Event(dartagnan.program.Event) Set(java.util.Set) If(dartagnan.program.If) Collectors(java.util.stream.Collectors) Utils.initValue(dartagnan.utils.Utils.initValue) Init(dartagnan.program.Init) Register(dartagnan.program.Register) Utils.initValue2(dartagnan.utils.Utils.initValue2) Local(dartagnan.program.Local) Load(dartagnan.program.Load) MemEvent(dartagnan.program.MemEvent) Utils.ssaReg(dartagnan.utils.Utils.ssaReg) Program(dartagnan.program.Program) Utils.edge(dartagnan.utils.Utils.edge) Utils.lastValueLoc(dartagnan.utils.Utils.lastValueLoc) Store(dartagnan.program.Store) MapSSA(dartagnan.utils.MapSSA) Location(dartagnan.program.Location) HighLocation(dartagnan.program.HighLocation) Init(dartagnan.program.Init) Event(dartagnan.program.Event) MemEvent(dartagnan.program.MemEvent)

Aggregations

com.microsoft.z3 (com.microsoft.z3)4 Event (dartagnan.program.Event)4 HighLocation (dartagnan.program.HighLocation)4 If (dartagnan.program.If)4 Init (dartagnan.program.Init)4 Load (dartagnan.program.Load)4 Local (dartagnan.program.Local)4 Location (dartagnan.program.Location)4 MemEvent (dartagnan.program.MemEvent)4 Program (dartagnan.program.Program)4 Register (dartagnan.program.Register)4 Store (dartagnan.program.Store)4 MapSSA (dartagnan.utils.MapSSA)4 Utils.edge (dartagnan.utils.Utils.edge)4 Utils.initValue (dartagnan.utils.Utils.initValue)4 Utils.initValue2 (dartagnan.utils.Utils.initValue2)4 Utils.lastValueLoc (dartagnan.utils.Utils.lastValueLoc)4 Utils.lastValueReg (dartagnan.utils.Utils.lastValueReg)4 Utils.ssaReg (dartagnan.utils.Utils.ssaReg)4 Utils.uniqueValue (dartagnan.utils.Utils.uniqueValue)4