We need to refactor the type abastraction in order to have mul (a times b) and mul_c (a times Const), etc; or we can extend mul() to handle different case; or we can call simplify logic directly in operations.
We need a Qtype.is_const #37 to check if a Qtype is constant (only contains False/True).
When we have bin operations with a constant operator, it is sometime possible to do some optimization.
For instance if we want to multiply and diving two numbers, and one operand is a constant, we can achieve it using shift and add multiplication algorithm (https://youtu.be/acUH4lWe2NQ?si=H7GAS241CZuyBe3C&t=880)
We need to refactor the type abastraction in order to have mul (a times b) and mul_c (a times Const), etc; or we can extend mul() to handle different case; or we can call simplify logic directly in operations.
We need a
Qtype.is_const
#37 to check if a Qtype is constant (only contains False/True).