Skip to content

Commit d936bea

Browse files
More cleanup
1 parent 172ae54 commit d936bea

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

docs/Manual.md

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -192,21 +192,22 @@ sumPair = constrained $ \p ->
192192
]
193193
```
194194

195-
This example also re-illustrates that `(Term Int)` has a (partial) Num instance, and that we can constrain
196-
multiple (different) variables using simple `Num` methods (`(+)`, `(-)`, `(*)`, and `negate`). Note also
197-
the operator: `(==.) :: (Eq n, HasSpec n) => Term n -> Term n -> Term Bool`
195+
This example also re-illustrates that `(Term Int)` has a (partial) Num
196+
instance, and that we can constrain multiple (different) variables using simple
197+
`Num` methods (`(+)`, `(-)`, `(*)`, and `negate`). Note also the operator:
198+
`(==.) :: (Eq n, HasSpec n) => Term n -> Term n -> Term Bool`
198199

199200
## Function Symbols
200201

201-
Note that `(<=.)` , and `(==.)` are two of the function symbols in the first order logic. They obey a
202-
useful naming convention. Infix function symbols corresponding to Haskell infix operators have
203-
corresponding infix operators, lifting Haskell infix functions with type `(a -> b -> c)`, to library infix
204-
functions which have analogous types `(Term a -> Term b -> Term c)`
205-
and are named using the convention that we add the dot `(.)` to the end of the Haskell operator.
202+
Note that `(<=.)` and `(==.)` are two of the function symbols in the first
203+
order logic. They obey a useful naming convention. Infix operators
204+
corresponding to Haskell infix operators named using the convention that we add
205+
the dot `(.)` to the end of the Haskell operator.
206206

207-
A similar naming convention holds for function symbols which are not infix, except instead of adding a
208-
dot to the end of the Haskell name, we add an underscore (`_`) to the end of the Haskell functions's
209-
name. Some examples follow.
207+
A similar naming convention holds for normal prefix function symbols,
208+
except instead of adding a dot to the end of the Haskell name, we add an
209+
underscore (`_`) to the end of the Haskell functions's name. Some examples
210+
follow.
210211

211212
```haskell
212213
fst_ :: (HasSpec a,HasSpec b) => Term (a,b) -> Term a
@@ -223,7 +224,7 @@ member :: a -> Set a -> Bool
223224
-- etc
224225
```
225226

226-
While the underscored function symbols, may appear to be just to an Applicative
227+
While the underscored function symbols may appear to be just to an Applicative
227228
lifting over `Term`, that is not the case. An Applicative lifting would allow
228229
the base function to be applied under the `Term` type, but the underscored
229230
function symbols also know how to reason logically about the function and are
@@ -236,9 +237,9 @@ A type with a `HasSpec` instance might have a number of Function Symbols that op
236237
There are a number of types that have predefined `HasSpec` instances. As a reference, we list them
237238
here along with the types of their function symbols.
238239

239-
### Function symbols for numeric types
240+
### Numeric Types
240241

241-
`(Int, Integer, Natural, Int8, Int16, Int32, Int64, Word8, Word16, Word32, Word64)`
242+
`(Int, Integer, Natural, Int/Word{8, 16, 32, 64})`
242243

243244
The function symbols of numeric types are:
244245

@@ -249,24 +250,23 @@ The function symbols of numeric types are:
249250
5. `(==.) :: (Eq a, HasSpec a) => Term a -> Term a -> Term Bool`
250251
6. A partial Num instance for (Term n) where n is a Numeric type. Operators `(+)`, `(-)`, `(*)`
251252

252-
### Function symbols for Bool
253+
### Booleans
253254

254255
The function symbols of `Bool` are:
255256

256257
1. `(||.) :: Term Bool -> Term Bool -> Term Bool` infix `or`
257258
2. `not_ :: Term Bool -> Term Bool`
258259

259-
### Function symbols for List
260+
### Lists
260261

261-
`HasSpec a => HasSpec [a]`
262+
We have the instance `HasSpec a => HasSpec [a]`.
262263

263264
The function symbols of `[a]` are:
264-
265265
1. `foldMap_ :: (Sized [a], Foldy b, HasSpec a) => (Term a -> Term b) -> Term [a] -> Term b`
266266
2. `singletonList_ :: (Sized [a], HasSpec a) => Term a -> Term [a]`
267267
3. `append_ :: (Sized [a], HasSpec a) => Term [a] -> Term [a] -> Term [a]`
268268

269-
### Function symbols for Set
269+
### Sets
270270

271271
`HasSpec a => HasSpec (Set a)`
272272

@@ -279,7 +279,7 @@ The function symbols of `(Set a)` are:
279279
5. `disjoint_ :: (Ord a, HasSpec a) => Term (Set a) -> Term (Set a) -> Term Bool`
280280
6. `fromList_ :: (Ord a, HasSpec a) => Term [a] -> Term (Set a)`
281281

282-
### Function symbols for Map
282+
### Maps
283283

284284
`(HasSpec k, HasSpec v) => HasSpec (Map k v)`
285285

@@ -296,7 +296,6 @@ Once we have written a `Specification` what can we do with it? Specifications ha
296296
1. We can interpret it as a generator of values the meet all the constraints inside the specification.
297297
2. We can interpret it as a function that checks if a given value meets all the constraints inside the specification.
298298

299-
300299
The first interpretation of the specification is the function `genFromSpec`
301300

302301
```haskell
@@ -377,7 +376,6 @@ The purpose of constrained generators is to make it possible to write conditiona
377376
that have a high probability of not being vacuously true, and to combine this with other random
378377
techniques to make better samples of the test-space.
379378

380-
381379
The second interpretation of the specification is as a constraint checker, implemented as the function.
382380

383381
```haskell

0 commit comments

Comments
 (0)