Skip to main content
added 76 characters in body
Source Link
whuber
  • 20.6k
  • 2
  • 61
  • 113

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}


The second part of the question could be interpreted as asking how the expression

$$f(x,y,(a,b,c,d)) \text{ and } f(y, x \text{ xor } y, (a,b,c,d))$$

(which evidently is a binary Boolean operator in the arguments $x$ and $y$) ought to be parameterized. Let's work it out in steps using the definitions:

and[x_, y_] := f[x, y, {0, 0, 0, 1}];
xor[x_, y_] := f[x, y, {0, 1, 1, 0}];
p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a, b, c, d}] , {x, 0, 1}, {y, 0, 1}] // Flatten

{a^2, b d, b c, c d}

More generally, if the two occurrences of $f$ are intended to have two different sets of parameters, the same method works:

p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a1, b1, c1, d1}],
        {x, 0, 1}, {y, 0, 1}] // Flatten

{a a1, b d1, b1 c, c1 d}

In other words, a simplified version of the compound input expression is

f[x, y, {a a1, b d1, b1 c, c1 d}]

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}


The second part of the question could be interpreted as asking how the expression

$$f(x,y,(a,b,c,d)) \text{ and } f(y, x \text{ xor } y, (a,b,c,d))$$

ought to be parameterized. Let's work it out in steps using the definitions:

and[x_, y_] := f[x, y, {0, 0, 0, 1}];
xor[x_, y_] := f[x, y, {0, 1, 1, 0}];
p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a, b, c, d}] , {x, 0, 1}, {y, 0, 1}] // Flatten

{a^2, b d, b c, c d}

More generally, if the two occurrences of $f$ are intended to have two different sets of parameters, the same method works:

p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a1, b1, c1, d1}],
        {x, 0, 1}, {y, 0, 1}] // Flatten

{a a1, b d1, b1 c, c1 d}

In other words, a simplified version of the compound input expression is

f[x, y, {a a1, b d1, b1 c, c1 d}]

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}


The second part of the question could be interpreted as asking how the expression

$$f(x,y,(a,b,c,d)) \text{ and } f(y, x \text{ xor } y, (a,b,c,d))$$

(which evidently is a binary Boolean operator in the arguments $x$ and $y$) ought to be parameterized. Let's work it out in steps using the definitions:

and[x_, y_] := f[x, y, {0, 0, 0, 1}];
xor[x_, y_] := f[x, y, {0, 1, 1, 0}];
p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a, b, c, d}] , {x, 0, 1}, {y, 0, 1}] // Flatten

{a^2, b d, b c, c d}

More generally, if the two occurrences of $f$ are intended to have two different sets of parameters, the same method works:

p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a1, b1, c1, d1}],
        {x, 0, 1}, {y, 0, 1}] // Flatten

{a a1, b d1, b1 c, c1 d}

In other words, a simplified version of the compound input expression is

f[x, y, {a a1, b d1, b1 c, c1 d}]
added 466 characters in body
Source Link
whuber
  • 20.6k
  • 2
  • 61
  • 113

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}


The second part of the question could be interpreted as asking how the expression

$$f(x,y,(a,b,c,d)) \text{ and } f(y, x \text{ xor } y, (a,b,c,d))$$

ought to be parameterized. Let's work it out in steps using the definitions:

and[x_, y_] := f[x, y, {0, 0, 0, 1}];
xor[x_, y_] := f[x, y, {0, 1, 1, 0}];
p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a, b, c, d}] , {x, 0, 1}, {y, 0, 1}] // Flatten

{a^2, b d, b c, c d}

More generally, if the two occurrences of $f$ are intended to have two different sets of parameters, the same method works:

p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a1, b1, c1, d1}],
        {x, 0, 1}, {y, 0, 1}] // Flatten

{a a1, b d1, b1 c, c1 d}

In other words, a simplified version of the compound input expression is

f[x, y, {a a1, b d1, b1 c, c1 d}]

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}


The second part of the question could be interpreted as asking how the expression

$$f(x,y,(a,b,c,d)) \text{ and } f(y, x \text{ xor } y, (a,b,c,d))$$

ought to be parameterized. Let's work it out in steps using the definitions:

and[x_, y_] := f[x, y, {0, 0, 0, 1}];
xor[x_, y_] := f[x, y, {0, 1, 1, 0}];
p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a, b, c, d}] , {x, 0, 1}, {y, 0, 1}] // Flatten

{a^2, b d, b c, c d}

More generally, if the two occurrences of $f$ are intended to have two different sets of parameters, the same method works:

p = Table[f[x, y, {a, b, c, d}]~and~f[y, x~xor~y, {a1, b1, c1, d1}],
        {x, 0, 1}, {y, 0, 1}] // Flatten

{a a1, b d1, b1 c, c1 d}

In other words, a simplified version of the compound input expression is

f[x, y, {a a1, b d1, b1 c, c1 d}]
Source Link
whuber
  • 20.6k
  • 2
  • 61
  • 113

The Wolfram Alpha example suggests you want to treat $0$ and $1$ as the Boolean values False and True respectively and, with this convention, to parameterize an arbitrary binary Boolean operator $f$ by means of its truth table values $(a,b,c,d)$:

f[x_, y_, {a_, b_, c_, d_}] := {1 - x, x} . {{a, b}, {c, d}} . {1 - y, y}

(This method exhibits such binary operators as bilinear forms over the field of two elements.)

Here is a comprehensive test proving this works correctly for inputs in the intended domain (that is, all of $a, \ldots, d$ are either $0$ or $1$ and so are $x$ and $y$). It applies all four possible inputs $(x,y)$ and lists the inputs followed by the values of $f$ when applied to them:

Flatten[Array[{#1, #2, f[#1, #2, {a, b, c, d}]} &, {2, 2}, {0, 0}], 1]

{{0, 0, a}, {0, 1, b}, {1, 0, c}, {1, 1, d}}