Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Copilot.Language
Description
Main Copilot language export file.
This is mainly a meta-module that re-exports most definitions in this library.
Synopsis
- data Int8
- data Int16
- data Int32
- data Int64
- module Data.Word
- type Name = String
- class (Show a, Typeable a) => Typed a
- module Copilot.Core.Type
- module Copilot.Core.Type.Array
- impossible :: String -> String -> a
- badUsage :: String -> a
- csv :: Integer -> Spec -> IO ()
- interpret :: Integer -> Spec -> IO ()
- module Copilot.Language.Operators.Boolean
- module Copilot.Language.Operators.Cast
- module Copilot.Language.Operators.Constant
- module Copilot.Language.Operators.Eq
- module Copilot.Language.Operators.Extern
- module Copilot.Language.Operators.Local
- module Copilot.Language.Operators.Label
- module Copilot.Language.Operators.Integral
- module Copilot.Language.Operators.Mux
- module Copilot.Language.Operators.Ord
- module Copilot.Language.Operators.Temporal
- module Copilot.Language.Operators.BitWise
- module Copilot.Language.Operators.Array
- module Copilot.Language.Operators.Struct
- module Copilot.Language.Prelude
- type Spec = Writer [SpecItem] ()
- data Stream :: * -> *
- observer :: Typed a => String -> Stream a -> Spec
- trigger :: String -> Stream Bool -> [Arg] -> Spec
- arg :: Typed a => Stream a -> Arg
- prop :: String -> Prop a -> Writer [SpecItem] (PropRef a)
- theorem :: String -> Prop a -> Proof a -> Writer [SpecItem] (PropRef a)
- forAll :: Stream Bool -> Prop Universal
- exists :: Stream Bool -> Prop Existential
Documentation
8-bit signed integer type
Instances
Bits Int8 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int8 -> Int8 -> Int8 # (.|.) :: Int8 -> Int8 -> Int8 # complement :: Int8 -> Int8 # shift :: Int8 -> Int -> Int8 # rotate :: Int8 -> Int -> Int8 # setBit :: Int8 -> Int -> Int8 # clearBit :: Int8 -> Int -> Int8 # complementBit :: Int8 -> Int -> Int8 # testBit :: Int8 -> Int -> Bool # bitSizeMaybe :: Int8 -> Maybe Int # shiftL :: Int8 -> Int -> Int8 # unsafeShiftL :: Int8 -> Int -> Int8 # shiftR :: Int8 -> Int -> Int8 # unsafeShiftR :: Int8 -> Int -> Int8 # rotateL :: Int8 -> Int -> Int8 # | |
FiniteBits Int8 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int8 -> Int # countLeadingZeros :: Int8 -> Int # countTrailingZeros :: Int8 -> Int # | |
Bounded Int8 | Since: base-2.1 |
Enum Int8 | Since: base-2.1 |
Ix Int8 | Since: base-2.1 |
Num Int8 | Since: base-2.1 |
Read Int8 | Since: base-2.1 |
Integral Int8 | Since: base-2.1 |
Real Int8 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int8 -> Rational # | |
Show Int8 | Since: base-2.1 |
Typed Int8 | |
Defined in Copilot.Core.Type | |
NFData Int8 | |
Defined in Control.DeepSeq | |
Eq Int8 | Since: base-2.1 |
Ord Int8 | Since: base-2.1 |
Cast Int8 Int16 Source # | Cast number to bigger type. |
Cast Int8 Int32 Source # | Cast number to bigger type. |
Cast Int8 Int64 Source # | Cast number to bigger type. |
Cast Int8 Int8 Source # | Identity casting. |
Cast Bool Int8 Source # | Cast a boolean stream to a stream of numbers, producing 1 if the
value at a point in time is |
UnsafeCast Int16 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int8 Word8 Source # | Signed to unsigned casting. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int8 Double Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int8 Float Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Word8 Int8 Source # | Cast from unsigned numbers to signed numbers. |
Defined in Copilot.Language.Operators.Cast | |
Lift Int8 | |
16-bit signed integer type
Instances
Bits Int16 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int16 -> Int16 -> Int16 # (.|.) :: Int16 -> Int16 -> Int16 # xor :: Int16 -> Int16 -> Int16 # complement :: Int16 -> Int16 # shift :: Int16 -> Int -> Int16 # rotate :: Int16 -> Int -> Int16 # setBit :: Int16 -> Int -> Int16 # clearBit :: Int16 -> Int -> Int16 # complementBit :: Int16 -> Int -> Int16 # testBit :: Int16 -> Int -> Bool # bitSizeMaybe :: Int16 -> Maybe Int # shiftL :: Int16 -> Int -> Int16 # unsafeShiftL :: Int16 -> Int -> Int16 # shiftR :: Int16 -> Int -> Int16 # unsafeShiftR :: Int16 -> Int -> Int16 # rotateL :: Int16 -> Int -> Int16 # | |
FiniteBits Int16 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int16 -> Int # countLeadingZeros :: Int16 -> Int # countTrailingZeros :: Int16 -> Int # | |
Bounded Int16 | Since: base-2.1 |
Enum Int16 | Since: base-2.1 |
Ix Int16 | Since: base-2.1 |
Num Int16 | Since: base-2.1 |
Read Int16 | Since: base-2.1 |
Integral Int16 | Since: base-2.1 |
Real Int16 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int16 -> Rational # | |
Show Int16 | Since: base-2.1 |
Typed Int16 | |
Defined in Copilot.Core.Type | |
NFData Int16 | |
Defined in Control.DeepSeq | |
Eq Int16 | Since: base-2.1 |
Ord Int16 | Since: base-2.1 |
Cast Int16 Int16 Source # | Identity casting. |
Cast Int16 Int32 Source # | Cast number to bigger type. |
Cast Int16 Int64 Source # | Cast number to bigger type. |
Cast Int8 Int16 Source # | Cast number to bigger type. |
Cast Word8 Int16 Source # | Cast number to bigger type. |
Cast Bool Int16 Source # | Cast a boolean stream to a stream of numbers, producing 1 if the
value at a point in time is |
UnsafeCast Int16 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int16 Word16 Source # | Signed to unsigned casting. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int16 Double Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int16 Float Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Int16 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Int16 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Word16 Int16 Source # | Cast from unsigned numbers to signed numbers. |
Defined in Copilot.Language.Operators.Cast | |
Lift Int16 | |
32-bit signed integer type
Instances
Bits Int32 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int32 -> Int32 -> Int32 # (.|.) :: Int32 -> Int32 -> Int32 # xor :: Int32 -> Int32 -> Int32 # complement :: Int32 -> Int32 # shift :: Int32 -> Int -> Int32 # rotate :: Int32 -> Int -> Int32 # setBit :: Int32 -> Int -> Int32 # clearBit :: Int32 -> Int -> Int32 # complementBit :: Int32 -> Int -> Int32 # testBit :: Int32 -> Int -> Bool # bitSizeMaybe :: Int32 -> Maybe Int # shiftL :: Int32 -> Int -> Int32 # unsafeShiftL :: Int32 -> Int -> Int32 # shiftR :: Int32 -> Int -> Int32 # unsafeShiftR :: Int32 -> Int -> Int32 # rotateL :: Int32 -> Int -> Int32 # | |
FiniteBits Int32 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int32 -> Int # countLeadingZeros :: Int32 -> Int # countTrailingZeros :: Int32 -> Int # | |
Bounded Int32 | Since: base-2.1 |
Enum Int32 | Since: base-2.1 |
Ix Int32 | Since: base-2.1 |
Num Int32 | Since: base-2.1 |
Read Int32 | Since: base-2.1 |
Integral Int32 | Since: base-2.1 |
Real Int32 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int32 -> Rational # | |
Show Int32 | Since: base-2.1 |
Typed Int32 | |
Defined in Copilot.Core.Type | |
NFData Int32 | |
Defined in Control.DeepSeq | |
Eq Int32 | Since: base-2.1 |
Ord Int32 | Since: base-2.1 |
Cast Int16 Int32 Source # | Cast number to bigger type. |
Cast Int32 Int32 Source # | Identity casting. |
Cast Int32 Int64 Source # | Cast number to bigger type. |
Cast Int8 Int32 Source # | Cast number to bigger type. |
Cast Word16 Int32 Source # | Cast number to bigger type. |
Cast Word8 Int32 Source # | Cast number to bigger type. |
Cast Bool Int32 Source # | Cast a boolean stream to a stream of numbers, producing 1 if the
value at a point in time is |
UnsafeCast Int32 Int16 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Word32 Source # | Signed to unsigned casting. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Double Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int32 Float Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Int32 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Word32 Int32 Source # | Cast from unsigned numbers to signed numbers. |
Defined in Copilot.Language.Operators.Cast | |
Lift Int32 | |
64-bit signed integer type
Instances
Bits Int64 | Since: base-2.1 |
Defined in GHC.Int Methods (.&.) :: Int64 -> Int64 -> Int64 # (.|.) :: Int64 -> Int64 -> Int64 # xor :: Int64 -> Int64 -> Int64 # complement :: Int64 -> Int64 # shift :: Int64 -> Int -> Int64 # rotate :: Int64 -> Int -> Int64 # setBit :: Int64 -> Int -> Int64 # clearBit :: Int64 -> Int -> Int64 # complementBit :: Int64 -> Int -> Int64 # testBit :: Int64 -> Int -> Bool # bitSizeMaybe :: Int64 -> Maybe Int # shiftL :: Int64 -> Int -> Int64 # unsafeShiftL :: Int64 -> Int -> Int64 # shiftR :: Int64 -> Int -> Int64 # unsafeShiftR :: Int64 -> Int -> Int64 # rotateL :: Int64 -> Int -> Int64 # | |
FiniteBits Int64 | Since: base-4.6.0.0 |
Defined in GHC.Int Methods finiteBitSize :: Int64 -> Int # countLeadingZeros :: Int64 -> Int # countTrailingZeros :: Int64 -> Int # | |
Bounded Int64 | Since: base-2.1 |
Enum Int64 | Since: base-2.1 |
Ix Int64 | Since: base-2.1 |
Num Int64 | Since: base-2.1 |
Read Int64 | Since: base-2.1 |
Integral Int64 | Since: base-2.1 |
Real Int64 | Since: base-2.1 |
Defined in GHC.Int Methods toRational :: Int64 -> Rational # | |
Show Int64 | Since: base-2.1 |
Typed Int64 | |
Defined in Copilot.Core.Type | |
NFData Int64 | |
Defined in Control.DeepSeq | |
Eq Int64 | Since: base-2.1 |
Ord Int64 | Since: base-2.1 |
Cast Int16 Int64 Source # | Cast number to bigger type. |
Cast Int32 Int64 Source # | Cast number to bigger type. |
Cast Int64 Int64 Source # | Identity casting. |
Cast Int8 Int64 Source # | Cast number to bigger type. |
Cast Word16 Int64 Source # | Cast number to bigger type. |
Cast Word32 Int64 Source # | Cast number to bigger type. |
Cast Word8 Int64 Source # | Cast number to bigger type. |
Cast Bool Int64 Source # | Cast a boolean stream to a stream of numbers, producing 1 if the
value at a point in time is |
UnsafeCast Int64 Int16 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Int32 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Int8 Source # | Unsafe downcasting to smaller sizes. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Word64 Source # | Signed to unsigned casting. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Double Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Int64 Float Source # | Unsafe signed integer promotion to floating point values. |
Defined in Copilot.Language.Operators.Cast | |
UnsafeCast Word64 Int64 Source # | Cast from unsigned numbers to signed numbers. |
Defined in Copilot.Language.Operators.Cast | |
Lift Int64 | |
module Data.Word
class (Show a, Typeable a) => Typed a #
A typed expression, from which we can obtain the two type representations
used by Copilot: Type
and SimpleType
.
Minimal complete definition
Instances
Typed Int16 | |
Defined in Copilot.Core.Type | |
Typed Int32 | |
Defined in Copilot.Core.Type | |
Typed Int64 | |
Defined in Copilot.Core.Type | |
Typed Int8 | |
Defined in Copilot.Core.Type | |
Typed Word16 | |
Defined in Copilot.Core.Type | |
Typed Word32 | |
Defined in Copilot.Core.Type | |
Typed Word64 | |
Defined in Copilot.Core.Type | |
Typed Word8 | |
Defined in Copilot.Core.Type | |
Typed Bool | |
Defined in Copilot.Core.Type | |
Typed Double | |
Defined in Copilot.Core.Type | |
Typed Float | |
Defined in Copilot.Core.Type | |
(Typeable t, Typed t, KnownNat n) => Typed (Array n t) | |
Defined in Copilot.Core.Type |
module Copilot.Core.Type
module Copilot.Core.Type.Array
Arguments
:: String | Name of the function in which the error was detected. |
-> String | Name of the package in which the function is located. |
-> a |
Report an error due to a bug in Copilot.
Arguments
:: String | Description of the error. |
-> a |
Report an error due to an error detected by Copilot (e.g., user error).
csv :: Integer -> Spec -> IO () Source #
Simulate a number of steps of a given specification, printing the results in a table in comma-separated value (CSV) format.
interpret :: Integer -> Spec -> IO () Source #
Simulate a number of steps of a given specification, printing the results in a table in readable format.
Compared to csv
, this function is slower but the output may be more
readable.
module Copilot.Language.Prelude
type Spec = Writer [SpecItem] () Source #
A specification is a list of declarations of triggers, observers, properties and theorems.
Specifications are normally declared in monadic style, for example:
monitor1 :: Stream Bool monitor1 = [False] ++ not monitor1 counter :: Stream Int32 counter = [0] ++ not counter spec :: Spec spec = do trigger "handler_1" monitor1 [] trigger "handler_2" (counter > 10) [arg counter]
data Stream :: * -> * Source #
A stream in Copilot is an infinite succession of values of the same type.
Streams can be built using simple primities (e.g., Const
), by applying
step-wise (e.g., Op1
) or temporal transformations (e.g., Append
, Drop
)
to streams, or by combining existing streams to form new streams (e.g.,
Op2
, Op3
).
Instances
(Typed a, Bits a) => Bits (Stream a) Source # | Instance of the Only the methods |
Defined in Copilot.Language.Operators.BitWise Methods (.&.) :: Stream a -> Stream a -> Stream a # (.|.) :: Stream a -> Stream a -> Stream a # xor :: Stream a -> Stream a -> Stream a # complement :: Stream a -> Stream a # shift :: Stream a -> Int -> Stream a # rotate :: Stream a -> Int -> Stream a # setBit :: Stream a -> Int -> Stream a # clearBit :: Stream a -> Int -> Stream a # complementBit :: Stream a -> Int -> Stream a # testBit :: Stream a -> Int -> Bool # bitSizeMaybe :: Stream a -> Maybe Int # isSigned :: Stream a -> Bool # shiftL :: Stream a -> Int -> Stream a # unsafeShiftL :: Stream a -> Int -> Stream a # shiftR :: Stream a -> Int -> Stream a # unsafeShiftR :: Stream a -> Int -> Stream a # rotateL :: Stream a -> Int -> Stream a # | |
(Typed a, Eq a, Floating a) => Floating (Stream a) Source # | Streams carrying floating point numbers are instances of |
Defined in Copilot.Language.Stream Methods sqrt :: Stream a -> Stream a # (**) :: Stream a -> Stream a -> Stream a # logBase :: Stream a -> Stream a -> Stream a # asin :: Stream a -> Stream a # acos :: Stream a -> Stream a # atan :: Stream a -> Stream a # sinh :: Stream a -> Stream a # cosh :: Stream a -> Stream a # tanh :: Stream a -> Stream a # asinh :: Stream a -> Stream a # acosh :: Stream a -> Stream a # atanh :: Stream a -> Stream a # log1p :: Stream a -> Stream a # expm1 :: Stream a -> Stream a # | |
(Typed a, Eq a, Num a) => Num (Stream a) Source # | Streams carrying numbers are instances of |
(Typed a, Eq a, Fractional a) => Fractional (Stream a) Source # | Streams carrying fractional numbers are instances of |
Show (Stream a) Source # | |
Eq (Stream a) Source # | |
(KnownNat n, Typed t) => Projectable (Array n t) (Stream Word32) t Source # | Update a stream of arrays. |
Defined in Copilot.Language.Operators.Array | |
data Projection (Array n t) (Stream Word32) t Source # | |
Defined in Copilot.Language.Operators.Array |
Arguments
:: Typed a | |
=> String | Name used to identify the stream monitored in the output produced during interpretation. |
-> Stream a | The stream being monitored. |
-> Spec |
Define a new observer as part of a specification. This allows someone to print the value at every iteration during interpretation. Observers do not have any functionality outside the interpreter.
Arguments
:: String | Name of the handler to be called. |
-> Stream Bool | The stream used as the guard for the trigger. |
-> [Arg] | List of arguments to the handler. |
-> Spec |
Define a new trigger as part of a specification. A trigger declares which external function, or handler, will be called when a guard defined by a boolean stream becomes true.
arg :: Typed a => Stream a -> Arg Source #
Construct a function argument from a stream.
Arg
s can be used to pass arguments to handlers or trigger functions, to
provide additional information to monitor handlers in order to address
property violations. At any given point (e.g., when the trigger must be
called due to a violation), the arguments passed using arg
will contain
the current samples of the given streams.
prop :: String -> Prop a -> Writer [SpecItem] (PropRef a) Source #
A proposition, representing a boolean stream that is existentially or universally quantified over time, as part of a specification.
This function returns, in the monadic context, a reference to the proposition.
theorem :: String -> Prop a -> Proof a -> Writer [SpecItem] (PropRef a) Source #
A theorem, or proposition together with a proof.
This function returns, in the monadic context, a reference to the proposition.