Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing import statement in documentation example #199

Open
nunomota opened this issue Apr 20, 2016 · 2 comments
Open

Missing import statement in documentation example #199

nunomota opened this issue Apr 20, 2016 · 2 comments

Comments

@nunomota
Copy link

In the Induction section of Proving Theorems, the below example does not make a reference to leon.proof:

import leon.collection._ // for List
import leon.lang._       // for holds

object Example {
  def reverseReverse[T](l: List[T]): Boolean = {
    l.reverse.reverse == l
  }.holds
}

Which is then needed in the following steps (for because, check and trivial calls):

def reverseReverse[T](l: List[T]): Boolean = {
  l.reverse.reverse == l because {
    l match {
      case Nil()       => check {  Nil[T]().reverse.reverse == Nil[T]()  }
      case Cons(x, xs) => check { (x :: xs).reverse.reverse == (x :: xs) }
    }
  }
}.holds
def reverseReverse[T](l: List[T]): Boolean = {
  l.reverse.reverse == l because {
    l match {
      case Nil()       => trivial
      case Cons(x, xs) => check { (xs.reverse :+ x).reverse == (x :: xs) }
    }
  }
}.holds
@manoskouk
Copy link
Member

@mantognini Maybe you want to look into this?

@mantognini
Copy link
Contributor

While because and check were already introduced before, we could add import leon.proof._ // for check, trivial and because as well to make things more obvious and simplify copy-pasting the examples. It would also be a bit more consistent with other snippets.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants