Added Query#dup and Pattern#dup so that dupliating a query keeps patterns and solutions distinct.