Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian...

25
Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26

Transcript of Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian...

Page 1: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Finding Conjugate Orthogonal Diagonal Latin Squares Using

Finite Model Generators

Hantao ZhangJian Zhang

2012-10-26

Page 2: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Outline

• Introduction (Latin squares, SAT, finite models)

• Concepts and Definitions -- Conjugate Orthogonal Diagonal Latin

Squares

• Solution of an Open Case -- formalization in first-order logic

• Conclusion

Page 3: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Introduction

Page 4: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Latin square problems

• Latin squares (quasigroups) 1 2 3 0 1 2

3 1 2 2 0 1

2 3 1 1 2 0

• Challenging problems in mathematics– Counting problem– Existence of Latin squares with certain properties, e.g.,

Mutually orthogonal Latin squares (MOLS)

Page 5: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Orthogonal Latin squares

A pair of latin squares A=(aij) and B=(bij) are orthogonal ( A ┴ B) iff the ordered pairs (aij,bij) are distinct for all i and j

A ┴ AT      

The pairs (aij,atij) are

(0,0) (2,3) (3,1) (1,2)(3,2) (1,1) (0,3) (2,0)(1,3) (3,0) (2,2) (0,1)(2,1) (0,2) (1,0) (3,3)

Page 6: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Solving Latin square problems with computers

• Computer-aided research in combinatorics– existence of small Latin squares – crucial !

• Clement Lam and other mathematicians

• AI researchers (using CSP / SAT / …)– Jian Zhang (1990/1991)– M. Fujita, J. Slaney, M. Stickel (IJCAI-1993, 1995)– Hantao Zhang, W. McCune, …– C. Gomes, O. Dubois and G. Dequen, …

Page 7: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

SAT

• Given a formula in the propositional logic, decide whether it is satisfiable or not.

(p ┐q) (q ┐p)∨ ∧ ∨ satisfiable: p = TRUE, q = TRUE.

• Many problems can be transformed into SAT.

• Tools (SAT solvers):

SATO (1997), zChaff (2001), minisat (2005), …

Page 8: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Finite model generation/searching

• Given a formula in the first-order logic, decide whether it is satisfiable or not in a fixed finite domain ([0, 1, …, n-1]).

forall x,y,z: y≠z f(x,y) ≠f(x,z)

forall x,y,z: x≠z f(x,y) ≠f(z,y)

• Tools (finite model generators): Finder (~1994), SEM (1995), Mace4 (~2003), …

Page 9: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

• SEM input: 3.

y = z | f(x,y) != f(x,z).

x = z | f(x,y) != f(z,y).

• SEM output:

f | 0 1 2

|

0 | 0 1 2

1 | 1 2 0

2 | 2 0 1

Page 10: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Mace4 Input for qg5.8

assign(domain_size, 8). % clear(negprop). set(verbose).

clauses(theory). x * z != y * z | x = y. x * y != x * z | y = z. x * x = x. (((y * x) * y) * y) = x. end_of_list.

Page 11: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Mace4 Output for qg5.8

interpretation( 8, [number=1, seconds=0],

[ function(*(_,_), [ 0, 2, 6, 5, 1, 4, 7, 3, 7, 1, 5, 6, 2, 3, 0, 4, 3, 6, 2, 1, 5, 7, 4, 0, 1, 7, 4, 3, 0, 6, 2, 5, 6, 3, 0, 7, 4, 1, 5, 2, 2, 0, 3, 4, 7, 5, 1, 6, 5, 4, 7, 0, 3, 2, 6, 1, 4, 5, 1, 2, 6, 0, 3, 7 ]) ]).

Page 12: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Concepts and Definitions

Page 13: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

• transversal in a Latin square: a set of positions, one per row and one per column, among which the elements {0, 1, …, n-1} occur exactly once each.

• diagonal Latin square -- main diagonal is a transversal; back diagonal is also a transversal.

• The following is a DLS:

0 2 3 1

3 1 0 2

1 3 2 0

2 0 1 3

Page 14: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Conjugates

• Given a Latin square defined by f(x,y), we may obtain its conjugates in the following way:

• f123(x,y) = z;

• f132(x,z) = y;

• f213(y,x) = z;

• f231(y,z) = x;

• f312(z,x) = y;

• f321(z,y) = x.

Page 15: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

• LS (2;1;3)-cjg (3;2;1)-cjg

1 4 2 3 1 2 4 3 1 3 2 4

2 3 1 4 4 3 1 2 2 4 1 3

4 1 3 2 2 1 3 4 4 2 3 1

3 2 4 1 3 4 2 1 3 1 4 2

• (2;3;1)-cjg (1;3;2)-cjg (3;1;2)-cjg

1 2 4 3 1 3 4 2 1 3 2 4

3 4 2 1 3 1 2 4 3 1 4 2

2 1 3 4 2 4 3 1 4 2 3 1

4 3 1 2 4 2 1 3 2 4 1 3

Page 16: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Latin square with a hole

Given a symbol set S and a subset H of S. If a Latin square L satisfies the following equations

forall x,y,z: y≠z f(x,y) ≠f(x,z)

forall x,y,z: y≠z f(y,x) ≠f(z,x)

other than (x,y), (x,z), (y,x), (z,x) in H2

we say L is a Latin square with the hole H.

Example:

S = { 0, 1, …, 7 }

H = { 3, 4}

