liquidhaskell 0.9.14.1.1 → 0.9.14.1.2
raw patch · 10 files changed
+184/−100 lines, 10 filesdep ~liquidhaskell-boot
Dependency ranges changed: liquidhaskell-boot
Files
- CHANGES.md +81/−0
- README.md +41/−21
- liquidhaskell.cabal +2/−2
- src/Data/ByteString/Char8_LHAssumptions.hs +5/−5
- src/Data/ByteString/Lazy/Char8_LHAssumptions.hs +4/−4
- src/Data/ByteString/Lazy_LHAssumptions.hs +14/−14
- src/Data/ByteString_LHAssumptions.hs +15/−15
- src/Data/Foldable_LHAssumptions.hs +1/−0
- src/GHC/Num_LHAssumptions.hs +2/−2
- src/GHC/Real_LHAssumptions.hs +19/−37
CHANGES.md view
@@ -4,6 +4,87 @@ ## 0.9.14.1.1 (2026-06-04) +- Reject `ple` and `automatic-instances` annotations in modules that enable+ neither `--ple-local` nor `--ple`+ [#2737](https://github.com/ucsd-progsys/liquidhaskell/issues/2737)+ [#2739](https://github.com/ucsd-progsys/liquidhaskell/pull/2739)+- Emit the `autosize` measure under its resolved name, so constraints that+ mention it are no longer rejected as having a free variable+ [#2736](https://github.com/ucsd-progsys/liquidhaskell/issues/2736)+ [#2738](https://github.com/ucsd-progsys/liquidhaskell/pull/2738)+- Skip the termination metric of a recursive group whose decreasing parameters+ have different types, instead of building one the solver cannot sort check+ [#2736](https://github.com/ucsd-progsys/liquidhaskell/issues/2736)+ [#2738](https://github.com/ucsd-progsys/liquidhaskell/pull/2738)+- Count the fields of every autosized type in the `autosize` measure, so the+ size grows along the edges between mutually recursive types+ [#2736](https://github.com/ucsd-progsys/liquidhaskell/issues/2736)+ [#2742](https://github.com/ucsd-progsys/liquidhaskell/pull/2742)+- Point to workarounds when a name cannot be resolved in the specification of a+ local definition, since desugaring can rename the parameters it refers to+ [#2704](https://github.com/ucsd-progsys/liquidhaskell/issues/2704)+ [#2778](https://github.com/ucsd-progsys/liquidhaskell/pull/2778)+- Expand type aliases in the signatures of class measures and instance measures,+ instead of panicking+ [#2528](https://github.com/ucsd-progsys/liquidhaskell/issues/2528)+ [#2779](https://github.com/ucsd-progsys/liquidhaskell/pull/2779)+- Allow holes in specifications for arguments and data constructor fields with a+ higher-rank type, instead of crashing+ [#2512](https://github.com/ucsd-progsys/liquidhaskell/issues/2512)+ [#2785](https://github.com/ucsd-progsys/liquidhaskell/pull/2785)+- Implement rapier-style substitution+ [#2682](https://github.com/ucsd-progsys/liquidhaskell/pull/2682)+ [#2683](https://github.com/ucsd-progsys/liquidhaskell/pull/2683)+ [#2687](https://github.com/ucsd-progsys/liquidhaskell/pull/2687)+- Implement flag --allocs to plot allocations in benchmark comparisons+ [#2685](https://github.com/ucsd-progsys/liquidhaskell/pull/2685)+- Change desugaring of dependent tuples.+ Now it is desugared as `(ta, _) <{\a -> tb}>`, which works even if `tb` uses+ type aliases.+ [#2688](https://github.com/ucsd-progsys/liquidhaskell/pull/2688)+ [#2764](https://github.com/ucsd-progsys/liquidhaskell/pull/2688)+- Fix typeSort for type-level Nat literals and type families+ [#2690](https://github.com/ucsd-progsys/liquidhaskell/pull/2690)+- Fix error message dropping predicates with inlined functions+ [#2691](https://github.com/ucsd-progsys/liquidhaskell/pull/2691)+- Fix panic when data type name collides with imported type alias+ [#2699](https://github.com/ucsd-progsys/liquidhaskell/pull/2691)+- Implement ignore annotation for methods in class instances+ [#2700](https://github.com/ucsd-progsys/liquidhaskell/pull/2700)+- Detect derived type class instances with source spans and ignore annotation for methods+ [#2700](https://github.com/ucsd-progsys/liquidhaskell/pull/2700)+- Add Refcore calculus, extraction and test. RefCore is a language to export+ LiquidHaskell specifications to other tools like proof assistants.+ [#2708](https://github.com/ucsd-progsys/liquidhaskell/pull/2708)+- Restore typeclass support+ [#2716](https://github.com/ucsd-progsys/liquidhaskell/pull/2716)+ [#2747](https://github.com/ucsd-progsys/liquidhaskell/pull/2747)+ [#2762](https://github.com/ucsd-progsys/liquidhaskell/pull/2762)+- Eliminate uses of const when eliminating (?) as well. This speeds up+ verification when const is used to apply lemmas.+ [#2732](https://github.com/ucsd-progsys/liquidhaskell/pull/2732)+- Change div/mod specification to match Haskell semantics+ [#2734](https://github.com/ucsd-progsys/liquidhaskell/pull/2734)+- Better support for newtypes+ [#2754](https://github.com/ucsd-progsys/liquidhaskell/pull/2754)+ [#2755](https://github.com/ucsd-progsys/liquidhaskell/pull/2755)+- Added experimental support to check the specifications of reflected+ functions and measures.+ [#2765](https://github.com/ucsd-progsys/liquidhaskell/pull/2765)+- Reduce memory overhead when storing and loading LiquidHaskell specifications+ [#2767](https://github.com/ucsd-progsys/liquidhaskell/pull/2767)+- Expand type aliases in class measures and instance measures+ [#2779](https://github.com/ucsd-progsys/liquidhaskell/pull/2779)+- Allow holes for arguments with a higher-rank type+ [#2785](https://github.com/ucsd-progsys/liquidhaskell/pull/2785)+- Fix specifications of bytestring functions+ [#2782](https://github.com/ucsd-progsys/liquidhaskell/pull/2782)+- Fix specifications of div/mod/quot/rem+ [#2786](https://github.com/ucsd-progsys/liquidhaskell/pull/2786)+ [#2787](https://github.com/ucsd-progsys/liquidhaskell/pull/2787)++## 0.9.14.1.1 (2026-06-04)+ - Stop shadowing reflected signatures with assumed signatures [#2675](https://github.com/ucsd-progsys/liquidhaskell/pull/2675) - Allow parenthesis in arguments to type aliases. Require type aliases to start with upper-case
README.md view
@@ -9,7 +9,7 @@ ## Trying it from Hackage -Assuming the [Z3](https://github.com/Z3Prover/z3) SMT solver version `4.8.17` or+Assuming the [Z3](https://github.com/Z3Prover/z3) SMT solver version `4.15.1` or newer is installed and available in your `PATH`, you can run ```@@ -27,7 +27,7 @@ ## Trying it from GitHub -The github repo builds with GHC `9.14.1`, cabal-install `3.16.1.0`, and `z3` `9.8.17` or newer, all of+The github repo builds with GHC `9.14.1`, cabal-install `3.16.1.0`, and `z3` `4.15.1` or newer, all of which must be in your `PATH`. ```@@ -146,13 +146,18 @@ find dist-newstyle -name "tests-*" -o -name "prover-ple-lib-*" | xargs rm -r ``` -When `liquidhaskell` tests run, we can collect timing information with+When `liquidhaskell` tests run, we can collect measures with $ ./scripts/test/test_plugin.sh --measure-timings -Measures will be collected in `.dump-timings` files under `dist-newstyle` directory. These can be-converted to json data with+Measures will be collected in `.dump-timings` files under `dist-newstyle` directory.+This runs all tests and measures in parallel. The `--measure-timings` flag is reliable+if you want to measure allocations. But if you want to measure time, and you want to+reduce interference between the tests, you need to use the flag `--measure-timings-j1`+instead, which runs tests one at a time. +The `.dump-timings` files can be converted to json data with+ ```bash cabal build ghc-timings cabal exec ghc-timings dist-newstyle@@ -165,23 +170,24 @@ cabal run benchmark-timings -- tmp/*.json --phase LiquidHaskellCPU -o summary.csv ``` On each line, the report will contain the CPU time taken by each test.-Use `--phase LiquidHaskell` to get the wall-clock time instead. Although in that-case you need to use the `--measure-timings-j1` option when running the tests,-which validates modules one at a time.+Use `--phase LiquidHaskell` to get the wall-clock time instead. Comparison charts in `svg` format can be generated by invoking ```-cabal run plot-performance -- -b path_to_before_summary.csv -a path_to_after_summary.csv -s 50+cabal run plot-performance -- -b path_to_before_summary.csv -a path_to_after_summary.csv -s 50 --allocs ``` -This will generate two files `top.svg` and `bot.svg` containing the top 50 speedups and slowdowns-over the entire test set, both enabled by the `-s` option) in the current directory. Alternatively,-a subset of the tests can be selected by a prefix of their names with `-f <prefix>`, for instance+This will generate two files `top.svg` and `bot.svg` containing the top 50 improvements and+regressions over the entire test set, both enabled by the `-s` option) in the current+directory. If you want to see time, instead of allocations, drop the `--allocs` flag.++If not all the tests are relevant, a subset of the tests can be selected by a prefix of their+names with `-f <prefix>`, for instance `-f benchmarks`. `-f` will generate a file `filtered.svg` containing the comparisons of the selected tests. The `-f` and `-s` options can be used/omitted independently. If both are omitted, a single `perf.svg` will be produced covering the full input test set. Additionally, their effects can be combined by providing a third `-c`-option (this will produce 2 files `filtered-top.svg` and `filtered-bot.svg` instead of 3). An optional key `-o` can be+option (this will produce 2 files `filtered-top.svg` and `filtered-bot.svg` instead of 3). An optional key `-o` can be supplied to specify an output directory for the generated files. There is also a legacy script `scripts/plot-performance/chart_perf.sh` that can be used to generate comparison charts@@ -202,7 +208,7 @@ benchmark-icfp15-pos \ benchmark-icfp15-neg -## Miscelaneous tasks+## Miscellaneous tasks * **Profiling** See the instructions in [scripts/profiling-driver/ProfilingDriver.hs](scripts/profiling-driver/ProfilingDriver.hs). * **Getting stack traces on exceptions** See `-xc` flag in the [GHC user's guide][ghc-users-guide].@@ -258,8 +264,9 @@ # GHC Plugin Development Guide -This code commentary describes the current architecture for the GHC [Plugin][] that enables LiquidHaskell-to check files as part of the normal compilation process. For the sake of this commentary, we refer to+This code commentary describes the current architecture for the GHC [Plugin][]+that enables LiquidHaskell to check files as part of the normal compilation+process. For the sake of this commentary, we refer to the code provided as part of the `release/0.8.10.2` branch, commit `9a2f8284c5fe5b18ed0410e842acd3329a629a6b`. ## GHC.Interface vs GHC.Plugin@@ -285,10 +292,21 @@ * Storing the [LiftedSpec][] into an interface annotation for later retrieval; * Checking and verifying the module using LH's existing API. +Each checked module publishes a serialized `LiquidLib` in its GHC interface+(`.hi`) file. It contains the module's own [LiftedSpec][] and a flat list of+dependency references. Each reference identifies a module, including its+package/unit, and the fingerprint of its specification payload.++The payload lives in `liquidhaskell.spec.v1`, the plugin's named field in GHC's+extensible interface storage. A small module annotation holds the format+version and payload fingerprint. The fingerprint participates+in GHC's recompilation checks.+ The reason why we do everything in the [typechecking phase][] is also to allow integrations with tools like [ghcide][]. There are a number of differences between the plugin and the operations performed as part of the [GHC.Interface][], which we are going to outline in the next section. + ## Differences with the GHC.Interface - The [GHC.Interface][] pre-processes the input files and calls into [configureGhcTargets][] trying to@@ -342,15 +360,17 @@ [GHC.Plugin]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin.hs [GHC.Interface]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Interface.hs [SpecFinder]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin/SpecFinder.hs-[LiftedSpec]: liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs#L559-[TargetSrc]: liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs#L158-[typechecking phase]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin.hs#L211-L226+[Serialisation]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin/Serialisation.hs+[Compact]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin/Compact.hs+[LiftedSpec]: liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs#L737+[TargetSrc]: liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs#L176+[typechecking phase]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin.hs#L304 [ghcide]: https://github.com/haskell/ghcide-[findRelevantSpecs]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin/SpecFinder.hs#L65 [core binds]: https://hackage.haskell.org/package/ghc-9.6.3/docs/GHC-Core.html#t:CoreBind+[findRelevantSpecs]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin/SpecFinder.hs#L54 [configureGhcTargets]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Interface.hs#L254 [processTargetModule]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Interface.hs#L483-[processModule]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin.hs#L509+[processModule]: liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/Plugin.hs#L535 # Module Verification Process
liquidhaskell.cabal view
@@ -1,6 +1,6 @@ cabal-version: 2.4 name: liquidhaskell-version: 0.9.14.1.1+version: 0.9.14.1.2 synopsis: Liquid Types for Haskell description: Liquid Types for Haskell. license: BSD-3-Clause@@ -79,7 +79,7 @@ hs-source-dirs: src build-depends: base >= 4.11.1.0 && < 5,- liquidhaskell-boot == 0.9.14.1.1,+ liquidhaskell-boot == 0.9.14.1.2, bytestring, containers, ghc-prim
src/Data/ByteString/Char8_LHAssumptions.hs view
@@ -95,7 +95,7 @@ :: (GHC.Types.Char -> GHC.Types.Char -> GHC.Types.Char) -> GHC.Types.Char -> i : ByteString- -> { o : ByteString | bslen o == bslen i }+ -> { o : ByteString | bslen o == bslen i + 1 } assume Data.ByteString.Char8.scanl1 :: (GHC.Types.Char -> GHC.Types.Char -> GHC.Types.Char)@@ -106,7 +106,7 @@ :: (GHC.Types.Char -> GHC.Types.Char -> GHC.Types.Char) -> GHC.Types.Char -> i : ByteString- -> { o : ByteString | bslen o == bslen i }+ -> { o : ByteString | bslen o == bslen i + 1 } assume Data.ByteString.Char8.scanr1 :: (GHC.Types.Char -> GHC.Types.Char -> GHC.Types.Char)@@ -128,13 +128,13 @@ assume Data.ByteString.Char8.replicate :: n : Int -> GHC.Types.Char- -> { bs : ByteString | bslen bs == n }+ -> { bs : ByteString | (n <= 0 ==> bslen bs == 0) && (0 <= n ==> bslen bs == n) } assume Data.ByteString.Char8.unfoldrN :: n : Int -> (a -> Maybe (GHC.Types.Char, a)) -> a- -> ({ bs : ByteString | bslen bs <= n }, Maybe a)+ -> ({ bs : ByteString | (n <= 0 ==> bslen bs == 0) && (0 <= n ==> bslen bs <= n) }, Maybe a) assume Data.ByteString.Char8.takeWhile :: (GHC.Types.Char -> GHC.Types.Bool)@@ -258,7 +258,7 @@ assume Data.ByteString.Char8.count :: GHC.Types.Char -> bs : ByteString- -> { n : Int | 0 <= n && n < bslen bs }+ -> { n : Int | 0 <= n && n <= bslen bs } assume Data.ByteString.Char8.zip :: l : ByteString
src/Data/ByteString/Lazy/Char8_LHAssumptions.hs view
@@ -89,7 +89,7 @@ :: (Char -> Char -> Char) -> Char -> i : ByteString- -> { o : ByteString | bllen o == bllen i }+ -> { o : ByteString | bllen o == bllen i + 1 } assume Data.ByteString.Lazy.Char8.scanl1 :: (Char -> Char -> Char)@@ -100,7 +100,7 @@ :: (Char -> Char -> Char) -> Char -> i : ByteString- -> { o : ByteString | bllen o == bllen i }+ -> { o : ByteString | bllen o == bllen i + 1 } assume Data.ByteString.Lazy.Char8.scanr1 :: (Char -> Char -> Char)@@ -122,7 +122,7 @@ assume Data.ByteString.Lazy.Char8.replicate :: n : Int64 -> Char- -> { bs : ByteString | bllen bs == n }+ -> { bs : ByteString | (n <= 0 ==> bllen bs == 0) && (0 <= n ==> bllen bs == n) } assume Data.ByteString.Lazy.Char8.takeWhile :: (Char -> Bool)@@ -227,7 +227,7 @@ assume Data.ByteString.Lazy.Char8.count :: Char -> bs : ByteString- -> { n : Int64 | 0 <= n && n < bllen bs }+ -> { n : Int64 | 0 <= n && n <= bllen bs } assume Data.ByteString.Lazy.Char8.zip :: l : ByteString
src/Data/ByteString/Lazy_LHAssumptions.hs view
@@ -39,7 +39,7 @@ assume fromChunks :: i : [Data.ByteString.ByteString]- -> { o : ByteString | len i == 0 <=> bllen o == 0 }+ -> { o : ByteString | len i == 0 ==> bllen o == 0 } assume toChunks :: i : ByteString@@ -146,7 +146,7 @@ :: (_ -> _ -> _) -> _ -> i : ByteString- -> { o : ByteString | bllen o == bllen i }+ -> { o : ByteString | bllen o == bllen i + 1 } assume Data.ByteString.Lazy.mapAccumL :: (acc -> _ -> (acc, _))@@ -163,31 +163,31 @@ assume Data.ByteString.Lazy.replicate :: n : Int64 -> _- -> { bs : ByteString | bllen bs == n }+ -> { bs : ByteString | (n <= 0 ==> bllen bs == 0) && (0 <= n ==> bllen bs == n) } assume Data.ByteString.Lazy.take :: n : Int64 -> i : ByteString -> { o : ByteString | (n <= 0 ==> bllen o == 0) && ((0 <= n && n <= bllen i) <=> bllen o == n) &&- (bllen i <= n <=> bllen o = bllen i) }+ (bllen i <= n ==> bllen o = bllen i) } assume Data.ByteString.Lazy.drop :: n : Int64 -> i : ByteString- -> { o : ByteString | (n <= 0 <=> bllen o == bllen i) &&+ -> { o : ByteString | (n <= 0 ==> bllen o == bllen i) && ((0 <= n && n <= bllen i) <=> bllen o == bllen i - n) &&- (bllen i <= n <=> bllen o == 0) }+ (bllen i <= n ==> bllen o == 0) } assume Data.ByteString.Lazy.splitAt :: n : Int64 -> i : ByteString- -> ( { l : ByteString | (n <= 0 <=> bllen l == 0) &&+ -> ( { l : ByteString | (n <= 0 ==> bllen l == 0) && ((0 <= n && n <= bllen i) <=> bllen l == n) &&- (bllen i <= n <=> bllen l == bllen i) }- , { r : ByteString | (n <= 0 <=> bllen r == bllen i) &&+ (bllen i <= n ==> bllen l == bllen i) }+ , { r : ByteString | (n <= 0 ==> bllen r == bllen i) && ((0 <= n && n <= bllen i) <=> bllen r == bllen i - n) &&- (bllen i <= n <=> bllen r == 0) }+ (bllen i <= n ==> bllen r == 0) } ) assume Data.ByteString.Lazy.takeWhile@@ -244,12 +244,12 @@ assume Data.ByteString.Lazy.isPrefixOf :: l : ByteString -> r : ByteString- -> { b : Bool | bllen l >= bllen r ==> not b }+ -> { b : Bool | bllen l > bllen r ==> not b } assume Data.ByteString.Lazy.isSuffixOf :: l : ByteString -> r : ByteString- -> { b : Bool | bllen l >= bllen r ==> not b }+ -> { b : Bool | bllen l > bllen r ==> not b } assume Data.ByteString.Lazy.elem :: _@@ -311,7 +311,7 @@ assume Data.ByteString.Lazy.count :: _ -> bs : ByteString- -> { n : Int64 | 0 <= n && n < bllen bs }+ -> { n : Int64 | 0 <= n && n <= bllen bs } assume Data.ByteString.Lazy.zip :: l : ByteString@@ -337,7 +337,7 @@ assume Data.ByteString.Lazy.hGet :: _ -> n : { n : Int | 0 <= n }- -> IO { bs : ByteString | bllen bs == n || bllen bs == 0 }+ -> IO { bs : ByteString | bllen bs <= n } assume Data.ByteString.Lazy.hGetNonBlocking :: _
src/Data/ByteString_LHAssumptions.hs view
@@ -123,7 +123,7 @@ assume Data.ByteString.scanl :: (_ -> _ -> _) -> _ -> i : ByteString- -> { o : ByteString | bslen o == bslen i }+ -> { o : ByteString | bslen o == bslen i + 1 } assume Data.ByteString.scanl1 :: (_ -> _ -> _) -> i : { i : ByteString | 1 <= bslen i }@@ -133,7 +133,7 @@ :: (_ -> _ -> _) -> _ -> i : ByteString- -> { o : ByteString | bslen o == bslen i }+ -> { o : ByteString | bslen o == bslen i + 1 } assume Data.ByteString.scanr1 :: (_ -> _ -> _)@@ -155,37 +155,37 @@ assume Data.ByteString.replicate :: n : Int -> _- -> { bs : ByteString | bslen bs == n }+ -> { bs : ByteString | (n <= 0 ==> bslen bs == 0) && (0 <= n ==> bslen bs == n) } assume Data.ByteString.unfoldrN :: n : Int -> (a -> Maybe (_, a)) -> a- -> ({ bs : ByteString | bslen bs <= n }, Maybe a)+ -> ({ bs : ByteString | (n <= 0 ==> bslen bs == 0) && (0 <= n ==> bslen bs <= n) }, Maybe a) assume Data.ByteString.take :: n : Int -> i : ByteString- -> { o : ByteString | (n <= 0 <=> bslen o == 0) &&+ -> { o : ByteString | (n <= 0 ==> bslen o == 0) && ((0 <= n && n <= bslen i) <=> bslen o == n) &&- (bslen i <= n <=> bslen o = bslen i) }+ (bslen i <= n ==> bslen o = bslen i) } assume Data.ByteString.drop :: n : Int -> i : ByteString- -> { o : ByteString | (n <= 0 <=> bslen o == bslen i) &&+ -> { o : ByteString | (n <= 0 ==> bslen o == bslen i) && ((0 <= n && n <= bslen i) <=> bslen o == bslen i - n) &&- (bslen i <= n <=> bslen o == 0) }+ (bslen i <= n ==> bslen o == 0) } assume Data.ByteString.splitAt :: n : Int -> i : ByteString- -> ( { l : ByteString | (n <= 0 <=> bslen l == 0) &&+ -> ( { l : ByteString | (n <= 0 ==> bslen l == 0) && ((0 <= n && n <= bslen i) <=> bslen l == n) &&- (bslen i <= n <=> bslen l == bslen i) }- , { r : ByteString | (n <= 0 <=> bslen r == bslen i) &&+ (bslen i <= n ==> bslen l == bslen i) }+ , { r : ByteString | (n <= 0 ==> bslen r == bslen i) && ((0 <= n && n <= bslen i) <=> bslen r == bslen i - n) &&- (bslen i <= n <=> bslen r == 0) }+ (bslen i <= n ==> bslen r == 0) } ) assume Data.ByteString.takeWhile@@ -256,7 +256,7 @@ assume Data.ByteString.isPrefixOf :: l : ByteString -> r : ByteString- -> { b : Bool | bslen l >= bslen r ==> not b }+ -> { b : Bool | bslen l > bslen r ==> not b } assume Data.ByteString.isSuffixOf :: l : ByteString@@ -332,7 +332,7 @@ assume Data.ByteString.count :: _ -> bs : ByteString- -> { n : Int | 0 <= n && n < bslen bs }+ -> { n : Int | 0 <= n && n <= bslen bs } assume Data.ByteString.zip :: l : ByteString@@ -362,7 +362,7 @@ assume Data.ByteString.hGet :: _ -> n : { n : Int | 0 <= n }- -> (IO { bs : ByteString | bslen bs == n || bslen bs == 0 })+ -> (IO { bs : ByteString | bslen bs <= n }) assume Data.ByteString.hGetSome :: _
src/Data/Foldable_LHAssumptions.hs view
@@ -9,4 +9,5 @@ {-@ assume length :: Foldable f => forall a. xs:f a -> {v:Nat | v = len xs} assume null :: Foldable f => forall a. v:(f a) -> {b:Bool | (b <=> len v = 0) && (not b <=> len v > 0)}+assume find :: Foldable f => pred:(a -> Bool) -> f a -> Maybe {x:a | pred x} @-}
src/GHC/Num_LHAssumptions.hs view
@@ -6,7 +6,7 @@ import GHC.Num.Integer_LHAssumptions() {-@-assume fromInteger :: x:Integer -> {v:a | v = x }+assume fromInteger :: (Num a) => x:Integer -> {v:a | v = x } assume negate :: (Num a) => x:a@@ -16,6 +16,6 @@ define abs x = if x >=0 then x else -x -assume + :: x:a -> y:a -> {v:a | v = x + y }+assume + :: (Num a) => x:a -> y:a -> {v:a | v = x + y } assume - :: (Num a) => x:a -> y:a -> {v:a | v = x - y } @-}
src/GHC/Real_LHAssumptions.hs view
@@ -8,9 +8,9 @@ import GHC.Num_LHAssumptions() {-@-assume (^) :: x:a -> y:{n:b | n >= 0} -> {z:a | (y == 0 => z == 1) && ((x == 0 && y /= 0) <=> z == 0)}+assume (^) :: (Num a, Integral b) => x:a -> y:{n:b | n >= 0} -> {z:a | (y == 0 => z == 1) && ((x == 0 && y /= 0) <=> z == 0)} -assume fromIntegral :: x:a -> {v:b|v=x}+assume fromIntegral :: (Integral a, Num b) => x:a -> {v:b|v=x} class Num a => Fractional a where (/) :: x:a -> y:{v:a | v /= 0} -> {v:a | v == x / y}@@ -18,44 +18,26 @@ fromRational :: Ratio Integer -> a class (Real a, Enum a) => Integral a where- quot :: x:a -> y:{v:a | v /= 0} -> {v:a | (v = (x / y)) &&- ((x >= 0 && y >= 0) => v >= 0) &&- ((x >= 0 && y >= 1) => v <= x) }- rem :: x:a -> y:{v:a | v /= 0} -> {v:a | ((v >= 0) && (v < y))}- mod :: x:a -> y:{v:a | v /= 0} -> {v:a | v = x mod y && ((0 <= x && 0 < y) => (0 <= v && v < y))}+ quot :: x:a -> y:{v:a | v /= 0} -> {v:a | v = quot x y}+ rem :: x:a -> y:{v:a | v /= 0} -> {v:a | v = rem x y} - div :: x:a -> y:{v:a | v /= 0} -> {v:a | (v = div x y) &&- ((x >= 0 && y >= 0) => v >= 0) &&- ((x >= 0 && y >= 1) => v <= x) &&- ((1 < y && x >= 0) => v < x) &&- ((1 < y && x < 0) => v > x) &&- ((y >= 1 && x >= 0) => v <= x) &&- ((x < 0 && y > 0) => v <= 0) &&- ((x > 0 && y < 0) => v <= 0) &&- ((x < 0 && y < 0) => v >= 0)- }- quotRem :: x:a -> y:{v:a | v /= 0} -> ( {v:a | (v = (x / y)) &&- ((x >= 0 && y >= 0) => v >= 0) &&- ((x >= 0 && y >= 1) => v <= x)}- , {v:a | ((v >= 0) && (v < y))})- divMod :: x:a -> y:{v:a | v /= 0} -> ( {v:a | (v = (x / y)) &&- ((x >= 0 && y >= 0) => v >= 0) &&- ((x >= 0 && y >= 1) => v <= x) }- , {v:a | v = x mod y && ((0 <= x && 0 < y) => (0 <= v && v < y))}- )- toInteger :: x:a -> {v:Integer | v = x}+ // we cannot use the mod function unqualified because the parser regards it as+ // the infix liquid-fixpoint operator, so we have to use GHC.Real.mod instead.+ mod :: x:a -> y:{v:a | v /= 0} -> {v:a | v = GHC.Real.mod x y} -// fixpoint can't handle (x mod y), only (x mod c) so we need to be more clever here-// mod :: x:a -> y:a -> {v:a | v = (x mod y) }+ div :: x:a -> y:{v:a | v /= 0} -> {v:a | v = div x y }+ quotRem :: x:a -> y:{v:a | v /= 0} -> ( {v:a | v = quot x y}+ , {v:a | v = rem x y}+ )+ divMod :: x:a -> y:{v:a | v /= 0} -> ( {v:a | v = div x y}+ , {v:a | v = GHC.Real.mod x y}+ )+ toInteger :: x:a -> {v:Integer | v = x} -define div x y = (x / y)-define mod x y = (x mod y)-define quot x y = if x >= 0- then (if y >= 0 then x / y else -(x / abs y))- else -(abs x / y)-define rem x y = if x >= 0- then (if y >= 0 then x mod y else x mod (abs y))- else - ((abs x) mod y)+define div x y = if y > 0 then x / y else -((- x) / y)+define mod x y = if y > 0 then x mod y else -((- x) mod y)+define quot x y = if x >= 0 then x / y else -((- x) / y)+define rem x y = if x >= 0 then x mod y else -((- x) mod y) define fromIntegral x = (x) @-}