// Souffle - A Datalog Compiler
// Copyright (c) 2018, The Souffle Developers. All rights reserved
// Licensed under the Universal Permissive License v 1.0 as shown at:
// - https://opensource.org/licenses/UPL
// - <souffle root>/licenses/SOUFFLE-UPL.txt

// Program Minimisation 1
// Checks if basic clause equivalence works.

.decl A(x:number, y:number)
// all of these should be equivalent
A(x,y) :- B(x,z), C(z,y).
A(a,b) :- B(a,c), C(c,b).
A(x,y) :- B(x,z), C(z,y).
A(x,y) :- C(z,y), B(x,z).
A(x,y) :- B(x,z), C(z,y).
A(x,y) :- B(x,z), C(z,y).

.decl B(x:number, y:number)
B(0,0).
B(0,0).
B(0,0).
B(1,1).
B(1,2).
B(2,1).
B(1,0) :- B(0,x), C(x,y), D(y,x).
B(1,0) :- B(z,x), z = 0, C(x,y), D(y,x).

.decl C(x:number, y:number)
C(0,0).

.decl D(x:number, y:number)
D(0,0).

.output A()
.output B()
