@@ -708,18 +708,18 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
708708 else text
709709 }
710710
711- /** Whether the counterexample is satisfiable */
711+ /** Whether the counterexample is satisfiable. The space is flattened and non-empty. */
712712 def satisfiable (sp : Space ): Boolean = {
713713 def genConstraint (space : Space ): List [(Type , Type )] = space match {
714714 case Prod (tp, unappTp, unappSym, ss, _) =>
715715 val tps = signature(unappTp, unappSym, ss.length)
716716 ss.zip(tps).flatMap {
717- case (sp : Prod , _ ) => genConstraint(sp)
717+ case (sp : Prod , tp ) => sp.tp -> tp :: genConstraint(sp)
718718 case (Typ (tp1, _), tp2) => tp1 -> tp2 :: Nil
719- // case _ => ??? // impossible
719+ case _ => ??? // impossible
720720 }
721721 case Typ (_, _) => Nil
722- // case _ => ??? // impossible
722+ case _ => ??? // impossible
723723 }
724724
725725 def checkConstraint (constrs : List [(Type , Type )]): Boolean = {
@@ -738,7 +738,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
738738 }
739739 }
740740
741- constrs.foldLeft( true ) { case (acc, ( tp1, tp2)) => acc && typeParamMap(tp1) <:< typeParamMap(tp2) }
741+ constrs.forall { case (tp1, tp2) => typeParamMap(tp1) <:< typeParamMap(tp2) }
742742 }
743743
744744 checkConstraint(genConstraint(sp))
0 commit comments