[GHC] #13073: BooleanFormula implies is wrong

GHC ghc-devs at haskell.org
Thu Jan 5 22:05:39 UTC 2017


#13073: BooleanFormula implies is wrong
-------------------------------------+-------------------------------------
           Reporter:  ezyang         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  8.1
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 The current implementation looks like this:

 {{{
 implies :: Eq a => BooleanFormula a -> BooleanFormula a -> Bool
 x `implies` Var y  = x `impliesAtom` y
 x `implies` And ys = all (implies x . unLoc) ys
 x `implies` Or ys  = any (implies x . unLoc) ys
 x `implies` Parens y  = x `implies` (unLoc y)
 }}}

 This cannot possibly be correct: this will decompose the formula A \/ B ->
 A \/ B in the following way

 {{{
 Or [Var a, Var b] `implies` Or [Var a, Var b]

 Or [Var a, Var b] `implies` Var a ||
 Or [Var a, Var b] `implies` Var b
 }}}

 But neither of the decomposed formulas are true.

 I didn't find a case in the typechecker where this actually mattered.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13073>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list