Monday, December 31, 2018

Solution of the equation E(M)⊕E(N) => E(A)*¬E(M & N) ≡ 1 via the calculus of basic predicates according to E.A.Mironchick (final draft)

*********************************************************************
UPDATED as of 03/05/2019. This is supposed to be final draft 
fixing a minor issues in original version
*********************************************************************
In general we follow guidelines of technique developed in
http://kpolyakov.spb.ru/download/mea18bit.pdf

Per link mentioned above (quoting Helen A. Mironchick)
Let Et (x) be a predicate whose truth set is all x for which x & t ≠ 0.
If t is a power of two, then such a predicate will be called basic.
The basic predicate describes (fixes) a single unit in the binary notation.
Further, for brevity, the predicate Et (x) will be denoted by E(t);
we will also denote the truth set of this predicate.

(quoting ends)


Denote by {X} the binary representation of a natural number X.
The core statement of the post below  is :-

Let R, M, N be natural numbers. R is the minimum
satisfying the condition {M OR N} = {R OR {M & N}},
where "OR" is a bitwise disjunction, and "&" is a bitwise conjunction
Then the smallest A satisfying the equation
E(M)⊕E(N)=>E(A)*¬E (M & N) ≡ 1 would be equal R.


First we intend to show that, E(M) v E(N) = E(R) v E(M&N).
Notice also that everywhere below  "*" is "^".

Consider expansions in the logical sum of  basic predicates.
E (M) and E(N). All pairs of equal basic predicates will be
collapsed into one and the logical sum of such predicate pairs
will obviously give E(M&N). The logical sum of all those
remaining is exactly E(R). It remains to apply the formulas
of De Morgan.

               ¬(E(M) v E(N)) = ¬(E(R) v E(M & N))

and get the required equality below

               ¬E(M)*¬E(N) = ¬E(R)*¬E(M&N)  (1)

Bitwise2 has a familiar formula. Due to the fact that ¬E(N) = Z(N)
        Z(M)*Z(N) = Z(M OR N) = Z(R)*Z(M & N)
Thus, ¬E(M)*¬E(N) = ¬E(R)*¬E (M & N) can be obtained
as a result of Statement 3 of http://kpolyakov.spb.ru/download/bitwise2.pdf

   Convert the original equation as follows

   E(M)⊕E(N) => E(A)*¬E(M&N) ≡ 1
   (E(M)≡E(N)) v E(A)*¬E(M&N) ≡ 1
 ¬E(M)*¬E(N) v E(M)*E(N) v E(A)*¬E(M&N) ≡ 1

    From the decomposition of M and N into basic predicates
    define the numbers REST-M and REST-N such that
    each of them has no common unit bits with M&N and in doing so
    obtain

     {REST-M} + {M & N} = {M}
     {REST-N} + {M & N} = {N}

     Consequently

     E(M) = E(REST-M) v E(M&N)
     E(N) = E(REST-N) v E(M&N)

Apply formula (1) to ¬E(M)*¬E(N):-

¬E(R)*¬E(M&N) v (E(REST-M) v E(M & N))*(E(REST-N) v E(M&N)) v
   v E(A)*¬E(M&N) ≡ 1
¬E(R)*¬E(M&N) v E(REST-M)*E(REST-N) v E (M&N) v
   v E(A)*¬E(M&N) ≡ 1
¬E(R) v E(REST-M)*E(REST-N) v E(M&N) v E(A)≡ 1

*************
Theorem 1 
************* 
For truth ∀ x: E(k)(x) => E(m)(x), it is necessary 
and sufficient that the set of unit bits "k" is fully 
included in the set of unit bits "m"

Necessity
Let j(1), .., j(s) be the numbers of the single unit bits "k",
ordered descending (for example), then
¬E(k)= ¬E(j(1)) * .... *¬E(j(s)) we show that
        ¬E(k) + E(m) = 1
We have
¬E(k) = ¬E(j(1))* .... *¬E(j(s))
E(m) = E(j(1)) + ... + E(j(s)) + E (rest)
We consistently suppress all factors in conjunction.
¬E(k)+E (m) = ¬E(j(1))* ....*¬E(j(s)) + E(j(1)) + ... + E(j(s)) + E(rest)=1

Sufficiency
If there is at least one single unit bit "k" (with the number "p") not included in the single unit bits "m", then k&2^p! = 0 and at the same time the numbers of the single unit bits "m" do not contain "p", then 2^p with a unit at the place "p" in the binary representation 1000 ... 0 (counting from 0 from right to left) will be multiplied by 0 in the p-th position "m", that is, m&2^p = 0 In this case, k&2^p != 0, that is, E(k,2^p) = 1 if m&2^p = 0 then E(m,2^p) = 0. In this case, Е(к,2^p) => Е(m,2^p) = 0, that is, the condition of the theorem is not satisfied for all "x"

We are all set with Theorem 1


Starting from this point we intend to invoke Theorem 1 where it 
appears to be needed without any previous notification 

Say $(X) is the set of unit bits in X.
Convert the last equation as follows


(E(R)=> E(REST-M))*(E(R)=> E(REST-N)) 

       v (E(R)=> E(M&N)) v (E(R)=> E(A)) ≡ 1 

Assign A(min) value equal R and consider any A < A(min) then

      ∃ j: ( j !∈ $(A))*(j ∈ $(R)) = True

From here and below our major goal would be to prove that for any
A < A(min)  it exists integer y=y(A) which will result


(E(R)=> E(REST-M))*(E(R)=> E(REST-N)) 
       v (E(R)=> E(M&N)) v (E(R)=> E(A)) (y(A)) =0

 
Set unit bit on place number  "j"  in y=y(A)
Due to j ∈ $(R) this j !∈ $(M&N). The rest of y's bits
let us set to 0


Notice that this "j" also doesn't belong to at least one of sets
$(REST-M) or $(REST-N), otherwise it would belong
$(M&N). So conjuction below is equal 0. 

 
    (E(R,y)=> E(REST-M,y))*(E(R,y)=> E(REST-N,y)) = 0  (1)


Then notice that (E(R,y)=> E(M&N,y)) = 0 (2)
and (E(R,y)=> E(A,y) = 0 (3)


Finally we are getting (due to (1),(2) and (3))

(E(R)=> E(REST-M))^(E(R)=> E(REST-N)) v
  v (E(R)=> E(M&N)) v (E(R)=> E(A))(y) = 0

 
Thus for any A less then R it exists y=y(A) such
that predicate been written above has value 0
for number y=y(A) and A(min) appears to be real
minimum A(min)

 


Links
1. http://kpolyakov.spb.ru/download/mea18bit.pdf

Wednesday, December 19, 2018

Алгебра базисных предикатов по Е.А. Мирончик (2017) versus Bitwise2

Updated as of 15/02/2019

Изначально техника, используемая ниже была введена
в работе http://kpolyakov.spb.ru/download/mea18bit.pdf   
Существует также статья в журнале "Информатика в школе"
№7 2017 несколько более удобная для первого чтения, но только 
как твердая копия, он-лайн версии нет.


**************
Теорема 1
**************
Для выполнения  ∀ x∈N: E(k,x) => E(m,x) = True 
необходимо и достаточно, чтобы множество единичных битов "k" полностью входило во множество единичных битов "m"

Необходимость
Пусть j(1),..,j(s) - номера единичных битов "k" ,
упорядоченное по убыванию (например),тогда
¬E(k) = ¬E(j(1))*....*¬E(j(s)) покажем,что
        ¬E(k) + E(m) = 1
Имеем
¬E(k)=¬E(j(1)*....*¬E(j(s)
E(m) = E(j(1)) + ... + E(j(s)) + E(rest)
Последовательно подавляем все множители в конъюнкции
¬E(k)+E(m)=¬E(j(1))*....*¬E(j(s)) + E(j(1)) + ... + E(j(s)) + E(rest) = 1

Достаточность
Если есть хоть один единичный бит "к" (c номером "р"), не входящий в единичные биты "m",то k&2^p !=0  и в тоже время номера единичных битов "m" не содержат "р",тогда 2^p с единицей на месте "р" в двоичном представлении 1000...0 (считая от 0 справа налево) будет умножаться на 0 в р-ой позиции "m",то есть m&2^p=0
В этом случае  k&2^p !=0 то есть Е(к,2^p)=1 если при этом 
m&2^p =0 тогда Е(m,2^p)=0
В этом случае  Е(к,2^p) => Е(m,2^p) =0 то есть условие теоремы не выполнено для всех "x"

Заметим (¬A = > ¬B ) = (A + ¬B) = (B => A)


(E(A)*¬E(12) => ¬E(A)*E(21)) + ¬E(21)*¬E(12) ≡ 1
¬E(A) + E(12) + ¬E(A)*E(21) +  ¬E(21)*¬E(12) ≡ 1

Применяем принцип поглощения
¬E(A) + E(12) + ¬E(21)*¬E(12) ≡ 1


и подавляем ¬E(12) в конъюнкции
¬E(A) + E(12) + ¬E(21) ≡ 1
¬(¬E(12)) + ¬E(A) + ¬E(21) ≡ 1


Используем дистрибутивность импликации
по отношению к дизъюнкции
¬E(12) => ¬E(A) + ¬E(21) ≡ 1
(¬E(12) => ¬E(A)) + (¬E(12) => ¬E(21)) ≡ 1


Согласно замечанию получаем
(E(A) => E(12)) + (E(21) => E(12)) ≡ 1


21=10101 (binary)
12=1100 (binary)

По Теореме 1
E(21) => E(12) ! ≡ 1
Таким образом нам необходимо, чтобы
E(A) => E(12) ≡ 1
По Теореме 1 окончательно имеем :-
А(мах) = 12



((E(13) + E(A)) => E(13) + E(A)*¬E(39) ≡ 1
¬E(13)*¬E(A) + E(13) + E(A)*¬E(39) ≡ 1

Подавляем E(А) в конъюнкции
¬E(A) + E(13) + E(A)*¬E(39) ≡ 1
¬E(A) + E(13) + ¬E(39) ≡ 1

Используем дистрибутивность импликации
по отношению к дизъюнкции
¬(¬E(13)) + ¬E(A) + ¬E(39) ≡ 1
¬E(13) => ¬E(A) + ¬E(39) ≡ 1

Согласно замечанию
(¬E(13) => ¬E(A)) + (¬E(13) => ¬E(39)) ≡ 1
(E(A) => E(13)) + (E(39) => E(13)) ≡ 1

По Теореме 1
E(39) => E(13) !
≡ 1
Таким образом нам необходимо, чтобы 
E(A) => E(13) ≡ 1
По Теореме 1 окончательно имеем :-
А(мах) = 13

***************
Теорема 2
***************
Полученное выше А(мах) увеличить невозможно
не потеряв тождественной истинности  
(E(A)=>E(T)) + (E(P)=>E(T)) 1
где смысл Т и Р ясен из контекста выше. 

Доказательство
Определим  $(C)  как множество единичных бит в С ∈ N , идущих
строго в порядке убывании разрядов  {j(1),j(2),....,j(k)}

Рассмотрим тождество (E(A)=>E(T)) + (E(P)=>E(T)) = 1
раносильное исходному уравнению

Пусть А(mах) = Т и А > A(max)

Существует единица из $(A) не входящая в $(A(max))
Определим х(А) имеющим нули в всех позициях $(A(max))
и единицу в позиции единицы в $(A),не входящей в
$(A(max))

P также как и А должно иметь единицу не входящую в $(A(max))
В х(А) поставим единицу на той же позиции, что и единица из Р,
не входящая в $(A(max))

Тогда
 T&x(A) = 0
 A&x(A) = 1
 P&x(A) = 1

Получаем
 E(A,x(A)) = 1
 E(T,x(A)) = 0  
 E(P,x(A)) = 1

E(A,x(A)) => E(T,x(A)) = 0
E(P,x(A)) => E(T,x(A)) = 0
Предикат (E(A)=>E(T)) + (E(P)=>E(T)) = 0
при х = х(А)


************
Задача 2
************
Найти максимальное А удовлетворяющее
уравнению ¬E(10) + ¬E(A) + E(17)  ≡ 1


¬E(10) + ¬E(A) + ¬(¬E(17))  ≡ 1
¬E(17) => ¬E(10) + ¬E(A)  ≡ 1
(¬E(17)=> ¬E(10)) + (¬E(17)=> ¬E(A)) ≡ 1

Лекго  доказать
¬E(17)=> ¬E(10) !≡ 1
так как
E(17) + ¬E(10) = E(10) => E(17) !≡ 1  по Теореме 1

Поскольку E(10) => E(17) !≡ 1

Таким образом нам необходимо, чтобы Е(А) =>E(17) ≡ 1
E(17) + ¬E(A) = E(A) => E(17) ≡ 1  


По Теореме 1

A(max) = 17

Tuesday, December 11, 2018

Technique of calculating basic predicates according to Е.А. Mironchick vs Bitwise2

Bellow we follow basic technique developed in 
http://kpolyakov.spb.ru/download/mea18bit.pdf

 *************************************************************
 Find the smallest A so that for all positive integers "x"
   (x&24 != 0)⊕(x&9 != 0) => (x&A != 0)*(x&8 =0)

 Sign of ⊕ means XOR
 *************************************************************
Per link mentioned above (quoting Helen A. Mironchick)
Let Et (x) be a predicate whose truth set is all x for which x & t ≠ 0.
If t is a power of two, then such a predicate will be called basic.
The basic predicate describes (fixes) a single unit in the binary notation.
Further, for brevity, the predicate Et (x) will be denoted by E(t);
we will also denote the truth set of this predicate.

(quoting ends)

Keeping in mind
  ¬A + A*B = (¬A + A)*(¬A + B) = ¬A + B
     A + A*B = A

Proceed as follows
  (E(24)*¬E(9) + ¬E(24)*E(9)) => E(A)*¬E(8) = 1
  ¬(E(24)*¬E(9) + ¬E(24)*E(9)) + E(A)*¬E(8) = 1
 (¬E(24) + E(9))*(E(24) + ¬E(9)) + E(A)*¬E(8) = 1
 ¬E(9)*¬E(24) + E(9)*E(24) + E(A)*¬E(8) = 1


Suppress the double occurrence of ¬E (8) in the first term

¬E(16)*¬E(8)*¬E(1) + E(9)*E(24) + E(A)*¬E(8) = 1
E(9)*E(24)= (E(8) + E(1))*(E(16) + E(8)) = 

    = E(8) + E(8)*E(16) + E(1)*E(16) + E(1)*E(8)

Apply the principle of absorption
 
¬E(16)*¬E(8)*¬E(1) + (E(8) + E(1)*E(16)) +  E(A)*¬E(8) = 1
  ((¬E(16)*¬E(1) + E(A))*¬E(8) + E(8) + E(1)*E(16) = 1
  (¬E(17) + E(A)) + E(8) + E(1)*E(16) = 1


Thus  A(min)=17


************************
Bitwise2 Solution
************************
¬Z(24)⊕¬Z(9) => ¬A*Z(8) = 1
¬Z(24)¬Z(9) + Z(24)*Z(9) + ¬A*Z(8) = 1
¬(Z(24) + Z(9)) + Z(25) + ¬A*Z(8) = 1
¬Z(24&9) + Z(17)*Z(8) + ¬A*Z(8) = 1


Notice that

24 = 11000
&  - per bit conjunction
  9 = 01001
===========
8 = 01000

Z(24)*Z(9) = Z(25) = Z(17)*Z(8)

17= 10001
"v" - per bit disjunction
08= 01000
=============
25 = 11001

Now continue

¬Z(8) + Z(17)*Z(8) + ¬A*Z(8) = 1
¬Z(8) + Z(17) + ¬A = 1
(A=> Z(17)) + (A=> ¬Z(8)) = 1

Thus A(min) = 17


Another sample

***********************************************
Technique of calculation predicates
per Helen Mironchick
***********************************************
 
E(56)⊕E(25) => E(A)*¬E(24) = 1
¬E(56)*¬E(25) + E(56)*E(25) + E(A)*¬E(24) = 1

¬E(32)*¬E(16)*¬E(8)*¬E(1) +
  + (E(32) + E(16) + E(8))*(E(16) + E(8) + E(1)) + E(A)*¬E(24) = 1

¬E(32)*¬E(16)*¬E(8)*¬E(1) + E(32)*
(E(16) + E(8) + E(1)) + E(16) + E(8) +
  + E(A)*¬E(16)*¬E(8) = 1

¬E(32)*¬E(1) + E(32)*(E(16) + E(8) + E(1))
+ E(16) + E(8) + E(A) = 1
¬E(33)
E(32)*(E(16) + E(8) + E(1)) + E(16) + E(8) + E(A) = 1

Thus A(min) = 33

**************************
Bitwise2 Solution
**************************
 

¬Z(56)⊕¬Z(25) => ¬A*Z(24) = 1
¬Z(56)¬Z(25) + Z(56)*Z(25) + ¬A*Z(24) = 1
¬(Z(56) + Z(25)) + Z(57) + ¬A*Z(24) = 1
¬Z(56&25) + Z(33)*Z(24)  + ¬A*Z(24) = 1


56 = 111000
& - per bit conjunction
25 = 011001
===========
24 = 011000

33 = 100001
v - per bit disjunction
24 = 011000
============
57 = 111001

56 = 111000
v - per bit disjunction
25 = 011001
===========
57 = 111000

So, we get:-


 Z(56)*Z(25) = Z(57) = Z(33)*Z(24)

Proceed as folows :


¬Z(24) + Z(33)*Z(24)  + ¬A*Z(24) = 1
¬Z(24) + Z(33)  + ¬A = 1
(A => Z(33)) + (A => ¬Z(24)) = 1
(A => Z(33)) + (A => ¬Z(24)) = 1


Thus A(min) = 33