Skip to content

Commit dbbfa41

Browse files
Merge pull request #206 from lefterislazar/rocq-lemmas
Rocq Postcondition and Invariants
2 parents 0385259 + 6e8c3a1 commit dbbfa41

33 files changed

+43586
-12218
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ hevm_multi_fast=$(filter-out $(hevm_multi_slow), $(hevm_multi_pass))
6060
failing_typing=tests/frontend/pass/dss/vat.act tests/frontend/pass/creation/createMultiple.act tests/frontend/pass/staticstore/staticstore.act
6161

6262

63-
coq-examples = tests/coq/transitions tests/coq/safemath tests/coq/exponent tests/coq/token tests/coq/ERC20-simple tests/coq/ERC20 tests/coq/multi
63+
coq-examples = tests/coq/transitions tests/coq/safemath tests/coq/exponent tests/coq/token tests/coq/ERC20-simple tests/coq/ERC20 tests/coq/multi tests/coq/amm
6464

6565
.PHONY: test-coq $(coq-examples)
6666
test-coq: compiler $(coq-examples)

src/Act/Bounds.hs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ addBoundsConstructor ctor@(Constructor _ (Interface _ decls) _ pre post invs sta
3535
, _cpostconditions = post'
3636
, _invariants = invs' }
3737
where
38-
pre' = pre
38+
pre' = nub $ pre
3939
<> mkCallDataBounds decls
4040
<> mkEthEnvBounds (ethEnvFromConstructor ctor)
4141
-- The following is sound as values of locations outside local storage
@@ -55,7 +55,7 @@ addBoundsBehaviour :: Behaviour -> Behaviour
5555
addBoundsBehaviour behv@(Behaviour _ _ (Interface _ decls) _ pre cases post stateUpdates ret) =
5656
behv { _preconditions = pre', _postconditions = post' }
5757
where
58-
pre' = pre
58+
pre' = nub $ pre
5959
<> mkCallDataBounds decls
6060
<> mkStorageBounds stateUpdates Pre
6161
<> mkLocationBounds locs
@@ -72,14 +72,14 @@ addBoundsInvariant :: Constructor -> Invariant -> Invariant
7272
addBoundsInvariant (Constructor _ (Interface _ decls) _ _ _ _ _) inv@(Invariant _ preconds storagebounds (PredTimed predicate _)) =
7373
inv { _ipreconditions = preconds', _istoragebounds = storagebounds' }
7474
where
75-
preconds' = preconds
75+
preconds' = nub $ preconds
7676
<> mkCallDataBounds decls
7777
<> mkEthEnvBounds (ethEnvFromExp predicate)
7878
<> mkLocationBounds nonlocalLocs
7979
storagebounds' = storagebounds
8080
<> mkLocationBounds localLocs
8181

82-
locs = concatMap locsFromExp (preconds <> storagebounds)
82+
locs = nub $ concatMap locsFromExp (preconds <> storagebounds)
8383
<> locsFromExp predicate
8484
(nonlocalLocs, localLocs) = partition (not . isLocalLoc) locs
8585

src/Act/CLI.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ import Act.Syntax.TypedExplicit hiding (_Array)
4747
import Act.Bounds
4848
import Act.SMT as SMT
4949
import Act.Type
50-
import Act.Coq hiding (indent)
50+
import Act.Coq hiding (indent, (<+>))
5151
import Act.HEVM
5252
import Act.HEVM_utils
5353
import Act.Consistency

0 commit comments

Comments
 (0)