I have four binary variables $x_{h}$, $x_{h'}$, $y_h$ and $y_{h'}$. I need to have the following relationships satisfied between the variables:
1- If $y_h = 1$ and $y_{h'} = 1$, then exactly one of $x_h$ and $x_{h'}$ should be equal to 1 ($y_h + y_{h'} = 2 \implies x_h + x_{h'} = 1$).
2- If exactly one of $y_h$ and $y_{h'}$ is equal to 1, then both $x_h$ and $x_{h'}$ should be equal to 0 ($y_h + y_{h'} = 1 \implies x_h + x_{h'} = 0$).
3- If both $y_h$ and $y_{h'}$ are equal to 0, again both $x_h$ and $x_{h'}$ should be equal to 0 ($y_h + y_{h'} = 0 \implies x_h + x_{h'} = 0$).
I was thinking of a constraint like $$y_h + y_{h'} = 2 (x_h + x_{h'}),$$ however, it only considers relations 1 and 3.
How can I formulate this?