This demo was created by combining three parts:
A GF grammar for math queries. (Abstract syntax: Query.gf and MathQuery.gf, concrete syntax for English: QueryEng.gf and MathQueryEng.gf.) The grammar covers a small set of properties of numbers (smaller than, greater than, even, odd, prime, divisibility), conjunction, disjunction, negation, and quantification (all, any). You can ask if a property holds, for which numbers a property holds or for how many numbers a property holds. Examples:
A Haskell program (Answer.hs and generated by GF: MathQuery.hs) that interprets the queries and computes answers. To ensure termination, only a finite subset of the natural numbers is considered (currently [0..1000]). This also means that some questions have surprising answers (e.g. which numbers are greater than all prime numbers).
JavaScript components from the Minibar for guided input of queries. The parts are combined and initialized in answer.js.