@@ -708,18 +708,18 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
708
708
else text
709
709
}
710
710
711
- /** Whether the counterexample is satisfiable */
711
+ /** Whether the counterexample is satisfiable. The space is flattened and non-empty. */
712
712
def satisfiable (sp : Space ): Boolean = {
713
713
def genConstraint (space : Space ): List [(Type , Type )] = space match {
714
714
case Prod (tp, unappTp, unappSym, ss, _) =>
715
715
val tps = signature(unappTp, unappSym, ss.length)
716
716
ss.zip(tps).flatMap {
717
- case (sp : Prod , _ ) => genConstraint(sp)
717
+ case (sp : Prod , tp ) => sp.tp -> tp :: genConstraint(sp)
718
718
case (Typ (tp1, _), tp2) => tp1 -> tp2 :: Nil
719
- // case _ => ??? // impossible
719
+ case _ => ??? // impossible
720
720
}
721
721
case Typ (_, _) => Nil
722
- // case _ => ??? // impossible
722
+ case _ => ??? // impossible
723
723
}
724
724
725
725
def checkConstraint (constrs : List [(Type , Type )]): Boolean = {
@@ -738,7 +738,7 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
738
738
}
739
739
}
740
740
741
- constrs.foldLeft( true ) { case (acc, ( tp1, tp2)) => acc && typeParamMap(tp1) <:< typeParamMap(tp2) }
741
+ constrs.forall { case (tp1, tp2) => typeParamMap(tp1) <:< typeParamMap(tp2) }
742
742
}
743
743
744
744
checkConstraint(genConstraint(sp))
0 commit comments