A variant of Chris Hughes' solution for the if normalization challenge. #
In this variant we eschew the use of aesop, and instead write out the proofs.
(In order to avoid duplicated names with Result.lean,
we put primes on the declarations in the file.)
@[irreducible]
Normalizes the expression at the same time as assigning all variables in
e to the literal Booleans given by l
Equations
- One or more equations did not get rendered due to their size.
- IfExpr.normalize' l (IfExpr.lit b) = ⟨IfExpr.lit b, ⋯⟩
- IfExpr.normalize' l (IfExpr.var v) = match h : AList.lookup v l with | none => ⟨IfExpr.var v, ⋯⟩ | some b => ⟨IfExpr.lit b, ⋯⟩
- IfExpr.normalize' l ((IfExpr.lit true).ite t e) = match IfExpr.normalize' l t with | ⟨t', ht'⟩ => ⟨t', ⋯⟩
- IfExpr.normalize' l ((IfExpr.lit false).ite t e) = match IfExpr.normalize' l e with | ⟨e', he'⟩ => ⟨e', ⋯⟩
- IfExpr.normalize' l ((a.ite b c).ite d e) = match IfExpr.normalize' l (a.ite (b.ite d e) (c.ite d e)) with | ⟨t', ⋯⟩ => ⟨t', ⋯⟩