Hello.

I've ran into a problem reversing a calculation I'm doing. I'm not sure if this is solvable but I figure if there's a way to move forward there must be a way to move backwards too.

here are the constraints

b1=1+v4, b2=1+v3, b3=1+v2, b4=1+v1, if b1=b4 then b4=0 if b1=b3 then b3=0 if b1=b2 then b2=0 if b2=b4 then b4=0 if b2=b3 then b3=0 if b3=b4 then b4=0

So say for example I started with

v4 = 70

v3 = 00

v2 = 00

v1 = 00

b1 = v4 + 1 = 70 + 1 = 71

b2 = v3 + 1 = 01

b3 = v2 + 1 = 01

b4 = v1 + 1 = 01

Now b2 = b3 = b4 so b3 and b4 now = 00

So results for the calculation is b1 = 71, b2 = 01, b3 = 00, b4 = 00.

The problem sets in when I need to reverse this. assuming I have no other information except the end value of b1 = 71, b2 = 01, b3 = 00, b4 = 00

now b1 - 1 = v4

v4 = 71 - 1 = 70

if b2 = 0 then b2 must be = to b1, b2 is not 0, therefore b2 -1 = v3, 01 -1 = 00 = v3.

So far so good nothing complicated but then..

when I get to b3 and b3 = 00, for b3 to = 00 either b1 = b3, or b2 = b3, therefore v2 is either 70 or 00 and this is where I'm stuck

what I need is to reverse it back into its original form of 70 00 00 00 (assuming I don't know what the original form looks like) but since starting from b3 onwards there's more than 1 answer I'm completely stuck. also consider than b4 is also dependent on b3.

additional information include that

there can't be b2 if b1 is 0

there can't be a b3 if b2 is 0

there can't be b4 if b3 is 0

ie it's hierarchical.

any help would be much appreciated.