Lewis Carroll was a mathematician by trade. Apparently Alice's Adventures in Wonderland was his mocking critique of the

*"New Math"* of the day. Here is an abstract from an article on the subject.

"Alice’s Adventures in Wonderland: Carroll’s Symbolic Attack on Mathematical Symbolism
and another

An exploration of logic and mathematics in Lewis Carroll’s ‘Alice’s Adevtures in Wonderland’
Wonderland is often used as a synonym for nonsense, but is there something more complex and logical functioning beneath the surface? Lewis Carroll’s fiction novel Alice’s Adventures in Wonderland presents the most remarkable synergy of sense and nonsense; logic and fallacies. With Deleuze’s Logic of Sense being utilised to illuminate the key fields of logic in the novel, appropriate fields of geometry and algebra will be utilised under the scope of mathematics to elevate an establishment of logic.

A conservative mathematician, Carroll disputed the pivotal change that was being introduced in the 19th century. With preceding mathematics emphasising logical Euclidean methods, the 1800’s saw mathematical theories introduce more abstract principles which extended mathematics beyond the isolation of arithmetic and numbers. Deeming this absurd, Carroll thus utilised the nonsense fiction in Alice’s Adventures in Wonderland to subtly mock the contemporary mathematical climate.