Wednesday 21 July 2021

Salamander riddle

Riddle

On a particular island live a lot of salamanders with different colours. Each salamander is defined by its genetics, an ordered list of unordered pairs of so-called genes. These genetics have the following properties:

  1. A child of two salamanders will, for each gene pair, select one random gene from each parent and form a new gene pair with the two selections. (Kind of like how it works in real biology if we ignore random mutations and crossing over).
  2. Two salamanders with the same gene pairs (so they are exact clones of each other) will have the same colour.
  3. Two full siblings (so salamanders with the same parents) have the same colour (totally not how it works in biology).

Note that not all gene combinations have to be viable, so not every gene combination has a corresponding salamander.

Prove that two salamanders with different colours cannot have viable offspring.

Solution

Assume a salamander XX has genes (x1,x1),(x2,x2),...(x_1, x'_1), (x_2, x'_2), ... and a salamander YY has genes (y1,y1),(y2,y2),...(y_1, y'_1), (y_2, y'_2), .... And they have viable offspring ZZ with genes (x1,y1),(x2,y2),...(x_1, y_1), (x_2, y_2), ....
XX and ZZ can have offspring genetically identical to ZZ (by selecting xix_i from XX and yiy_i from ZZ). And can have offspring that is genetically identical to XX(by selecting xix'_i from XX and xix_i from ZZ). Therefore using the third axiom, XX and ZZ have the same colour. Analogously, YY and ZZ have the same colour. By consequence, XX and YY have to be the same colour.
You can find a more rigorous version of this proof that is a computer verified here: https://gitlab.com/Elmosfire/blog-links/-/blob/378a210994d4e5d5f96af505ebf1011aecbfca3f/salamander.lean.

Alternate version

If we soften the third axiom to be

Two full siblings have the same colour if neither of them is genetically equal to their parents.
In this case, a salamander can breed with another salamander of a different colour and produce viable offspring.
Assume there are three gene pairs, all with two possible genes. Call them r/R, g/G and b/B.
Then have only six viable gene combinations,
rRGGbb, rRggBB which are red.
rrgGBB, RRgGbb which are green,
RRggbB, rrGGbB which are blue.
And let each time call the first mentioned geneset to have left chirality and the right mentioned geneset to have right chirality.

Note that genesets of the same chirality are symmetric to one another by replacing r with g, g with b and b with r. Genes from the left chirality transform into genes with right chirality by swapping two genes.

Now we can check all cases:

  • If a salamander breeds with a clone of itself, the only viable offspring is itself. For example, if rRGGbb breeds with itself, the offspring can only be RRGGbb, rRGGbb and rrGGbb, of which only the middle one is viable.
  • If a salamander breeds with a salamander with the same chirality, it has one viable offspring. For example rRGGbb and rrgGBB only have rrGGbB as viable offspring.
  • Two salamanders with the same colours but different chirality cannot have viable offspring.
  • If two salamanders with different colours and chirality have offspring, the offspring always is a clone of one of the parents.
    If this argument does not convince you, you can check the system case by case:
rRGGbb(  red) & rRGGbb(  red) => <rRGGbb(  red)>
rRGGbb(  red) & rrgGBB(green) =>  rrGGbB( blue) 
rRGGbb(  red) & RRggbB( blue) =>  RRgGbb(green) 
rRGGbb(  red) & rRggBB(  red) => 
rRGGbb(  red) & RRgGbb(green) => <rRGGbb(  red)> or <RRgGbb(green)>
rRGGbb(  red) & rrGGbB( blue) => <rrGGbB( blue)> or <rRGGbb(  red)>
rrgGBB(green) & rRGGbb(  red) =>  rrGGbB( blue) 
rrgGBB(green) & rrgGBB(green) => <rrgGBB(green)>
rrgGBB(green) & RRggbB( blue) =>  rRggBB(  red) 
rrgGBB(green) & rRggBB(  red) => <rrgGBB(green)> or <rRggBB(  red)>
rrgGBB(green) & RRgGbb(green) => 
rrgGBB(green) & rrGGbB( blue) => <rrgGBB(green)> or <rrGGbB( blue)>
RRggbB( blue) & rRGGbb(  red) =>  RRgGbb(green) 
RRggbB( blue) & rrgGBB(green) =>  rRggBB(  red) 
RRggbB( blue) & RRggbB( blue) => <RRggbB( blue)>
RRggbB( blue) & rRggBB(  red) => <RRggbB( blue)> or <rRggBB(  red)>
RRggbB( blue) & RRgGbb(green) => <RRggbB( blue)> or <RRgGbb(green)>
RRggbB( blue) & rrGGbB( blue) => 
rRggBB(  red) & rRGGbb(  red) => 
rRggBB(  red) & rrgGBB(green) => <rrgGBB(green)> or <rRggBB(  red)>
rRggBB(  red) & RRggbB( blue) => <RRggbB( blue)> or <rRggBB(  red)>
rRggBB(  red) & rRggBB(  red) => <rRggBB(  red)>
rRggBB(  red) & RRgGbb(green) =>  RRggbB( blue) 
rRggBB(  red) & rrGGbB( blue) =>  rrgGBB(green) 
RRgGbb(green) & rRGGbb(  red) => <rRGGbb(  red)> or <RRgGbb(green)>
RRgGbb(green) & rrgGBB(green) => 
RRgGbb(green) & RRggbB( blue) => <RRggbB( blue)> or <RRgGbb(green)>
RRgGbb(green) & rRggBB(  red) =>  RRggbB( blue) 
RRgGbb(green) & RRgGbb(green) => <RRgGbb(green)>
RRgGbb(green) & rrGGbB( blue) =>  rRGGbb(  red) 
rrGGbB( blue) & rRGGbb(  red) => <rrGGbB( blue)> or <rRGGbb(  red)>
rrGGbB( blue) & rrgGBB(green) => <rrgGBB(green)> or <rrGGbB( blue)>
rrGGbB( blue) & RRggbB( blue) => 
rrGGbB( blue) & rRggBB(  red) =>  rrgGBB(green) 
rrGGbB( blue) & RRgGbb(green) =>  rRGGbb(  red) 
rrGGbB( blue) & rrGGbB( blue) => <rrGGbB( blue)>

If the salamander is in <>-brackets, it means it is a clone of one of the parents. You can quickly check two full siblings where none are a clone of either of the parents do not exist.
So the last hypothesis is fulfilled automatically.