diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e025e2a1..31038740 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: verification: strategy: matrix: - version: [ 3.13.1, 4.0.0, 4.1.0, 4.2.0 ] + version: [ 3.13.1, 4.0.0, 4.1.0, 4.2.0, 4.3.0, 4.4.0 ] uses: ./.github/workflows/reusable-tests.yml with: diff --git a/src/Collections/Sequences/MergeSort.dfy b/src/Collections/Sequences/MergeSort.dfy index 42be3a36..f4121e5f 100644 --- a/src/Collections/Sequences/MergeSort.dfy +++ b/src/Collections/Sequences/MergeSort.dfy @@ -12,7 +12,7 @@ module {:options "-functionSyntax:4"} Seq.MergeSort { import opened Relations //Splits a sequence in two, sorts the two subsequences using itself, and merge the two sorted sequences using `MergeSortedWith` - function MergeSortBy(a: seq, lessThanOrEq: (T, T) -> bool): (result :seq) + function MergeSortBy(a: seq, lessThanOrEq: (T, T) -> bool): (result :seq) requires TotalOrdering(lessThanOrEq) ensures multiset(a) == multiset(result) ensures SortedBy(result, lessThanOrEq) @@ -31,7 +31,7 @@ module {:options "-functionSyntax:4"} Seq.MergeSort { MergeSortedWith(leftSorted, rightSorted, lessThanOrEq) } - function {:tailrecursion} MergeSortedWith(left: seq, right: seq, lessThanOrEq: (T, T) -> bool) : (result :seq) + function {:tailrecursion} MergeSortedWith(left: seq, right: seq, lessThanOrEq: (T, T) -> bool) : (result :seq) requires SortedBy(left, lessThanOrEq) requires SortedBy(right, lessThanOrEq) requires TotalOrdering(lessThanOrEq) diff --git a/src/Collections/Sequences/Seq.dfy b/src/Collections/Sequences/Seq.dfy index d98dcd0b..425b717f 100644 --- a/src/Collections/Sequences/Seq.dfy +++ b/src/Collections/Sequences/Seq.dfy @@ -752,11 +752,11 @@ module {:options "-functionSyntax:4"} Seq { } /* inv(b, xs) ==> inv(FoldLeft(f, b, xs), []). */ - lemma LemmaInvFoldLeft(inv: (B, seq) -> bool, - stp: (B, A, B) -> bool, - f: (B, A) -> B, - b: B, - xs: seq) + lemma LemmaInvFoldLeft(inv: (B, seq) -> bool, + stp: (B, A, B) -> bool, + f: (B, A) -> B, + b: B, + xs: seq) requires InvFoldLeft(inv, stp) requires forall b, a :: stp(b, a, f(b, a)) requires inv(b, xs) @@ -810,11 +810,11 @@ module {:options "-functionSyntax:4"} Seq { } /* inv([], b) ==> inv(xs, FoldRight(f, xs, b)) */ - lemma LemmaInvFoldRight(inv: (seq, B) -> bool, - stp: (A, B, B) -> bool, - f: (A, B) -> B, - b: B, - xs: seq) + lemma LemmaInvFoldRight(inv: (seq, B) -> bool, + stp: (A, B, B) -> bool, + f: (A, B) -> B, + b: B, + xs: seq) requires InvFoldRight(inv, stp) requires forall a, b :: stp(a, b, f(a, b)) requires inv([], b) @@ -876,7 +876,7 @@ module {:options "-functionSyntax:4"} Seq { } /* Proves that any two sequences that are sorted by a total order and that have the same elements are equal. */ - lemma SortedUnique(xs: seq, ys: seq, R: (T, T) -> bool) + lemma SortedUnique(xs: seq, ys: seq, R: (T, T) -> bool) requires SortedBy(xs, R) requires SortedBy(ys, R) requires TotalOrdering(R) @@ -896,7 +896,7 @@ module {:options "-functionSyntax:4"} Seq { } /* Converts a set to a sequence that is ordered w.r.t. a given total order. */ - function SetToSortedSeq(s: set, R: (T, T) -> bool): (xs: seq) + function SetToSortedSeq(s: set, R: (T, T) -> bool): (xs: seq) requires TotalOrdering(R) ensures multiset(s) == multiset(xs) ensures SortedBy(xs, R) diff --git a/src/Relations.dfy b/src/Relations.dfy index 9112a83b..05ddc704 100644 --- a/src/Relations.dfy +++ b/src/Relations.dfy @@ -92,7 +92,7 @@ module {:options "-functionSyntax:4"} Relations { max in s && forall x | x in s && R(max, x) :: R(x, max) } - lemma LemmaNewFirstElementStillSortedBy(x: T, s: seq, lessThan: (T, T) -> bool) + lemma LemmaNewFirstElementStillSortedBy(x: T, s: seq, lessThan: (T, T) -> bool) requires SortedBy(s, lessThan) requires |s| == 0 || lessThan(x, s[0]) requires TotalOrdering(lessThan)