-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
157 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module MyBag where | ||
|
||
import qualified Data.Map as M | ||
|
||
{-@ embed Bag as Bag_t @-} | ||
data Bag a = Bag { toMap :: M.Map a Int } deriving Eq | ||
|
||
{-@ assume empty :: {v:Bag k | v = Bag_empty 0} @-} | ||
empty :: Bag k | ||
empty = Bag M.empty | ||
|
||
{-@ assume sng :: (Ord k) => k:k -> {v:Bag k | v = Bag_sng k 1} @-} | ||
sng :: (Ord k) => k -> Bag k | ||
sng k = Bag (M.singleton k 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
{-@ LIQUID "--expect-any-error" @-} | ||
module MyBagDefine where | ||
|
||
import MyBag | ||
import Data.Set | ||
|
||
{-@ define empty = (Bag_empty 0) @-} | ||
{-@ define sng k = (Bag_sng k 1) @-} | ||
|
||
{-@ thm_emp :: x:k -> { empty /= sng x } @-} | ||
thm_emp :: (Ord k) => k -> () | ||
thm_emp x = const () (sng x) | ||
|
||
{-@ thm_emp' :: x:k -> xs:Bag k -> { empty /= put x xs } @-} | ||
thm_emp' :: (Ord k) => k -> Bag k -> () | ||
thm_emp' x xs = const () (put x xs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module MyBag where | ||
|
||
import qualified Data.Map as M | ||
|
||
{-@ embed Bag as Bag_t @-} | ||
data Bag a = Bag { toMap :: M.Map a Int } deriving Eq | ||
|
||
{-@ assume empty :: {v:Bag k | v = Bag_empty 0} @-} | ||
empty :: Bag k | ||
empty = Bag M.empty | ||
|
||
{-@ assume sng :: (Ord k) => k:k -> {v:Bag k | v = Bag_sng k 1} @-} | ||
sng :: (Ord k) => k -> Bag k | ||
sng k = Bag (M.singleton k 1) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module MyBagDefine where | ||
|
||
import MyBag as B | ||
import Data.Set | ||
|
||
{- dropping the qualification will trigger the "Ambiguous specification symbol" error -} | ||
{-@ define B.empty = (Bag_empty 0) @-} | ||
{-@ define sng k = (Bag_sng k 1) @-} | ||
|
||
{-@ thm_emp :: x:k -> { B.empty /= sng x } @-} | ||
thm_emp :: (Ord k) => k -> () | ||
thm_emp x = const () (sng x) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
module NumRefl1 where | ||
|
||
{- | ||
The `define` should be propagated from NumRefl, otherwise the test fails | ||
with the same error. | ||
-} | ||
import NumRefl | ||
|
||
{-@ reflect toNum1 @-} | ||
toNum1 :: Num p => () -> p | ||
toNum1 _ = -2 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters