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.
The way I see it, the use of BDDs, as used in this context, are simply a way of representing and assisting in manipulating an expression used to evaluate, for example, if your sentence satisfies the requirements for being a self-enumerating pangram. There are rules for manipulating them in ways that are conceptually easier than those for manipulating statement in Boolean algebra, because they are easier to represent in that notation than in Boole's notation, the same way that a polynomial in 8000 variables is more difficult to deal with in its general form than in some other notation that represents where it came from and such. Computer algorithms exist for manipulating any of those four, so your best option is probably to look up and adapt one to your needs. You may find this document to be helpful.
Google may also be useful in finding additional resources.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With