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!