Skip to content

Latest commit

 

History

History
31 lines (23 loc) · 557 Bytes

ListSearch.md

File metadata and controls

31 lines (23 loc) · 557 Bytes

Lab: List Search

Prove the following theorem about the search provided in the following file that you should import.

Search.pf

You will also need to import the following files from Deduce's library.

import Nat
import List
import Pair
import Option
import Set
theorem search_correct: all y: Nat. all xs: List<Nat>.
    define front = first(search(xs, y));
    define back = second(search(xs, y));
    (back = [] or head(back) = just(y)) and
    not (y ∈ set_of(front)) and
    front ++ back = xs 
proof
  ?
end