Skip to content

Instantly share code, notes, and snippets.

@nikivazou
Created November 22, 2023 09:41
Show Gist options
  • Save nikivazou/1c134d34830e73c62cc5e18b8b7c8e98 to your computer and use it in GitHub Desktop.
Save nikivazou/1c134d34830e73c62cc5e18b8b7c8e98 to your computer and use it in GitHub Desktop.
{-@ LIQUID "--reflection" @-}
{-@ LIQUID "--ple" @-}
module FstBug where
import Data.Set hiding (map)
import Prelude hiding (map, fst)
{-@ fstBug :: xys:[(a,b)]
-> x: {a | member x (fromList (map fst xys))}
-> () @-}
fstBug :: Ord a => [(a,b)]-> a -> ()
fstBug xys x = assert (member x (fromList (map fst xys))) ()
{-@ reflect map @-}
map :: (a -> b) -> [a] -> [b]
map f [] = []
map f (x : xs) = f x : map f xs
{-@ reflect fst @-}
fst :: (a, b) -> a
fst (x, y) = x
{-@ assert :: b:{Bool | b } -> a -> a @-}
assert :: Bool -> a -> a
assert _ x = x
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment