diff --git a/cp-demo/Product.scala b/cp-demo/Product.scala index b06c633a6db31b1e6bc5fbed4f4a1ea72a1c10b3..024fdd7b7b7d29aec1a84f0ebfb8fc66c73e6e13 100644 --- a/cp-demo/Product.scala +++ b/cp-demo/Product.scala @@ -5,15 +5,18 @@ object Product { def main(args: Array[String]): Unit = { val c1 = ((x: Int) => x > 5).c val c2 = ((x: Int) => x > 41).c + val c22 = ((x: Int, y: Int, z: Int) => x > y).c - val c3 = c1 product1 c2 + val c3 = c1 product c2 + val c32 = c1 product c22 val c4 = ((a: Boolean, b: Int) => a == b > 0).c val c5 = ((i: Int, j: Int) => i > j).c - val c6 = c4 product2 c5 + val c6 = c4 product c5 println(c3.solve) + println(c32.solve) println(c6.solve) } } diff --git a/src/cp/Terms.scala b/src/cp/Terms.scala index 760f07b35f5ec5517c22686f7cfb5acaec63cf35..4ed19293c7389e926605e2e183adcc77afb276cd 100644 --- a/src/cp/Terms.scala +++ b/src/cp/Terms.scala @@ -249,49 +249,49 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : A1, x_1 : A2, x_2 : A3, x_3 : A4, x_4 : A5, x_5 : A6, x_6 : A7, x_7 : A8, x_8 : A9) => this.scalaFunction(other.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term2[T1,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term2[T1,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term2(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1) => this.scalaFunction(x_0) && other.scalaFunction(x_1), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars) } - def product4[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,A1,A2,A3,A4,Boolean] = { + def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,A1,A2,A3,A4,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars) } - def product5[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,A1,A2,A3,A4,A5,Boolean] = { + def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,A1,A2,A3,A4,A5,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars) } - def product6[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,A1,A2,A3,A4,A5,A6,Boolean] = { + def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,A1,A2,A3,A4,A5,A6,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product7[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,A1,A2,A3,A4,A5,A6,A7,Boolean] = { + def product[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,A1,A2,A3,A4,A5,A6,A7,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product8[A1,A2,A3,A4,A5,A6,A7,A8](other: Term8[A1,A2,A3,A4,A5,A6,A7,A8,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,A1,A2,A3,A4,A5,A6,A7,A8,Boolean] = { + def product[A1,A2,A3,A4,A5,A6,A7,A8](other: Term8[A1,A2,A3,A4,A5,A6,A7,A8,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,A1,A2,A3,A4,A5,A6,A7,A8,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7, x_8 : A8) => this.scalaFunction(x_0) && other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -404,43 +404,43 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : A1, x_2 : A2, x_3 : A3, x_4 : A4, x_5 : A5, x_6 : A6, x_7 : A7, x_8 : A8) => this.scalaFunction(x_0, other.scalaFunction(x_1, x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,T2,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term3[T1,T2,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term3(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars) } - def product4[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,A1,A2,A3,A4,Boolean] = { + def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,A1,A2,A3,A4,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars) } - def product5[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,A1,A2,A3,A4,A5,Boolean] = { + def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,A1,A2,A3,A4,A5,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product6[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,A1,A2,A3,A4,A5,A6,Boolean] = { + def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,A1,A2,A3,A4,A5,A6,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product7[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,A1,A2,A3,A4,A5,A6,A7,Boolean] = { + def product[A1,A2,A3,A4,A5,A6,A7](other: Term7[A1,A2,A3,A4,A5,A6,A7,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,A1,A2,A3,A4,A5,A6,A7,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6, x_8 : A7) => this.scalaFunction(x_0, x_1) && other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -578,37 +578,37 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : A1, x_3 : A2, x_4 : A3, x_5 : A4, x_6 : A5, x_7 : A6, x_8 : A7) => this.scalaFunction(x_0, x_1, other.scalaFunction(x_2, x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,T3,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term4[T1,T2,T3,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term4(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars) } - def product4[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,A1,A2,A3,A4,Boolean] = { + def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,A1,A2,A3,A4,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product5[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,A1,A2,A3,A4,A5,Boolean] = { + def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,A1,A2,A3,A4,A5,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product6[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,A1,A2,A3,A4,A5,A6,Boolean] = { + def product[A1,A2,A3,A4,A5,A6](other: Term6[A1,A2,A3,A4,A5,A6,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,A1,A2,A3,A4,A5,A6,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5, x_8 : A6) => this.scalaFunction(x_0, x_1, x_2) && other.scalaFunction(x_3, x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -761,31 +761,31 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : A1, x_4 : A2, x_5 : A3, x_6 : A4, x_7 : A5, x_8 : A6) => this.scalaFunction(x_0, x_1, x_2, other.scalaFunction(x_3, x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,T4,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term5[T1,T2,T3,T4,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term5(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product4[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,A1,A2,A3,A4,Boolean] = { + def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,A1,A2,A3,A4,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product5[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,A1,A2,A3,A4,A5,Boolean] = { + def product[A1,A2,A3,A4,A5](other: Term5[A1,A2,A3,A4,A5,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,A1,A2,A3,A4,A5,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4, x_8 : A5) => this.scalaFunction(x_0, x_1, x_2, x_3) && other.scalaFunction(x_4, x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -943,25 +943,25 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : A1, x_5 : A2, x_6 : A3, x_7 : A4, x_8 : A5) => this.scalaFunction(x_0, x_1, x_2, x_3, other.scalaFunction(x_4, x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,T5,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term6[T1,T2,T3,T4,T5,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term6(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product4[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,A1,A2,A3,A4,Boolean] = { + def product[A1,A2,A3,A4](other: Term4[A1,A2,A3,A4,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,A1,A2,A3,A4,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3, x_8 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4) && other.scalaFunction(x_5, x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -1114,19 +1114,19 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : A1, x_6 : A2, x_7 : A3, x_8 : A4) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, other.scalaFunction(x_5, x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,T6,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term7[T1,T2,T3,T4,T5,T6,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term7(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6, x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product3[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,A1,A2,A3,Boolean] = { + def product[A1,A2,A3](other: Term3[A1,A2,A3,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,A1,A2,A3,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2, x_8 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5) && other.scalaFunction(x_6, x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -1264,13 +1264,13 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : A1, x_7 : A2, x_8 : A3) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, other.scalaFunction(x_6, x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,T7,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term8[T1,T2,T3,T4,T5,T6,T7,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term8(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6) && other.scalaFunction(x_7), newTypes, this.converter, this.lVars ++ other.lVars) } - def product2[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,A1,A2,Boolean] = { + def product[A1,A2](other: Term2[A1,A2,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,A1,A2,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1, x_8 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6) && other.scalaFunction(x_7, x_8), newTypes, this.converter, this.lVars ++ other.lVars) } @@ -1383,7 +1383,7 @@ object Terms { Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : A1, x_8 : A2) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, other.scalaFunction(x_7, x_8)), newTypes, this.converter, this.lVars ++ other.lVars) } - def product1[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,T8,A1,Boolean] = { + def product[A1](other: Term1[A1,Boolean])(implicit isBoolean: R =:= Boolean): Term9[T1,T2,T3,T4,T5,T6,T7,T8,A1,Boolean] = { val (newExpr, newTypes) = Terms.product(this, other) Term9(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else (x_0 : T1, x_1 : T2, x_2 : T3, x_3 : T4, x_4 : T5, x_5 : T6, x_6 : T7, x_7 : T8, x_8 : A1) => this.scalaFunction(x_0, x_1, x_2, x_3, x_4, x_5, x_6, x_7) && other.scalaFunction(x_8), newTypes, this.converter, this.lVars ++ other.lVars) } diff --git a/src/cp/Utils.scala b/src/cp/Utils.scala index 072150ff99110aca9ef9f26bd4b88e4741d1873f..e4194e906960fede9f4672fc5b94a87ed778ff4f 100644 --- a/src/cp/Utils.scala +++ b/src/cp/Utils.scala @@ -98,11 +98,11 @@ object Utils { val scalaFunction = "(%s) => %s && %s" format (scalaFunctionParamsString, thisApplication, otherApplication) val methodString = -"""def product%d[%s](other: Term%d[%s])(implicit isBoolean: R =:= Boolean): Term%d[%s] = { +"""def product[%s](other: Term%d[%s])(implicit isBoolean: R =:= Boolean): Term%d[%s] = { val (newExpr, newTypes) = Terms.product(this, other) Term%d(this.program, newExpr, if (this.scalaFunction == null || other.scalaFunction == null) null else %s, newTypes, this.converter, this.lVars ++ other.lVars) } -""" format (otherArity, otherParamsString, otherArity, otherTermParamsString, productArity, resultTermParamsString, productArity, scalaFunction) +""" format (otherParamsString, otherArity, otherTermParamsString, productArity, resultTermParamsString, productArity, scalaFunction) methodString }).mkString("\n\n")