Skip to content

Commit aad3290

Browse files
authored
Merge pull request #179 from GaloisInc/forall-keyword
Rename the `forall` and `exists` operators to `forall_` and `exists_`
2 parents 37d6d81 + af771a8 commit aad3290

File tree

3 files changed

+19
-12
lines changed

3 files changed

+19
-12
lines changed

what4/CHANGES.md

+7
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# next (TBA)
22

3+
* According to
4+
[this discussion](https://github.com/ghc-proposals/ghc-proposals/discussions/440),
5+
the `forall` identifier will be claimed, and `forall` made into a
6+
full keyword. Therefore, the `forall` and `exists` combinators of
7+
`What4.Protocol.SMTLib2.Syntax` have been
8+
renamed into `forall_` and `exists_`.
9+
310
* Add operations for increased control over the scope of
411
configuration options, both in the `What4.Config` and
512
`What4.Expr.Builder` modules.

what4/src/What4/Protocol/SMTLib2.hs

+2-2
Original file line numberDiff line numberDiff line change
@@ -638,8 +638,8 @@ newWriter _ h in_h ack isStrict solver_name permitDefineFun arithOption quantSup
638638
type instance Command (Writer a) = SMT2.Command
639639

640640
instance SMTLib2Tweaks a => SMTWriter (Writer a) where
641-
forallExpr vars t = SMT2.forall (varBinding @a <$> vars) t
642-
existsExpr vars t = SMT2.exists (varBinding @a <$> vars) t
641+
forallExpr vars t = SMT2.forall_ (varBinding @a <$> vars) t
642+
existsExpr vars t = SMT2.exists_ (varBinding @a <$> vars) t
643643

644644
arrayConstant =
645645
case smtlib2arrayConstant @a of

what4/src/What4/Protocol/SMTLib2/Syntax.hs

+10-10
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ module What4.Protocol.SMTLib2.Syntax
7979
, eq
8080
, distinct
8181
, ite
82-
, forall
83-
, exists
82+
, forall_
83+
, exists_
8484
, letBinder
8585
-- * @Ints@, @Reals@, @Reals_Ints@ theories
8686
, negate
@@ -319,18 +319,18 @@ ite c x y = term_app "ite" [c, x, y]
319319
varBinding :: (Text,Sort) -> Builder
320320
varBinding (nm, tp) = "(" <> Builder.fromText nm <> " " <> unSort tp <> ")"
321321

322-
-- | @forall vars t@ denotes a predicate that holds if @t@ for every valuation of the
322+
-- | @forall_ vars t@ denotes a predicate that holds if @t@ for every valuation of the
323323
-- variables in @vars@.
324-
forall :: [(Text, Sort)] -> Term -> Term
325-
forall [] r = r
326-
forall vars r =
324+
forall_ :: [(Text, Sort)] -> Term -> Term
325+
forall_ [] r = r
326+
forall_ vars r =
327327
T $ app "forall" [builder_list (varBinding <$> vars), renderTerm r]
328328

329-
-- | @exists vars t@ denotes a predicate that holds if @t@ for some valuation of the
329+
-- | @exists_ vars t@ denotes a predicate that holds if @t@ for some valuation of the
330330
-- variables in @vars@.
331-
exists :: [(Text, Sort)] -> Term -> Term
332-
exists [] r = r
333-
exists vars r =
331+
exists_ :: [(Text, Sort)] -> Term -> Term
332+
exists_ [] r = r
333+
exists_ vars r =
334334
T $ app "exists" [builder_list (varBinding <$> vars), renderTerm r]
335335

336336
letBinding :: (Text, Term) -> Builder

0 commit comments

Comments
 (0)