Skip to content

Commit

Permalink
Add back bindings in pretty printing of environments
Browse files Browse the repository at this point in the history
  • Loading branch information
facundominguez committed May 31, 2022
1 parent ab3ec4e commit 04f75d9
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Language/Fixpoint/Solver/Prettify.hs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}

{-# OPTIONS_GHC -Wno-name-shadowing #-}
Expand Down Expand Up @@ -40,9 +41,11 @@ import Language.Fixpoint.Types.Names
import Language.Fixpoint.Types.PrettyPrint
import Language.Fixpoint.Types.Refinements
( Expr(..)
, pattern PFalse
, Reft
, SortedReft(..)
, conjuncts
, expr
, reft
, reftBind
, reftPred
Expand Down Expand Up @@ -84,14 +87,18 @@ prettyConstraint bindEnv c =
]
mergedEnv = mergeDuplicatedBindings env
undoANFEnv = undoANFAndVV mergedEnv
boolSimplEnv = HashMap.map snd $ simplifyBooleanRefts undoANFEnv
boolSimplEnvDiff = simplifyBooleanRefts undoANFEnv
boolSimplEnv = HashMap.map snd $ HashMap.union boolSimplEnvDiff undoANFEnv

simplifiedLhs = simplify $ inlineInSortedReft (`HashMap.lookup` boolSimplEnv) (slhs c)
simplifiedRhs = simplify $ inlineInSortedReft (`HashMap.lookup` boolSimplEnv) (srhs c)

prunedEnv =
dropLikelyIrrelevantBindings
(constraintSymbols simplifiedLhs simplifiedRhs)
if expr simplifiedRhs /= PFalse then
dropLikelyIrrelevantBindings
(constraintSymbols simplifiedLhs simplifiedRhs)
boolSimplEnv
else
boolSimplEnv
(renamedEnv, c') =
shortenVarNames prunedEnv c { slhs = simplifiedLhs, srhs = simplifiedRhs }
Expand Down

0 comments on commit 04f75d9

Please sign in to comment.