Skip to content

Monadic translator lib fixes#1346

Closed
talsewell wants to merge 2 commits intoCakeML:masterfrom
talsewell:monadic-translator-lib-fixes
Closed

Monadic translator lib fixes#1346
talsewell wants to merge 2 commits intoCakeML:masterfrom
talsewell:monadic-translator-lib-fixes

Conversation

@talsewell
Copy link
Copy Markdown
Contributor

Some fixes to the monadic translator libs to be a little less fragile.

It seems that the examples still run and some corner cases are fixed, to my initial test. Let's see what the regression thinks.

The existing monadic-translator interface code does a bit of guessing of
various constant names, and needs to set the translator use_full_type_names
setting to false to make the naming predictable enough. This makes the monadic
translator incompatible with various translation contexts.

Some of this code can be replaced by use of get_type_inv and other query
functions to fetch the relevant constants. This seems to allow the monadic
translator to run with use_full_type_names present, and doesn't seem to break
anything.
The monadic translator code uses parsing to set up quite a few terms, some of
which were never added to a Syntax library, some of which were. This seems to
make the system fragile in scenarios where an Ancestor include set (or explicit
set_grammar_ancestry) hasn't included all the expected constants.

Replace most of them with use of relevant Syntax lib or term poked from a def
theorem or similar. Doesn't seem to break anything, and gets me a couple of
steps further into an experiment (which is still incomplete and not ready to be
a selftest).
@talsewell
Copy link
Copy Markdown
Contributor Author

Fails, and the same failure is present on my list-sort branch/PR. Will close this and try to fix it there.

@talsewell talsewell closed this Mar 4, 2026
@tanyongkiam
Copy link
Copy Markdown
Contributor

Is this superseded by #1348 ?

@talsewell
Copy link
Copy Markdown
Contributor Author

Yeah, whatever is broken also affects #1348 , so I'll try to fix them together.

@talsewell
Copy link
Copy Markdown
Contributor Author

Oh, sorry, I misread which one you were talking about. There was a bug in my actual changes here that I've fixed in #1349 . Meanwhile Ramana and/or an AI has re-discovered and/or superseded a lot of my parser fixes in #1348 .

In either case this PR gets retired. Probably #1348 and #1349 will conflict with each other and I or the AI will need to do some merge-conflict-squashing, but that's no big deal.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants