Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proof generation for CFG optimizations (Block coalescing and pruning of unreachable blocks) #10

Open
wants to merge 133 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
133 commits
Select commit Hold shift + click to select a range
e59ce53
ast_to_cfg certification in progress
ahubanov-eth2 Aug 10, 2022
fa64238
for procedures with breaks or gotos, certificate for AST-to-CFG not g…
ahubanov-eth2 Aug 17, 2022
f9db316
some pull request comments resolved
ahubanov-eth2 Oct 5, 2022
0b9cf72
added some comments for documentation
ahubanov-eth2 Oct 6, 2022
de72fcc
separation of AstCfg Proofs from the rest done, needs to be checked
ahubanov-eth2 Oct 10, 2022
dbe99fb
ASTtoCFG proofs separated + added booleans per phase + small code cle…
ahubanov-eth2 Oct 10, 2022
9e50541
added conditional generation of AST-to-CFG end-to-end lemma
ahubanov-eth2 Oct 11, 2022
3bc02f2
refactored the booleans
ahubanov-eth2 Oct 12, 2022
ff89f0e
added comment about loop head big block map
ahubanov-eth2 Oct 13, 2022
030a993
use type synonym instead of explicit type for "proc_body_satisfies_spec"
gauravpartha Oct 18, 2022
254bbab
Merge branch 'master' into ast_to_cfg
gauravpartha Oct 18, 2022
d6bb14b
resolved naming issues for subdirectories, omitted numbers in titles
ahubanov-eth2 Oct 27, 2022
1bf7398
changes on proofs and naming
ahubanov-eth2 Nov 9, 2022
cd737c0
update flags to avoid generating redundant definitions
gauravpartha Nov 10, 2022
eb05cff
bigblock definitions redone and 'blast+' removed from most proofs
ahubanov-eth2 Nov 12, 2022
88ee90f
finalizing branch, proof generation for all phases enabled
ahubanov-eth2 Nov 19, 2022
153df56
forcing squeezing of assume commands in the beginning of if-blocks re…
ahubanov-eth2 Nov 22, 2022
2d3da1f
small bug fix regarding naming
ahubanov-eth2 Nov 24, 2022
6134eaa
reverted forceful squeezing of assume-commands and added condition ge…
ahubanov-eth2 Nov 25, 2022
06180da
selective generation of phases done
ahubanov-eth2 Dec 8, 2022
a8c60ae
selective phase gen now done
ahubanov-eth2 Dec 8, 2022
e951e02
merge master into ast_to_cfg
gauravpartha Jan 15, 2023
489c5c5
generate all proofs (ProofGenConfig initialization adjustments)
gauravpartha Jan 15, 2023
93df447
set foundational boogie commit to ast version
gauravpartha Jan 15, 2023
a2c98ee
fix bug: initialize phaseTheories directly with unique namer
gauravpartha Jan 15, 2023
6c42d23
add conditional expression example
gauravpartha Jan 16, 2023
ab3012f
add support for conditional expressions
gauravpartha Jan 16, 2023
ea6fdca
proof output directory should be as specified in the options
gauravpartha Jan 16, 2023
d9554c9
Merge branch 'conditional_expressions' into adjust_interface
gauravpartha Jan 16, 2023
480c0cd
generalize "GenerateIsaProgNoProofs" option to allow one to optionall…
gauravpartha Jan 19, 2023
39c6429
id based lemma naming option
gauravpartha Jan 20, 2023
974779e
isaProgNoProofs option limit fix
gauravpartha Jan 23, 2023
9a07ce2
remove redundant changes to Parser.cs
gauravpartha Jan 29, 2023
2ee733a
fix bug
gauravpartha Feb 6, 2023
a7e8865
minor fix
gauravpartha Feb 28, 2023
6b90aef
handle case when unoptimized program is generated but AST-to-CFG prog…
gauravpartha Mar 19, 2023
6b5c0f1
take dead variable elimination into account: now use different local …
gauravpartha May 9, 2023
2bb37ad
fix and get rid of more accessors other than the two that are require…
gauravpartha May 9, 2023
fdcda03
fix and get rid of more accessors other than the two that are require…
gauravpartha May 10, 2023
741cbb4
added FIXME for optimization flag
gauravpartha May 10, 2023
b5d9181
comment out number replacement for preferred names
gauravpartha May 10, 2023
8a27db8
fix bug
gauravpartha May 16, 2023
9775867
First try optimizations proof generations
lukashimmelreich Jun 7, 2023
32cbe2b
generate unoptimized program also if AST-to-CFG proof is not generated
gauravpartha Jun 7, 2023
ca93f23
input unoptimized CFG program access to CFGOptimizationsLemmaManager,…
gauravpartha Jun 7, 2023
de01524
Work in progress
lukashimmelreich Jun 7, 2023
918ecaf
Merge branch 'cfg_optimizations' of https://github.com/gauravpartha/b…
lukashimmelreich Jun 7, 2023
f7d26dd
unreachable blocks and normal global block lemma
lukashimmelreich Jun 8, 2023
ac203ff
Proof Generation work in progress
lukashimmelreich Jun 14, 2023
9c8d1bf
Proof Generation for Loops finished (order of blocks still in progress)
lukashimmelreich Jun 15, 2023
edf027a
Changed order in which lemmas are generated
lukashimmelreich Jun 21, 2023
5b7f200
set cfg_optimizations branch on .gitmodules
gauravpartha Jun 21, 2023
0cbf184
update submodule branch to matching cfg_optimizations
gauravpartha Jun 21, 2023
0f1580e
Generation of End to End Lemma finished
lukashimmelreich Jun 26, 2023
184f644
CFG Optimizations test files
lukashimmelreich Jun 28, 2023
4a8d256
isLoopHead fix
lukashimmelreich Jun 28, 2023
ebbd0be
Changed some tests and changed the mapping from blocks to coalesced b…
lukashimmelreich Jun 29, 2023
56cd3d8
Changed Topological sort to an iterative approach
lukashimmelreich Jun 29, 2023
1cce2ef
Changed tests and proof generation for new hybrid block lemmas
lukashimmelreich Jul 3, 2023
530444f
Changed test such that it contains optimizations
lukashimmelreich Jul 3, 2023
bc70dad
Merge branch 'ast_to_cfg' into adjust_interface
gauravpartha Jul 3, 2023
3069bbf
add TODOs
gauravpartha Jul 3, 2023
9fb01eb
get rid of RemoveApostrophe usage for axioms
gauravpartha Jul 3, 2023
d447624
Merge branch 'ast_to_cfg' into adjust_interface
gauravpartha Jul 3, 2023
b0743e9
Added new tests for cgf optimizations
lukashimmelreich Jul 5, 2023
0cd8c1b
renamed test
lukashimmelreich Jul 5, 2023
cd64f33
Added flag for End to End Lemma in CFG optimizations
lukashimmelreich Jul 5, 2023
705c299
corrected method where backedges are removed
lukashimmelreich Jul 5, 2023
f807d42
add AllOptionsDisabeld method to ProofGenConfig
gauravpartha Jul 10, 2023
1aaabac
Merge branch 'master' into cfg_optimizations
gauravpartha Jul 10, 2023
d5b79c2
refactor ProofGenConfig and change logic for generating end-to-end le…
gauravpartha Jul 10, 2023
3fa68eb
minor fix
gauravpartha Jul 10, 2023
011c399
Added flag for CFG to DAG proof
lukashimmelreich Jul 11, 2023
3b3d6ec
Minor Change generate proc for CFG to DAG
lukashimmelreich Jul 11, 2023
1a0be6a
Merge branch 'cfg_optimizations' of https://github.com/gauravpartha/b…
gauravpartha Jul 11, 2023
00bb4e5
update submodule
gauravpartha Jul 11, 2023
8555371
Fixed problem with self loops
lukashimmelreich Jul 12, 2023
b517376
update submodule
gauravpartha Jul 12, 2023
fcf8c6e
Minor Change
lukashimmelreich Jul 13, 2023
d8bd046
Added new cfg optimizations tests
lukashimmelreich Jul 18, 2023
a86d767
Changed ListCoalescedBlocks datastructure
lukashimmelreich Jul 28, 2023
f1222bc
Changed test
lukashimmelreich Jul 28, 2023
d652f8f
add out parameters to in parameters
gauravpartha Aug 22, 2023
f84cf82
support unique constants in procedure correctness definition
gauravpartha Oct 22, 2023
bb8b56b
suppport int to real arithmetic conversion in programs
gauravpartha Oct 31, 2023
7fe5a38
more efficient disjointness check
gauravpartha Oct 31, 2023
ad46066
adjust foundational_boogie submodule
gauravpartha Oct 31, 2023
2155df6
Create membership lemma configuration for more fine-grained membershi…
gauravpartha Dec 1, 2023
b9cdc87
merge adjust_interface
gauravpartha Feb 10, 2024
22e39af
update foundational_boogie submodule to commit that merged adjust_int…
gauravpartha Feb 10, 2024
c2442de
remove duplicate method
gauravpartha Feb 10, 2024
ea0ad07
start incorporating unique constants into proof
gauravpartha Feb 10, 2024
ce6f88d
Merge branch 'ast_to_cfg' into cfg_optimizations
gauravpartha Apr 15, 2024
7af2dba
fix typos
gauravpartha Apr 15, 2024
5556d16
removed redundant code
gauravpartha Apr 16, 2024
e3af2d2
clean up
gauravpartha Apr 16, 2024
c53dc16
remove redundant parameter
gauravpartha Apr 16, 2024
d3326b5
if dead variable elimination has an effect, then use two representati…
gauravpartha Apr 17, 2024
d73f40e
fix bug
gauravpartha Apr 18, 2024
ad31b83
connect AST-to-CFG with CFG optimizations if no dead variables are el…
gauravpartha Apr 18, 2024
a5cf177
Also generate and check proofs for CFG optimization benchmarks
gauravpartha Apr 18, 2024
e4015e6
add proof gen region blocks dead var elim
gauravpartha Apr 29, 2024
d66f2c6
update foundational_boogie
gauravpartha Apr 29, 2024
df95304
Merge commit 'ea0ad07a701b449a442035aac3fd6a0c8bc86e46' from branch m…
gauravpartha Apr 29, 2024
dee5441
remove duplicate method for procedure correctness with CFG procedure …
gauravpartha Apr 29, 2024
8ec8769
disable CFG optimization benchmarks on CI
gauravpartha Apr 29, 2024
ed9123c
restore if-then-else statements in ProofGenerationBenchmarks
gauravpartha Apr 29, 2024
4e11ca1
adjust find_supported_boogie_benchmarks.py to work with current versi…
gauravpartha Apr 29, 2024
0c2ea02
replace xor with xorCustom in secure/simple.bpl and remove ProofGen(I…
gauravpartha May 9, 2024
815d1c7
boogie proofs analysis
gauravpartha May 9, 2024
ad804e4
remove duplicate file (same as functiondefine/fundef7.bpl)
gauravpartha May 16, 2024
4c8992c
boogie_proofs_analysis update
gauravpartha May 16, 2024
72078c7
support CFG transformation proofs if there are else-if branches
gauravpartha Aug 20, 2024
2b088a5
handle the case when a predecessor of a loop head has multiple succes…
gauravpartha Aug 21, 2024
2bae7dd
use set and list representation in CFGOptimizationsLemmaManger.getCon…
gauravpartha Aug 21, 2024
4216ee5
update foundational_boogie
gauravpartha Aug 21, 2024
8773cc5
change proof automation for CFG optimizations to deal with case where…
gauravpartha Aug 21, 2024
5c85cef
remove desugared version of DivMod
gauravpartha Sep 21, 2024
542bcb0
proofGenConfig must be reset for every procedure
gauravpartha Sep 24, 2024
6c75136
update foundational_boogie to Isabelle 2024
gauravpartha Nov 21, 2024
57c6b52
minor analysis script adjustments and rename Lit to LitA in issue-32.…
gauravpartha Dec 4, 2024
effb107
minor -> fix rewrite issue-32.bpl
gauravpartha Dec 4, 2024
5292d74
Update README.md
gauravpartha Dec 5, 2024
a378768
Update README.md
gauravpartha Dec 8, 2024
5c704ab
Transfer gauravpartha/foundational_boogie to viperproject/foundationa…
gauravpartha Dec 8, 2024
f546917
Update README.md
gauravpartha Dec 8, 2024
d16ad50
Update README.md
gauravpartha Dec 9, 2024
bc87dfc
Update README.md
gauravpartha Dec 9, 2024
3d7e6cc
Update README.md
gauravpartha Dec 9, 2024
2693516
Update README.md
gauravpartha Dec 9, 2024
871e83f
Update README.md
gauravpartha Dec 9, 2024
b25cfe0
Update README.md
gauravpartha Dec 9, 2024
4e2be7b
Update README.md
gauravpartha Dec 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,21 @@ jobs:
# for the session so that it does not have to rechecked every time
- name: Set up Isabelle Boogie language session
run: |
echo "$PWD/foundational_boogie/BoogieLang" >> isabelle_dir/ROOTS
isabelle_dir/bin/isabelle build -b -j4 -d $PWD/foundational_boogie/BoogieLang Boogie_Lang
echo "$PWD/foundational-boogie/BoogieLang" >> isabelle_dir/ROOTS
isabelle_dir/bin/isabelle build -b -j4 -d $PWD/foundational-boogie/BoogieLang Boogie_Lang

- name: Check external benchmark proofs
run: |
python3 etc/scripts/check_proofs.py --inputdir table_benchmarks_proofs --reps 1

- name: Generate CFG optimization benchmarks
run: |
BOOGIE_EXE=$(find $PWD -type f -name "BoogieDriver")
python3 etc/scripts/generate_proofs.py --inputdir ProofGenerationBenchmarks/cfg_optimizations_tests --outputdir cfg_optimizations_proofs --boogieproofExe $BOOGIE_EXE

#- name: Check CFG optimization proofs
# run: |
# python3 etc/scripts/check_proofs.py --inputdir cfg_optimizations_proofs --reps 1

- name: Generate Boogie benchmark proofs
run: |
Expand All @@ -74,4 +83,4 @@ jobs:

- name: Check Boogie benchmark proofs
run: |
python3 etc/scripts/check_proofs.py --inputdir boogie_benchmarks_proofs --reps 1
python3 etc/scripts/check_proofs.py --inputdir boogie_benchmarks_proofs --reps 1
7 changes: 4 additions & 3 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
[submodule "foundational_boogie"]
path = foundational_boogie
url = https://github.com/gauravpartha/foundational_boogie
[submodule "foundational-boogie"]
path = foundational-boogie
url = https://github.com/viperproject/foundational-boogie
branch = cfg_optimizations
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
// RUN: %boogie "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
/* MANUAL REWRITE:
function foo(x:int) : int
{ if x <= 0 then 1 else foo(x - 1) + 2 }
*/
function foo(x:int) : int;
axiom( forall x:int :: ((x <= 0 ==> foo(x) == 1) && (x > 0 ==> foo(x) == foo(x - 1) + 2)));

procedure bar()
{
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
//:: ProofGen(IgnoreFile)
// Z3 4.1: /trace /proverOpt:O:smt.mbqi=true /proverOpt:O:smt.relevancy=0
function xor(a: bool, b: bool) returns (bool) { (!a && b) || (a && !b) }

/** MANUAL REWRITE: Replaced all xor with xorCustom (since xor is already defined in Isabelle) */
function xorCustom(a: bool, b: bool) returns (bool) { (!a && b) || (a && !b) }

procedure Incorrect_A(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
ap := a;
bp := b;
Expand All @@ -14,7 +15,7 @@ returns ( ap: bool, bp: bool)
procedure Incorrect_B(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
ap := a;
bp := b;
Expand All @@ -23,7 +24,7 @@ returns ( ap: bool, bp: bool)
procedure Incorrect_X(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
ap := a;
bp := b;
Expand All @@ -32,27 +33,27 @@ returns ( ap: bool, bp: bool)
procedure Correct_A(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
havoc ap;
bp := xor(xor(ap, a), b);
bp := xorCustom(xorCustom(ap, a), b);
}

procedure Correct_B(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
havoc ap;
bp := xor(xor(ap, a), b);
bp := xorCustom(xorCustom(ap, a), b);
}

procedure Correct_X(
a: bool, b: bool)
returns ( ap: bool, bp: bool)
ensures xor(ap, bp) == xor(a, b);
ensures xorCustom(ap, bp) == xorCustom(a, b);
{
havoc ap;
bp := xor(xor(ap, a), b);
bp := xorCustom(xorCustom(ap, a), b);
}

Original file line number Diff line number Diff line change
Expand Up @@ -27,20 +27,13 @@ modifies x, y;
}


procedure main() returns (b: bool)
procedure main() returns (b: bool)
modifies x, y;
{
assume x == y;
call foo();
if (x == y) {
call b := bar();
/** MANUAL REWRITE:
assume (if b then x+1 != y else x != y+1);
*/
if(b) {
assume x+1 != y;
} else {
assume x != y+1;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
//:: ProofGen(IgnoreFile)
// RUN: %boogie "%s" > "%t"
// RUN: %diff "%s.expect" "%t"
function Lit<T>(x: T) : T;
axiom Lit(true);

/** MANUEL REWRITE renamed Lit to LitA to avoid Isabelle Lit clash **/
function LitA<T>(x: T) : T;
axiom LitA(true);

procedure test()
{
assert Lit(true);
assert LitA(true);
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,7 @@
//
// Rustan Leino, 23 Sep 2010

/** MANUAL REWRITE:
function abs(x: int): int { if 0 <= x then x else -x }
**/
function abs(x: int): int;
axiom (forall x: int :: ( 0<= x ==> abs(x) == x) && ( (!(0 <= x)) ==> abs(x) == -x));

function divt(int, int): int;
function modt(int, int): int;
Expand Down Expand Up @@ -43,29 +39,9 @@ procedure T_from_E(a,b: int) returns (q,r: int)
qq := dive(a,b);
rr := mode(a,b);

/** MANUAL REWRITE
q := if 0 <= a || rr == 0 then qq else if 0 <= b then qq+1 else qq-1;
r := if 0 <= a || rr == 0 then rr else if 0 <= b then rr-b else rr+b;
**/
if(0 <= a || rr == 0) {
q := qq;
} else {
if (0<=b) {
q := qq+1;
} else {
q := qq-1;
}
}
if (0 <= a || rr == 0) {
r := rr;
} else {
if(0 <= b) {
r := rr-b;
} else {
r := rr+b;
}
}
assume true;
assume true;
}

procedure E_from_T(a,b: int) returns (q,r: int)
Expand All @@ -84,26 +60,6 @@ procedure E_from_T(a,b: int) returns (q,r: int)
qq := divt(a,b);
rr := modt(a,b);

/* MANUAL REWRITE
q := if 0 <= rr then qq else if 0 < b then qq-1 else qq+1;
r := if 0 <= rr then rr else if 0 < b then rr+b else rr-b;
*/
if(0 <= rr) {
q := qq;
} else {
if (0< b) {
q := qq-1;
} else {
q := qq+1;
}
}
if (0 <= rr) {
r := rr;
} else {
if(0 < b) {
r := rr+b;
} else {
r := rr-b;
}
}
}
Loading
Loading