This query demonstrates visually the nature and application of approximation. Assuming Scot didn't delete it he has the presentation to go with it: Approximation Theory and Motivation Presentation.ppt.
begin%Boxes% Choice(m,n) :- m=0, n=0. Choice(m,n) :- m=0, n=1. Choice(m,n) :- m=0, n=2. Choice(m,n) :- m=1, n=0. Choice(m,n) :- m=1, n=2. Choice(m,n) :- m=2, n=0. Choice(m,n) :- m=2, n=1. Choice(m,n) :- m=2, n=2. D(x,y,z) :- x-y=0, z=0. D(x,y,z) :- D(x1,y,z1), x-x1=1, z-z1=1. M(x,y,z) :- x=0, y=0, z=0. M(x,y,z) :- M(x1,y,z1), D(z,z1,y), x-x1=1. M(x,y,z) :- M(x,y1,z1), D(z,z1,x), y-y1=1. /* Creates the first set of base lines length=1,3,9... */ BaseLine(x1,x2):- x1=0, x2=1. BaseLine(a1,d3):- BaseLine(a1,d1), l=3, M(l,d1,d3). Box(x,y,s) :- BaseLine(x,b), y-x=0, b-s=0. Box(x,y,s) :- Box(a,b,l), k=3, M(k,s,l), Choice(m,n), M(s,m,z1), D(x,a,z1), M(s,n,z2), D(y,b,z2). XBox(a1,c1,s) :- Box(a,c,l), k=3, M(k,s,l), D(a1,a,s), D(c1,c,s). fractal1(id,x,y) :- id=1, Box(a,b,l), x-a>=0, D(x1,l,a), x-x1<=0, y-b>=0, D(y1,l,b), y-y1<=0. fractal2(id,x,y) :- id=2, XBox(a,b,l), x-a>=0, D(x1,l,a), x-x1<=0, y-b>=0, D(y1,l,b), y-y1<=0. end%Boxes%