1

Given some True / False propositions $A,B,C,D, \dots$ I would like to know if there is a name for these operations:

$ONE(A,B,C)$ - true if exactly one of $A, B$ and $C$ is true, false otherwise

$TWO(A,B,C)$ - true if exactly two of $A, B$ and $C$ is true, false otherwise

$ONE(A,B,C,D, \dots)$ - true if exactly one of $A, B, \dots \;$ is true, false otherwise

A sensible notation to me would be $\#OF(A, B, C, \dots)$ where the # is replaced by some positive integer. I.e.

$2OF(A,B,C,D)$ would be true if exactly two of $A,B,C$ and $D$ are true.

Interestingly the boolean algebra formulas for these operations are very predictable.

$2OF(a,b,c,d)=ab+ac+ad+bc+bd+cd-3(abc+abd+acd+bcd)+6abcd$

Higher versions simply use more coefficients from Pascal's triangle with an alternating sum.

Thanks in advance, Ben

Ben Crossley
  • 2,544
  • I've had occasions to want to use these as well .. but I have never seen any official definition. ... but how am I to understand the -, the 3, and the 6 in your expression? Even if we work with 0's and 1's in Boolean algebra's, we still do things like 1+1=1 , so I am not sure what it means to 'multiply' (i.e. conjunct) some term by 3 ... let alone what it means to 'subtract'. Can you please explain? – Bram28 Jun 06 '19 at 18:32

1 Answers1

1

As a Boolean algebra expression, I would say:

$2OF(a,b,c,d)=(ab+ac+ad+bc+bd+cd)(abc+abd+acd+bcd)'$

"At least two, but (and) not at least 3"

Bram28
  • 100,612
  • 6
  • 70
  • 118
  • What is the function ' ? - I know it's a complement, but how are you implementing it. – Ben Crossley Jun 06 '19 at 18:40
  • 1
    @BenCrossley Negation. Some texts will put a horizontal bar over the expression. Not sure what you mean by 'how would you implement it' ... it is an operation just like the disjunction and conjunction, except it just takes one truth-value on the input – Bram28 Jun 06 '19 at 18:40
  • Negation is just $(1-X)$ so surely that would be $(ab+ac+ad+bc+bd+cd)(1-abc-abd-acd-bcd)$ – Ben Crossley Jun 06 '19 at 18:48
  • @BenCrossley Careful ... what does this repeated $-$ in $1-abc-abd-acb-bcd)$ mean? You say that the negation of $X$ is $1-X$, so we know that $1-0=1$ and $1-1=0$, but what are $0-0$ and $0-1$? Second, if $x-(y-z)$ is not the same as $(x-y)-z$, then you need to add parentheses to this expression. In fact, even if it is associative, it is not clear if $1-abc-abd-acb-bcd))$ is the same as $1-(abc+abd+acb+bcd))$. Anyway, please define what $0-0$ and $0-1$ are, and then I can tell you if what you want is $1-abc-abd-acb-bcd)$ – Bram28 Jun 06 '19 at 18:57
  • I was using it to highlight that your suggestion doesn't seem to work. as it is clearly nonsensical (try all true and you get -18). In Boolean algebra, not X is definitely 1-X.

    Or at least, that's what it says on Wikipedia and has always worked in every calculation I've ever done.

    – Ben Crossley Jun 06 '19 at 19:19
  • @BenCrossley Just because you provide an alternative does not mean that mine is nonsense. And remember, boolean algebra does not work like numbers ... there is no such thing as -18, or even 3 or 6 in boolean algebra. Only 0's and 1's. – Bram28 Jun 06 '19 at 19:21
  • $(ab+ac+ad+bc+bd+cd) \not\equiv$ 'at least 2' and $(abc+abd+acd+bcd) \not\equiv$ 'at least 3' otherwise $1-X$ would work fine. – Ben Crossley Jun 06 '19 at 19:22
  • Hmmm. I could be doing something wrong then. Are you taking every term mod 2? Or every factor mod 2? How are you working it? – Ben Crossley Jun 06 '19 at 19:23
  • @BenCrossley I use : 0+0=0, 0+1=1, 1+0=1, and 1+1=1. 11=1, 10=0, 01=0, 00=0, 0'=1, and 1'=0 – Bram28 Jun 06 '19 at 19:24
  • Ahh, then perhaps I have the wrong name for what I am doing. I am using normal algebra. Not that algebra. The only limitation for me is that a,b,c,... are elements of ${0,1}$ a AND b is [ab], a OR b is [1-(1-a)(1-b)], NOT a is [1-a] – Ben Crossley Jun 06 '19 at 19:26
  • 1
    @BenCrossley Well, you could try and do propositional logic using number algebra ... but it is a lot easier using boolean algebra :) – Bram28 Jun 06 '19 at 19:27
  • I'm trying to create my own algebra, that uses cross polytopes as the structure. Each variable has its own axis and the values for true, false, paradox and conditional are $1,-1,\infty,0$ then using some rules I aim to be able to perform logic on them. All for the fun of it. – Ben Crossley Jun 06 '19 at 19:34
  • @BenCrossley That's very cool, and more power to you! And yes, if you do that, you'll want to move beyond boolean algebra. – Bram28 Jun 06 '19 at 19:39
  • I'm new to all this. What are you referring to when you say beyond Boolean algebra? I'm aware of first-order logic (this?) then second-order, higher-order. But I know almost nothing about them. Or if I do, I don't know that I do XD – Ben Crossley Jun 06 '19 at 19:42
  • 1
    @BenCrossley What I mean is that you want to separate between true, false, paradox, etc., then you want variables to take on more than two values. So yes, maybe something like 0,1,-1, etc. In boolean algebras variables can only take on one of two values: true (1) or false (0) . So that's just not going to work for the logic you are trying to develop – Bram28 Jun 06 '19 at 19:45
  • Ah, yes. I had already thought of that. And I now see the obviousness of why this is an extension of boolean algebra. – Ben Crossley Jun 06 '19 at 19:51