Very interesting topic!

I see an overall pattern, which I would like to share :-)

First, a few basic observations:

Hypothesis:

Each AND/OR operation is evaluated in the following way:
Whenever an AND/OR <op> is applied, it induces a change to the already gained average bits on the left-side. That change is a multiplicative factor determined by the average bits set on the right-side:


Cases:

For <op> = AND, we would take right_mod_factor and multiply it with left_avg_bits_set to get <resulting_avg_bits_set>. Examples:

That is, if there are more bits set on average on the AND right-side, there will be less chance of swallowing, so more bits are set on average in the result.

Conversely, for <op> = OR, we would take right_mod_factor and multiply it with left_avg_unset_bits. Then, take that result and add it to left_avg_set_bits to get <resulting_avg_bits_set>. Examples:

That is, if there are more bits set on average on the OR right-side, there will be more chance of overriding, so more bits are set on average in the result.

Conclusion:

So, following my pattern hypothesis, I see some inconsistent results in your "full set". For instance, 7 of ( R & R | R & R ) & R evaluates to 5 bits set on average. Attention has to be paid to precedence of AND/OR evaluations. Also, 22 & 26 are the same, when 22 of R & R | R | R evaluates to 26 bits set on average.

There may be some fallacy in my hypothesis, so feedback is welcomed :)

So, given the following legend:

we can derive a set of equations to calculate the resulting average bits set for each AND/OR operation:


In reply to Re: Boolean math: Fill in the blanks. by repellent
in thread Boolean math: Fill in the blanks. by BrowserUk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.