I can't help you in your quest, but I can say that this reminds me way too much of an article in an old magazine, probably Byte, by Peter Grogono. Peter wrote the influentual book, "Programming in Pascal", and his article was all about implementing multi-state logic in Pascal using sets.