// Souffle - A Datalog Compiler
// Copyright (c) 2016, Oracle and/or its affiliates. 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

// tests the proper handling of aliases

.type N <: number


.decl n ( a : N )

n(1).
n(2).
n(3).
n(4).
n(5).

.decl p ( a : N , b : N )
.output p ()
p(x,y) :- n(x), x = y.


.decl a ( a : N, b : N )

a(1,2).
a(2,2).
a(3,2).

.decl r ( a : N )
.output r ()
r(z) :- a(x,y), r = [x,y], s = r, s = [v,w], w=z, z=v.

