Skip to content

Commit

Permalink
[motoko-san] optimization: add trigger for array_init
Browse files Browse the repository at this point in the history
Problem: in `todo_tuple.mo` it is necessary to finish proofs
  • Loading branch information
GoPavel committed Jun 24, 2024
1 parent fedcdbe commit 5f24a3c
Show file tree
Hide file tree
Showing 26 changed files with 26 additions and 26 deletions.
2 changes: 1 addition & 1 deletion src/viper/prelude.ml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x|prelude}
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x|prelude}

let pp_tup_decl_param ppf i = Format.fprintf ppf "T%d" i
let pp_tup_decl_params ppf = function
Expand Down
2 changes: 1 addition & 1 deletion test/repl/ok/viper.stdout.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/array-of-tuples.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
adt Tuple$2 [T0, T1] { Tup$2(tup$2$0 : T0, tup$2$1 : T1) }
/* Option encoding */
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/array.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/assertions.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/async.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/claim-broken.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/claim-reward-naive.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/claim-simple.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/claim.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/counter.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/invariant.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/label-break-continue.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
adt Tuple$0 { Tup$0() }
adt Tuple$2 [T0, T1] { Tup$2(tup$2$0 : T0, tup$2$1 : T1) }
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/lits.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/loop-invariant.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/method-call.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/nats.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/odd-even.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/option.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/polymono.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/private.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/reverse.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/simple-funs.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/text.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
adt Tuple$2 [T0, T1] { Tup$2(tup$2$0 : T0, tup$2$1 : T1) }
/* Option encoding */
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/tuple.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
adt Tuple$2 [T0, T1] { Tup$2(tup$2$0 : T0, tup$2$1 : T1) }
adt Tuple$10 [T0, T1, T2, T3, T4, T5, T6, T7, T8, T9]
Expand Down
2 changes: 1 addition & 1 deletion test/viper/ok/variants.vpr.ok
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ domain Array {
}
define $array_acc(a, t, p) forall j: Int :: 0 <= j && j < $size(a) ==> acc($loc(a, j).t, p)
define $array_untouched(a, t) forall j: Int :: 0 <= j && j < $size(a) ==> $loc(a, j).t == old($loc(a, j).t)
define $array_init(a, t, x) forall i : Int :: 0 <= i && i < $size(a) ==> $loc(a, i).t == x
define $array_init(a, t, x) forall i : Int :: {$loc(a, i).t} 0 <= i && i < $size(a) ==> $loc(a, i).t == x
/* Tuple encoding */
/* Option encoding */
adt Option[T] {
Expand Down

0 comments on commit 5f24a3c

Please sign in to comment.