Skip to content

Commit

Permalink
Add post to List.withFilter
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Oct 3, 2019
1 parent 1ef5392 commit 5e73cf5
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion frontends/library/stainless/collection/List.scala
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,13 @@ sealed abstract class List[T] {
}

// In case we implement for-comprehensions
def withFilter(p: T => Boolean) = filter(p)
def withFilter(p: T => Boolean): List[T] = {
filter(p)
} ensuring { res =>
res.size <= this.size &&
res.content.subsetOf(this.content) &&
res.forall(p)
}

@isabelle.function(term = "%xs P. List.list_all P xs")
def forall(p: T => Boolean): Boolean = this match {
Expand Down

0 comments on commit 5e73cf5

Please sign in to comment.