Synthesizing nested relational queries from implicit specifications: via model theory and via proof theory (Logical Methods in Computer Science, 2024)