I am writing a piece of Matlab 16 code (see below) to determine the monotone Boolean functions for a certain number of variables. The code works for variable numbers 0, 1, and 2 but fails to provide the correct number of monotone functions for variable numbers 3 and higher. I obtain 21 instead of 20.
I am following the description presented at http://www.mathpages.com/home/kmath094.htm
clear all;
clc
S{1} = '0';
S{2} = '1';
for k=1:3
cnt = 0;
for j=1:numel(S)
for k=j:numel(S)
cnt = cnt + 1;
J{cnt} = strcat(S{j},S{k});
end
end
clearvars S;
S = J;
end
Note that the vector S should provide each monotonic Boolean function. For $k=3$, I obtain 21 instead of the 20 I should be obtaining.
Although this may seem like a programming question at its root, I suspect that I am misunderstanding the description presented on the aforementioned webpage which is translating into an error in the code. Although I welcome any corrections to the code, I am more concerned with correcting my understanding of the approach.
Thank you!
The problem, as you must have noticed, comes with $00110101$, which is obtained by concatenating $0011$ and $0101$. This contravenes the rules, though, because $0011 \vee 0101 = 0111 \neq 0101$. Note that
is only a necessary condition for adjoining to be possible.
Fixing the code requires testing the "absorption." Here's what I did:
The monotone function count for
n=6took about 7 minutes to compute. It agrees with the one from the page you linked.