Commit 6149003d by AVANZINI Martin

### simplification of conds in CExp

parent 1192d014
 ... ... @@ -197,7 +197,7 @@ absynth = Benchmark "absynth" {-# NOINLINE pldi #-} pldi :: Benchmark pldi = unsafePerformIO \$ Benchmark "pldi" <\$> do fps <- sort . lines <\$> readCreateProcess (shell "find examples/pldi -type f -name *.imp") mempty fps <- sort . lines <\$> readCreateProcess (shell "find examples/pldi -type f") mempty forM fps \$ \fp -> Problem fp <\$> fromFile' fp ... ...
 ... ... @@ -45,10 +45,12 @@ sup :: Eq c => CExp c -> CExp c -> CExp c sup c1 c2 | c1 == c2 = c1 sup c1 c2 = Sup c1 c2 cond :: BExp -> CExp c -> CExp c -> CExp c cond Top c1 _ = c1 cond Bot _ c2 = c2 cond g c1 c2 = Cond g c1 c2 cond :: Eq c => BExp -> CExp c -> CExp c -> CExp c cond Top c _ = c cond Bot _ d = d cond g (Cond g' c1 c2) d | c2 == d = cond (g .&& g') c1 d cond g c d = Cond g c d guarded :: (Eq c, Num c) => BExp -> CExp c -> CExp c guarded g c = cond g c zero ... ... @@ -234,12 +236,12 @@ instance (Eq c, Num c) => E.Substitutable (CExp c) where instance (PP.Pretty c, Eq c, Num c) => PP.Pretty (CExp c) where pretty = pp id where pp par (E e) = PP.text "E" PP.<> PP.tupled [PP.pretty e] pp _ (E e) = PP.text "E" PP.<> PP.tupled [PP.pretty e] pp par (Div c e) = par (infx (pp id c) "/" (PP.pretty e)) pp par (Plus c d) = par (infx (pp PP.parens c) "+" (pp PP.parens d)) pp _ (Sup c d) = PP.text "sup" PP.<> PP.tupled [ pp id c, pp id d ] pp _ (Cond g c d) | d == zero = PP.encloseSep (PP.text "〈") (PP.text "〉") (PP.text "|") [PP.pretty c, PP.pretty g] | d == zero = PP.brackets (PP.pretty g) PP. PP.parens (PP.pretty c) | otherwise = PP.text "ite" PP.<> PP.tupled [ PP.pretty g, pp id c, pp id d ] infx d1 s d2 = d1 PP. PP.text s PP.<+> d2 ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!