siddhartha-gadgil / LeanAide

Tools based on AI for helping with Lean 4
Apache License 2.0
65 stars 5 forks source link

Re structure #20

Closed 0art0 closed 1 year ago

0art0 commented 1 year ago

New code for easily modifying parameters.

siddhartha-gadgil commented 1 year ago

I was looking at the code and I see that in some places while reading from Json the kind is hard-wired as "theorem". This is fine but it should be clear when to have this and when to read the kind. Perhaps two different functions, or an argument?

Or is this work in progress?

0art0 commented 1 year ago

Thanks. I have modified the code to get the kind to match the one specified in the Request.

siddhartha-gadgil commented 1 year ago

@0art0 Do you handle both these cases (which we need)?

Which choice is made should be part of the configuration.

0art0 commented 1 year ago

I am reading in the kind by default. I have not handled the safe_prompts case, but I am thinking of regenerating the file to add a kind := "theorem" field to keep the Lean4 code more uniform.

siddhartha-gadgil commented 1 year ago

I am reading in the kind by default. I have not handled the safe_prompts case, but I am thinking of regenerating the file to add a kind := "theorem" field to keep the Lean4 code more uniform.

That is a good option too. Do make sure while regenerating that you preserve the unicode (i.e., not escaped) and the lines. Also please regenerate prompts.json as well, so refiltering does not break the code

0art0 commented 1 year ago

I have regenerated both sets of prompts with the kind field (the spacing and indentation is a bit distorted, but the content and the Unicode is intact).

0art0 commented 1 year ago

I am in the process of making a few more superficial changes to the structures. I will push my code shortly.

siddhartha-gadgil commented 1 year ago

@0art0 I pulled the code and it is repeatedly giving panic messages. This seems to be that in CodeActions.lean there are two instances of .get! which assume that we can get a comment and a theorem. Instead the CodeAction should fail gracefully (maybe go to a default value for now).

0art0 commented 1 year ago

I am actually not using CodeActions.lean on this branch. The main file that I am using for testing is StatementAutoformalisation/Experiment.lean (which does not yet have an interface implemented).

siddhartha-gadgil commented 1 year ago

I am actually not using CodeActions.lean on this branch. The main file that I am using for testing is StatementAutoformalisation/Experiment.lean (which does not yet have an interface implemented).

The interface we expect to use in the longer run is CodeActions, so please test the examples in TranslateExamples.lean as you develop.

siddhartha-gadgil commented 1 year ago

@0art0 The errors were due to "informalize", which I have commented out. If it seems fine with you I plan to merge this.

I want to make a "mathlib4" branch getting rid of the binport dependency but for now using the same data for prompting and auto-correction. It is better to merge this first.

0art0 commented 1 year ago

I would like to also create an abstract configuration for handling the code action interface for both formalisation and informalisation.

siddhartha-gadgil commented 1 year ago

If you think it is better to do that before mergiing, I can wait. Otherwise I can merge to main and you can continue to use this as a feature branch to develop further and make a fresh PR.

0art0 commented 1 year ago

I think merging is fine.