packages feed

sbv-14.0: SBVTestSuite/TestSuite/CompileTests/PCase/PCase48.hs

{-# LANGUAGE QuasiQuotes       #-}
{-# LANGUAGE DataKinds         #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeAbstractions  #-}
{-# LANGUAGE TypeApplications  #-}

{-# OPTIONS_GHC -Wall -Werror -ddump-splices #-}

module T where

import Expr
import Data.SBV
import Data.SBV.TP

-- Positive: multi-arm guarded Var and Num, no wildcard catch-all
-- (sCase would reject as non-exhaustive; pCase is fine)
t :: TP (Proof (Forall "e" Expr -> SBool))
t = calc "t" (\(Forall @"e" (e :: SExpr)) -> e .== e) $ \e -> []
    |- [pCase| e of
         Var s | s .== literal "a"                       -> e .== e =: qed
               | s .== literal "b" .|| s .== literal "c" -> e .== e =: qed
               | sTrue                                    -> e .== e =: qed

         Num _ | sTrue                                    -> e .== e =: qed
       |]