The wiki article for self-enumerating pangrams states that they are computed using Binary Decision Diagrams. I've been reading about BDDs and from my understanding you need to represent some problem as a boolean function before you can construct a BDD for it.
How would I go about doing this?
I've been thinking about the problem for a few days now, and I'm pretty sure you could representing the input to the boolean function using a straightforward encoding:
10000 01010 01011 10101 ...
16A's 10B's 11C's 21D's ...
So for a pangram starting "sixteen A's, ten B's, eleven C's, twenty-one D's", you could represent it as 10000010100101110101...
This would mean that there are 26 * 5 = 130 variables in the boolean function, assuming you restrict the maximum frequency of a character to 32 occurrences.
The output should be whether the representation is a self-enumerating pangram or not, i.e. if the sentence describes its own set of frequencies.
To do this, a hash table (or several) must surely be required along the way.
So for the letter E, the hash table might begin:
one -> 1
two -> 0
three -> 2
four -> 0
five -> 1
...
Which in binary, might look like:
1 -> 1
10 -> 0
11 -> 10
100 -> 0
101 -> 1
If the summation of all lookups from the E hash table is equal to five input bits corresponding to E, then that section of the self-enumerating pangram is correct. If all sections are correct then the boolean function should yield 1, otherwise 0.
I'm fairly sure I could figure out how to carry out addition using a boolean function and how to check if two numbers are equal. I have no idea where to start with representing the hash table as a boolean function, however. Also, connecting all of the pieces together is likely to bewilder me.
Any thoughts? Ideas? Collaboration? I'd like to see where this goes.
Thanks in advance.