sbv-1.3: Symbolic bit vectors: Bit-precise verification and automatic C-code generation.

Portability portable experimental erkokl@gmail.com Safe-Infered

Data.SBV.Examples.Puzzles.Counts

Description

Consider the sentence:

```    In this sentence, the number of occurrences of 0 is _, of 1 is _, of 2 is _,
of 3 is _, of 4 is _, of 5 is _, of 6 is _, of 7 is _, of 8 is _, and of 9 is _.
```

The puzzle is to fill the blanks with numbers, such that the sentence will be correct. There are precisely two solutions to this puzzle, both of which are found by SBV successfully.

References:

Synopsis

# Documentation

type Count = SWord8Source

We will assume each number can be represented by an 8-bit word, i.e., can be at most 128.

Given a number, increment the count array depending on the digits of the number

Encoding of the puzzle. The solution is a sequence of 10 numbers for the occurrences of the digits such that if we count each digit, we find these numbers.

Finds all two known solutions to this puzzle. We have:

````>>> ````solve
```Solution #1
In this sentence, the number of occurrences of 0 is 1, of 1 is 11, of 2 is 2, of 3 is 1, of 4 is 1, of 5 is 1, of 6 is 1, of 7 is 1, of 8 is 1, of 9 is 1.
Solution #2
In this sentence, the number of occurrences of 0 is 1, of 1 is 7, of 2 is 3, of 3 is 2, of 4 is 1, of 5 is 1, of 6 is 1, of 7 is 2, of 8 is 1, of 9 is 1.
Found: 2 solution(s).
```