Metamath Proof Explorer


Theorem wl-df-3mintru2

Description: Alternative definition of wcad . See df-cad to learn how it is currently introduced. The only use case so far is being a binary addition primitive for df-sad . If inputs are viewed as binary digits (true is 1, false is 0), the result is whether ordinary binary full addition yields a carry bit. That is what the name df-cad is derived from: "carry of an addition". Here we stick with this abbreviated form of our notation above, but still use "adder carry" as a shorthand for "at least 2 out of 3" in text.

The core meaning is to check whether at least two of three inputs are true. So, if the first input is true, at least one of the two remaining must be true, else even both. This theorem is the in-between of "at least 1 out of 3", given by triple disjunction df-3or , and "(at least) 3 out of 3", expressed by triple conjunction df-3an .

The notion above can be generalized to other input numbers with other minimum values as follows. Let us introduce informally a logical operation "n-mintru-m" taking n inputs, and requiring at least m of them be true to let the operation itself be true. There now exists a recursive scheme to define it for increasing n, m. We start with the base case n = 0. Here "n-mintru-0" is equivalent to T. (any sequence of inputs contains at least zero true inputs), the other "0-mintru-m" is for any m > 0 equivalent to F. , because a sequence of zero inputs never has a positive number of them true. The general case adds a new input ph to a given sequence of n inputs, and reduces that case for all integers m to that of the smaller sequence by recursion, informally written as:

"(n+1)-mintru-(m+1)" <-> if- ( ph , "n-mintru-m" , "n-mintru-(m+1)" )

Our definition here matches "3-mintru-2" with inputs ph , ps and ch . Starting from the base cases we find after simplifications: "2-mintru-2" ( ps , ch ) <-> ( ps /\ ch ) ( wl-2mintru2 ), and "2-mintru-1" ( ps , ch ) <-> ( ps \/ ch ) ( wl-2mintru1 ). Plugging these expressions into the formula above for n = 3, m = 2 yields exactly our definition here. (Contributed by Wolf Lammen, 2-May-2024)

Ref Expression
Assertion wl-df-3mintru2 cadd φ ψ χ if- φ ψ χ ψ χ

Proof

Step Hyp Ref Expression
1 cadrot cadd φ ψ χ cadd ψ χ φ
2 cadifp cadd ψ χ φ if- φ ψ χ ψ χ
3 1 2 bitri cadd φ ψ χ if- φ ψ χ ψ χ