# Venn of $n$ statements

Given a positive integer $$\n\$$, output $$\n\$$ 2D bool images with the same width and height such that:

1. Each image should be 4-connected, i.e. for each two pixels that are true, you can start from one and go up, down, left and right for some times to the other pixel, only passing through true pixels.
2. Each image should have no holes, i.e. the complement should be 4-connected.
3. If we choose itself or its complement for each image, their intersection should be non-empty and 4-connected.

## Examples (only a finite amount of solutions shown, but there are infinitely many more)

Input: 1

Possible output:

.....
.***.
.**..
..*..


Input: 1

Possible output:

.....
...*.
.....
.....


Input: 2

Possible output:

..... .....
.***. ..**.
..... ..**.
..... .....


Input: 2

Possible output:

..... .....
.**.. ..**.
..**. ..**.
..... .....


Input: 3

Possible output:

..... ..... .....
.**.. ..**. .....
.**.. ..**. .***.
..... ..... .***.


Input: 4

Possible output:

....... ....... ....... .......
.***... ..***.. ....... .......
.***... ..***.. .*****. .......
.***... ..***.. .*****. .*****.
.***... ..***.. ....... .*****.
....... ....... ....... .......


The shortest code in each language wins.

Reference

Sandbox

• can output be binary matrices? Jun 20 '21 at 5:40
• @Wasif That's quite reasonable
– l4m2
Jun 20 '21 at 5:42
• @AndersKaseorg Fixed. Not sure what happened to my thought that time making a wrong n=4 example.
– l4m2
Jun 20 '21 at 10:56
• @Spitemaster Condition 3 already implies that the images must be distinct (if $A = B$, then $A ∩ \bar B ∩ C ∩ D = \varnothing$), and also that you must choose the width and height to be large enough for the given $n$. Jun 20 '21 at 20:43
• @DominicvanEssen If you take the entire set of all images, then all $2^N$ arrangements of taking the image or its complement for each should be valid. As an example, if you have A, B, C, then the intersections of ABC, AB(!C), A(!B)C, A(!B)(!C), (!A)BC, (!A)B(!C), (!A)(!B)C, and (!A)(!B)(!C) all need to be valid. Jun 20 '21 at 22:55

# Python, 62 bytes

lambda n:[[[0,j>>i&1,1]for j in range(1<<n)]for i in range(n)]


Try it online!

Generates $$\3 × 2^n\$$ images like these:

..*  ..*  ..*  ..*
.**  ..*  ..*  ..*
..*  .**  ..*  ..*
.**  .**  ..*  ..*
..*  ..*  .**  ..*
.**  ..*  .**  ..*
..*  .**  .**  ..*
.**  .**  .**  ..*
..*  ..*  ..*  .**
.**  ..*  ..*  .**
..*  .**  ..*  .**
.**  .**  ..*  .**
..*  ..*  .**  .**
.**  ..*  .**  .**
..*  .**  .**  .**
.**  .**  .**  .**

• @xnor I guess it wasn’t clear whether “complement” includes the outside of the image rectangle. I added the empty column to be safe. Jun 20 '21 at 21:00
• the question saysbool images with same width and height, are 3x2^n images allowed? Jun 21 '21 at 6:02
• @Razetime The question means that the widths of the $n$ images are the same and the heights of the $n$ images are the same, not that the width equals the height. See the question’s examples. Jun 21 '21 at 7:39

# Jelly, 1210987 6 bytes

4,6Bṗz


Try it online!

Returns a list of binary matrices (that is, a 3D list).

Output for $$\n=6\$$, transposed and ASCII-artified:

################################################################
................................################################
................................................................

################################################################
................################................################
................................................................

################################################################
........########........########........########........########
................................................................

################################################################
....####....####....####....####....####....####....####....####
................................................................

################################################################
..##..##..##..##..##..##..##..##..##..##..##..##..##..##..##..##
................................................................

################################################################
.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#.#
................................................................


## Explanation

4,6Bṗz Main monadic link, taking n as the argument
4,6    [4,6]
B   Convert to binary: [[1,0,0],[1,1,0]]
ṗ  Cartesian power to n
z Zip with filler n (since it's already a rectangle, the filler will be ignored)


# R, 64 bytes

function(n)Map(function(i)rbind(1,(1:(2^n)-1)%/%2^i%%2,0),1:n-1)


Try it online!

Port of Anders Kaseorg's approach - upvote that one!

# 05AB1E, 8 bytes

46SbIãIζ


Try it online!

• You can remove the second I (or just use ø instead of Iζ). Aug 12 '21 at 12:12