packages feed

copilot-theorem-3.2.1: src/Copilot/Theorem/TransSys/Invariants.hs

{-# OPTIONS_GHC -O0 #-}
{-# LANGUAGE Safe #-}

-- | Augment types with invariants.

module Copilot.Theorem.TransSys.Invariants
  ( HasInvariants (..)
  , prop
  ) where

-- | Type class for types with additional invariants or contraints.
class HasInvariants a where

  invariants :: a -> [(String, Bool)]

  checkInvs :: a -> Bool
  checkInvs obj = all snd $ invariants obj

-- | Creates an invariant with a description.
prop :: String -> Bool -> (String, Bool)
prop = (,)