How to make a function close <- function(x) {...}
such that it turns a matrix of binary-encoded lattice into a minimal join-closure that contains it? In a lattice of posets join = union.
For instance, input a binary matrix encoding a list of subsets {{a},{b},{a,b,c}}
x <- matrix(c(1,0,0,0,1,0,1,1,1),nrow=3,byrow=TRUE)
is turned into a matrix that encodes {{a},{b},{a,b},{a,b,c}}
where {a,b}={a} U {b}
is added so that the list is closed under union
x_clos <- matrix(c(1,0,0,0,1,0,1,1,0,1,1,1),nrow=4,byrow=TRUE)