Skip to content

Beginner issue with 'Could not prove termination of this recursive call' #2554

Answered by nikswamy
alex4482 asked this question in Q&A
Discussion options

You must be logged in to vote

let literal = bool
let negateLit = not
module L = FStar.List.Tot
let rec filter_length (#a:_) (f:a -> bool) (l:list a)
  : Lemma (L.length (L.filter f l) <= L.length l)
  = admit() (* prove this *)

let rec removeLiteralsWithBothPolarities literals
  : Tot (res: list literal (* { subset res literals } ... I'll leave that to you *))
        (decreases (L.length literals))
  = match literals with
    | [] -> []
    | lit :: otherLiterals ->
      let negatedLit = negateLit lit in
      let doesContain = L.contains negatedLit otherLiterals in
      if doesContain
      then let fil =(fun (x: literal) -> (x = negatedLit || x = lit)) in
           filter_length fil otherLiterals;
           r…

Replies: 3 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@alex4482
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@alex4482
Comment options

@hacklex
Comment options

Answer selected by alex4482
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants