Skip to content

Commit 8e46a13

Browse files
committed
copilot-prettyprinter: Preserve proposition quantifiers. Refs #254.
Currently, `copilot-language` remembers whether a proposition (i.e., a stream of booleans) is quantified universally (i.e., using `forAll`) or existentially (i.e., using `exists`). When translating from `copilot-language` to `copilot-core`, however, the quantifier is discarded. This means that a `copilot-core` `Property` does not record any quantifier information at all, making it impossible for downstream libraries that use `copilot-core` to handle universal quantification differently from existential quantification. Now that `copilot-core` preserves quantifier information in its API, this commit updates `copilot-prettyprinter` to pretty-print quantifier information appropriately.
1 parent 0c3e702 commit 8e46a13

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

copilot-prettyprinter/src/Copilot/PrettyPrint.hs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,10 +175,15 @@ ppProperty :: Property -> Doc
175175
ppProperty
176176
Property
177177
{ propertyName = name
178-
, propertyExpr = e }
178+
, propertyProp = p }
179179
= text "property \"" <> text name <> text "\""
180180
<+> text "="
181-
<+> ppExpr e
181+
<+> ppProp p
182+
183+
-- | Pretty-print a Copilot proposition.
184+
ppProp :: Prop -> Doc
185+
ppProp (Forall e) = text "forall" <+> parens (ppExpr e)
186+
ppProp (Exists e) = text "exists" <+> parens (ppExpr e)
182187

183188
-- | Pretty-print a Copilot specification, in the following order:
184189
--

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy