LMD Async Tutoring

Oh yes. That’s right.

Okay. I was thinking of ways that I might be able to use division with remainder or modulo, but then I realised that I could use an analog of de morgans laws to transform my integer ‘and’ (x * y) to an ‘or’.

or(x, y); 1 - ((1 - x) * (1 - y))

or(1, 1): 1 - (0 * 0) = 1
or(1, 0): 1 - (0 * 1) = 1
or(0, 1): 1 - (1 * 0) = 1
or(0, 0): 1 - (1 * 1) = 0

so

nor(x, y): (1 - x) * (1 - y)

nor(1, 1): (0 * 0) = 0
nor(1, 0): (0 * 1) = 0
nor(0, 1): (1 * 0) = 0
nor(0, 0): (1 * 1) = 1

and

xor(x, y): 1 - ((1 - x) * (1 - y)) - xy

xor(1, 1): 1 - ((1 - 1) * (1 - 1)) - (1 * 1) = 0
xor(1, 0): 1 - ((1 - 1) * (1 - 0)) - (1 * 0) = 1
xor(0, 1): 1 - ((1 - 0) * (1 - 1)) - (1 * 0) = 1
xor(0, 0): 1 - ((1 - 0) * (1 - 0)) - (0 * 0) = 0