0 7 5 6 2 3 4 1 7 1 6 5 0 4 2 3 5 6 2 7 1 0 3 4 2 0 1 6 7 5 1 2 0 7 5 6 4 3 7 0 6 5 1 2 3 5 4 2 7 1 6 0 6 4 3 1 5 2 0 7

Page 17: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

An Open Problem

Given integers v and n, let ICODLS(v, n) denote a pair of orthogonal Latin squares (A, B) of order v with a hole of size n, where B is the (3,2,1)-conjugate of A; both A and B are diagonal.

We knew the existence of ICODLS(v, n) for all possible feasible values, except possibly (n, v) = (11, 3).

0 7 5 6 2 3 4 1 7 1 6 5 0 4 2 3 5 6 2 7 1 0 3 4 2 0 1 6 7 5 1 2 0 7 5 6 4 3 7 0 6 5 1 2 3 5 4 2 7 1 6 0 6 4 3 1 5 2 0 7

Example: ICODLS(8, 2)

A

0 3 4 5 1 2 7 6 4 1 3 7 2 6 5 0 3 4 2 6 0 7 1 5 6 5 7 0 2 1 5 7 6 1 0 2 2 6 0 1 7 5 4 3 7 2 1 0 5 3 6 4 1 0 5 2 6 4 3 7

B

Page 18: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Solution of an Open Case

Page 19: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

First Order Logic Formulas

Latin Square Constraints:A(x,y) = A(x,z) → y = zA(x,y) = A(z,y) → x = z 

A┴B:A(x1,y1)=A(x2,y2) B(x∧ 1,y1)=B(x2,y2) → x1=x2 y∧ 1=y2

Latin Square Constraints with a hole:(A(x,y) = A(x,z) → y = z) \/ h(x,y) \/ h(x,z)(A(x,y) = A(z,y) → x = z) \/ h(x,y) \/ h(z,y)

A┴B:(A(x1,y1)=A(x2,y2) B(x∧ 1,y1)=B(x2,y2) → x1=x2 y∧ 1=y2) \/ h(x1,y1) \/ h(x2,y2)

Page 20: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Finding the ICODLS with SAT solvers

• Generating propositional formulas: Introduce boolean variables Vijk (i,j,k  [0, n-1])∈ Vijk = 1 iff A(i,j) = k Vijk = 0 iff A(i,j) ≠ k

• Using SAT solvers (minisat, Glucose)

not completed (> two weeks)

Page 21: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Mace4 inputset(arithmetic). assign(domain_size, 11). assign(selection_order, 2). op(400, infix, [@,g,f]). formulas(theory). % define hole h(4,4). h(4,5). h(4,6). h(5,5). h(5,6). h(6,6). -h(y,x) | h(x,y). -h(x,y) | x = 4 | x = 5 | x = 6. -h(y,x) | x = 4 | x = 5 | x = 6. x @ y != z | -h(x,z). x @ y != z | -h(y,z).

Page 22: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Mace4 input(cont.)

% define main and back diagonals x = y | (x @ x) != (y @ y) | h(x,x) | h(y,y). x = y | (x @ SUB(10, x)) != (y @ SUB(10, y)) | h(x,SUB(10,x)) | h(y, SUB(10, y)). x = y | z @ x != x | z @ y != y | h(z,x) | h(z,y). x = y | z @ SUB(10, x) != x | z @ SUB(10, y) != y | h(x,SUB(10,x)) | h(y, SUB(10, y)). % quasigroup axioms (equational) x @ (x g y) = y | h(x,y). x g (x @ y) = y | h(x,y). (x f y) @ y = x | h(x,y). (x @ y) f y = x | h(x,y). % Orthogonal to its (3,2,1)-conjugate (u @ y) @ y != (u @ w) @ w | y = w | h(u,y) | h(u,w) | h(w,y). end_of_list.

Page 23: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Mace4 Output======== DOMAIN SIZE 11============ ======== MODEL =================== interpretation( 11, [number=1, seconds=1154566], [ function(@(_,_), [ 3, 9, 2, 5, 7, 8, 0,10, 6, 4, 1, 0, 2, 9, 6, 8, 7, 1, 3, 4,10, 5, 8, 4, 7, 3,10, 1, 2, 5, 9, 6, 0, 4, 6, 5,10, 9, 0, 3, 2, 8, 1, 7, 9, 0,10, 8, 0, 0, 0, 1, 7, 3, 2, 1,10, 0, 2, 0, 0, 0, 9, 3, 7, 8, 2, 7, 1, 9, 0, 0, 0, 0,10, 8, 3, 5, 3, 4, 0, 1,10, 7, 8, 2, 9, 6, 6, 5, 3, 7, 0, 9, 8, 4, 1, 2,10, 10, 8, 6, 1, 2, 3, 9, 7, 5, 0, 4, 7, 1, 8, 4, 3, 2,10, 6, 0, 5, 9 ]), … …

Page 24: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Conclusion

We solved an open case: existence of (3, 2, 1)-ICODLS(11, 3) .

We presented the formalization of the problem in FOL.

Other cases remain open: e.g., the existence of (3, 2, 1)-CODLS(10), …

Challenging benchmarks for constraint solving, SAT solving and finite model generation.

Page 25: Finding Conjugate Orthogonal Diagonal Latin Squares Using Finite Model Generators Hantao Zhang Jian Zhang 2012-10-26.

Thank you!