// Souffle - A Datalog Compiler
// Copyright (c) 2017, 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

// Inlining is very effective here, as it avoids needing to compute the
// 10000^2 tuples for nat_pair.

.decl nat(x:number)
nat(0).
nat(x+1) :- x < 10000, nat(x).

.decl nat_pair(x:number, y:number) inline
nat_pair(x, y) :- nat(x), nat(y).

.decl query(x:number)
query(x) :- nat_pair(x, x), x < 2.

.output query()


