hermit-0.7.1.0: Haskell Equational Reasoning Model-to-Implementation Tunnel

Safe HaskellNone
LanguageHaskell2010

HERMIT.Dictionary.Reasoning

Contents

Synopsis

Equational Reasoning

eqLhsIntroR :: Quantified -> Rewrite c HermitM Core Source

e ==> let v = lhs in e

eqRhsIntroR :: Quantified -> Rewrite c HermitM Core Source

e ==> let v = rhs in e

extensionalityR :: Maybe String -> Rewrite c HermitM Quantified Source

f == g ==> forall x. f x == g x

modifyLemmaT Source

Arguments

:: (HasLemmas m, Monad m) 
=> LemmaName 
-> (LemmaName -> LemmaName)

modify lemma name

-> Rewrite c m Quantified

rewrite the quantified clause

-> (Proven -> Proven)

modify proven status

-> (Used -> Used)

modify used status

-> Transform c m a () 

Lifting transformations over Quantified

lhsT :: (AddBindings c, ReadPath c Crumb, ExtendPath c Crumb, Monad m) => Transform c m LCore a -> Transform c m Quantified a Source

Lift a transformation over LCoreTC into a transformation over the left-hand side of a Quantified.

rhsT :: (AddBindings c, ReadPath c Crumb, ExtendPath c Crumb, Monad m) => Transform c m LCore a -> Transform c m Quantified a Source

Lift a transformation over LCoreTC into a transformation over the right-hand side of a Quantified.

bothT :: (AddBindings c, ReadPath c Crumb, ExtendPath c Crumb, Monad m) => Transform c m LCore a -> Transform c m Quantified (a, a) Source

Lift a transformation over LCoreTC into a transformation over both sides of a Quantified.

lhsR :: (AddBindings c, Monad m, ReadPath c Crumb, ExtendPath c Crumb) => Rewrite c m LCore -> Rewrite c m Quantified Source

Lift a rewrite over LCoreTC into a rewrite over the left-hand side of a Quantified.

rhsR :: (AddBindings c, Monad m, ReadPath c Crumb, ExtendPath c Crumb) => Rewrite c m LCore -> Rewrite c m Quantified Source

Lift a rewrite over LCoreTC into a rewrite over the right-hand side of a Quantified.

bothR :: (AddBindings c, MonadCatch m, ReadPath c Crumb, ExtendPath c Crumb) => Rewrite c m LCore -> Rewrite c m Quantified Source

Lift a rewrite over LCoreTC into a rewrite over both sides of a Quantified.

verifyEqualityLeftToRightT :: MonadCatch m => CoreExpr -> CoreExpr -> Rewrite c m CoreExpr -> Transform c m a () Source

Given two expressions, and a rewrite from the former to the latter, verify that rewrite.

verifyEqualityCommonTargetT :: MonadCatch m => CoreExpr -> CoreExpr -> EqualityProof c m -> Transform c m a () Source

Given two expressions, and a rewrite to apply to each, verify that the resulting expressions are equal.

verifyIsomorphismT :: CoreExpr -> CoreExpr -> Rewrite c HermitM CoreExpr -> Rewrite c HermitM CoreExpr -> Transform c HermitM a () Source

Given f :: X -> Y and g :: Y -> X, verify that f (g y) ==> y and g (f x) ==> x.

verifyRetractionT :: CoreExpr -> CoreExpr -> Rewrite c HermitM CoreExpr -> Transform c HermitM a () Source

Given f :: X -> Y and g :: Y -> X, verify that f (g y) ==> y.

retractionBR :: forall c. Maybe (Rewrite c HermitM CoreExpr) -> CoreExpr -> CoreExpr -> BiRewrite c HermitM CoreExpr Source

Given f :: X -> Y and g :: Y -> X, and a proof that f (g y) ==> y, then f (g y) == y.

abstractQuantifiedR :: forall c m. (AddBindings c, BoundVars c, ExtendPath c Crumb, HasEmptyContext c, ReadBindings c, ReadPath c Crumb, HasDebugChan m, HasHermitMEnv m, HasLemmas m, LiftCoreM m, MonadCatch m, MonadUnique m) => String -> Transform c m Quantified CoreExpr -> Rewrite c m Quantified Source

Replace all occurrences of the given expression with a new quantified variable.