29.04.2014 Views

Presburger Arithmetic and Its Use in Verification

Presburger Arithmetic and Its Use in Verification

Presburger Arithmetic and Its Use in Verification

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

APPENDIX B. SOURCE CODE OF EXPERIMENTS<br />

| f::fs’−> let f’ =func f<br />

if f’ =condVal then condVal else mapUntil(func, condVal, combFunc,<br />

fs’, f’::acc)<br />

let rec genInfFormula (x, leftProjection, lcm) form =<br />

match form with<br />

| C(t, ct) −> match ct with<br />

| EQ −> if f<strong>in</strong>dCoeff (t, x) 0then FF<br />

else<br />

if lcm =1then C(filterOut(t, x), ct) else form<br />

| UEQ −> if f<strong>in</strong>dCoeff (t, x) 0then TT<br />

else<br />

if lcm =1then C(filterOut(t, x), ct) else form<br />

| GT −> let c = f<strong>in</strong>dCoeff (t, x)<br />

if c >0&&leftProjection then FF<br />

elif c if lcm =1then C(filterOut(t, x), ct) else form<br />

| D(i, t) −> if lcm =1then D(i, filterOut(t, x)) else form<br />

| And fs −> mapUntil(genInfFormula (x, leftProjection, lcm), FF, And, fs, [])<br />

| Or fs −> mapUntil(genInfFormula (x, leftProjection, lcm), TT, Or, fs, [])<br />

| Not f −> match genInfFormula (x, leftProjection, lcm) f with<br />

| TT −> FF<br />

| FF −> TT<br />

| f’ −> Not f’<br />

| SAnd(f, vr) −> match genInfFormula (x, leftProjection, lcm) f with<br />

| TT −> TT<br />

| FF −> FF<br />

| SAnd(f’, vr’) −> SAnd(f’, vr’@vr)<br />

| f’ −> SAnd(f’, vr)<br />

| SOr(f, vr) −> match genInfFormula (x, leftProjection, lcm) f with<br />

| TT −> TT<br />

| FF −> FF<br />

| SOr(f’, vr’) −> SOr(f’, vr’@vr)<br />

| f’ −> SOr(f’, vr)<br />

| _ −> form<br />

let rec substituteFormula (c, x, tx) formula =<br />

match formula with<br />

| C(t, ct) −> C(substitute (c, x, tx, t), ct)<br />

| D(i, t) −> D(i, substitute (c, x, tx, t))<br />

| And fs −> fs |> List.map (substituteFormula (c, x, tx)) |> And<br />

| Or fs −> fs |> List.map (substituteFormula (c, x, tx)) |> Or<br />

| SAnd(f, vr) −> (substituteFormula (c, x, tx) f, vr) |>SAnd<br />

| SOr(f, vr) −> (substituteFormula (c, x, tx) f, vr) |>SOr<br />

| Not f −> substituteFormula (c, x, tx) f |> Not<br />

| _ −> formula<br />

80

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!