This PR adds two benchmarks (sieve of Eratosthenes, removing duplicates from the list) and one test (a function with sublinear complexity defined via well-founded recursion evaluated on large naturals with up to `60` digits). The tests have been suggested by @b-mehta.
16 lines
393 B
Text
16 lines
393 B
Text
import Std
|
|
set_option cbv.warning false
|
|
|
|
def dedup (l : List Nat) : List Nat := Id.run do
|
|
let mut S : Std.TreeSet Nat := ∅
|
|
for i in l do
|
|
S := S.insert i
|
|
return S.toList
|
|
|
|
example : dedup [1] = [1] := by conv => lhs; cbv
|
|
|
|
example : dedup [1,2] = [1,2] := by conv => lhs; cbv
|
|
|
|
example : dedup [1,1] = [1] := by conv => lhs; cbv
|
|
|
|
example : dedup [1,2,2] = [1,2] := by conv => lhs; cbv
|