Skip to content
Snippets Groups Projects
Commit 7646a01d authored by ISWB Prasetya's avatar ISWB Prasetya
Browse files

bug fixing WLP

parent 96fb0437
No related branches found
No related tags found
No related merge requests found
...@@ -42,7 +42,7 @@ wlpStmtAlgebra = (fStmtBlock, fIfThen, fIfThenElse, fWhile, fBasicFor, fEnhanced ...@@ -42,7 +42,7 @@ wlpStmtAlgebra = (fStmtBlock, fIfThen, fIfThenElse, fWhile, fBasicFor, fEnhanced
fWhile e s inh = let (e', trans) = foldExp wlpExpAlgebra e inh {acc = id} fWhile e s inh = let (e', trans) = foldExp wlpExpAlgebra e inh {acc = id}
var = getVar var = getVar
in (\q -> unrollLoop inh nrOfUnroll e' trans (s (inh {acc = id, br = const q})) q) . acc inh in (\q -> unrollLoop inh nrOfUnroll e' trans (s (inh {acc = id, br = const q})) q) . acc inh
fBasicFor init me incr s inh = let loop = (fWhile (fromMaybeGuard me) (\inh' -> s (inh {acc = (wlp' inh {acc = id} (incrToStmt incr))})) inh) in wlp' (inh {acc = loop}) (initToStmt init) fBasicFor init me incr s inh = let loop = (fWhile (fromMaybeGuard me) (\inh' -> s (inh' {acc = (wlp' inh' {acc = id} (incrToStmt incr))})) inh) in wlp' (inh {acc = loop}) (initToStmt init)
fEnhancedFor = error "EnhancedFor" fEnhancedFor = error "EnhancedFor"
fEmpty inh = (acc inh) -- Empty does nothing, but still passes control to the next statement fEmpty inh = (acc inh) -- Empty does nothing, but still passes control to the next statement
fExpStmt e inh = snd $ foldExp wlpExpAlgebra e inh fExpStmt e inh = snd $ foldExp wlpExpAlgebra e inh
...@@ -94,7 +94,7 @@ wlpStmtAlgebra = (fStmtBlock, fIfThen, fIfThenElse, fWhile, fBasicFor, fEnhanced ...@@ -94,7 +94,7 @@ wlpStmtAlgebra = (fStmtBlock, fIfThen, fIfThenElse, fWhile, fBasicFor, fEnhanced
unrollLoop inh 0 g gTrans _ = let var = getVar unrollLoop inh 0 g gTrans _ = let var = getVar
in gTrans . substVar' inh var g . (neg (ExpName (Name [var])) `imp`) in gTrans . substVar' inh var g . (neg (ExpName (Name [var])) `imp`)
unrollLoop inh n g gTrans bodyTrans = let var = getVar unrollLoop inh n g gTrans bodyTrans = let var = getVar
in gTrans . substVar' inh var g . (\q -> (ExpName (Name [var]) &* bodyTrans q) |* (neg (ExpName (Name [var])) &* unrollLoop inh (n-1) g gTrans bodyTrans q)) in gTrans . substVar' inh var g . (\q -> (neg (ExpName (Name [var])) `imp` q) &* ((ExpName (Name [var])) `imp` bodyTrans (unrollLoop inh (n-1) g gTrans bodyTrans q)))
-- Converts initialization code of a for loop to a statement -- Converts initialization code of a for loop to a statement
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment