loda-cpp icon indicating copy to clipboard operation
loda-cpp copied to clipboard

Support multi-line PARI formulas for multiple functions

Open Copilot opened this issue 4 months ago • 0 comments

PARI/GP formula generation now outputs multiple functions on separate lines, matching the existing LEAN formatter behavior.

Changes

  • src/form/pari.cpp: Modified PariFormula::toString() to detect multiple functions via FormulaUtil::getDefinitions() and format them with newline separators instead of semicolons
  • tests/formula/pari-function.txt: Updated test expectations for A000058 and A001715 to reflect multi-line output format

Example

Before:

(a(n) = b(n)+1); (b(n) = if(n==0,1,local(l1=b(n-1)); l1*(l1+1)))

After:

a(n) = b(n)+1
b(n) = if(n==0,1,local(l1=b(n-1)); l1*(l1+1))

Single-function formulas remain unchanged on a single line.

Original prompt

This section details on the original issue you should resolve

<issue_title>Multi-line PARI formulas</issue_title> <issue_description>Similarly to the LEAN formula generation, it would be nice to split the generated formula code for PARI/GP into multiple lines if there are multiple functions.</issue_description>

Comments on the Issue (you are @copilot in this section)

  • Fixes loda-lang/loda-cpp#581

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot avatar Nov 05 '25 19:11 Copilot