Skip to content

Commit

Permalink
Show instance for proof
Browse files Browse the repository at this point in the history
  • Loading branch information
LeventErkok committed Sep 21, 2024
1 parent dcbbe4f commit 2a3e6a5
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion Data/SBV/Tools/KDKernel.hs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,18 @@ data RootOfTrust = None -- ^ Trusts nothing (aside from SBV, underlying s
data Proof = Proof { rootOfTrust :: RootOfTrust -- ^ Root of trust, described above.
, isUserAxiom :: Bool -- ^ Was this an axiom given by the user?
, getProof :: SBool -- ^ Get the underlying boolean
, proofName :: String -- ^ User given name
}

-- | Show instance for 'Proof'
instance Show Proof where
show Proof{rootOfTrust, isUserAxiom, proofName} = '(' : tag ++ ") " ++ proofName
where tag | isUserAxiom = "Axiom"
| True = case rootOfTrust of
None -> "Proven"
Self -> "Sorry"
Prop s -> "Modulo: " ++ s

-- | Accept the given definition as a fact. Usually used to introduce definitial axioms,
-- giving meaning to uninterpreted symbols. Note that we perform no checks on these propositions,
-- if you assert nonsense, then you get nonsense back. So, calls to 'axiom' should be limited to
Expand All @@ -78,6 +88,7 @@ internalAxiom :: Proposition a => String -> a -> Proof
internalAxiom nm p = Proof { rootOfTrust = None
, isUserAxiom = False
, getProof = label nm (quantifiedBool p)
, proofName = nm
}

-- | A manifestly false theorem. This is useful when we want to prove a theorem that the underlying solver
Expand All @@ -86,7 +97,8 @@ internalAxiom nm p = Proof { rootOfTrust = None
sorry :: Proof
sorry = Proof { rootOfTrust = Self
, isUserAxiom = False
, getProof = label "SORRY" (quantifiedBool p)
, getProof = label "sorry" (quantifiedBool p)
, proofName = "sorry"
}
where -- ideally, I'd rather just use
-- p = sFalse
Expand All @@ -113,6 +125,7 @@ lemmaGen cfg what nms inputProp by = do
pure Proof { rootOfTrust = ros
, isUserAxiom = False
, getProof = label nm (quantifiedBool inputProp)
, proofName = nm
}

where parentRoots = map rootOfTrust by
Expand Down

0 comments on commit 2a3e6a5

Please sign in to comment.