It is indeed possible to create or refine muscle-memory in dreams, but I think something like math is too complex to be faithfully reproduced in the dream world, unless you live and breathe it.