bosphorus icon indicating copy to clipboard operation
bosphorus copied to clipboard

Added the use of variable names other than 'x'

Open mocenigo opened this issue 9 months ago • 12 comments

As the name says, I added the use of variable names other than 'x'. Any letter except 'c' and 'p' can be used. I am also skipping underscores so a(2), a2, and a_2 should be equivalent,

Clauses that begin like q_0 = a_xb_x should be equivalent to q_0 + a_xb_x , unless I have misunderstood the syntax.

Finally, I outout a ".resolve" file that explains the correspondences between variables and numbers.

Note that at the moment I am adding 2 to the variable count because I am leaving "0 signifies 0" and "1 signifies 1" that the Courtois converter generated. If these are actually not used/needed, I can amend it.

mocenigo avatar Apr 05 '25 17:04 mocenigo

Thanks, looks nice! I'll review tomorrow, but it looks good to me :)

msoos avatar Apr 05 '25 20:04 msoos

Hi,

I have now made the GitHub actions work, and build a binary for linux amd64 and arm64, and mac arm64. It now also runs a test suite. You can find the tests under tests/anf-tests -- they specify what needs to run and what the output should mostly look like. It's a very simple system. Please check it out and adjust your PR to match them. Sorry for the system being in such a sorry state before. With this change, I think your PR will also be a lot more impactful, as Bosphorus will finally be available for different architectures, etc.

Once your PR is merged, I will create a new release, and attach the auto-generated binaries, e.g. the ones at the bottom of this page here:

https://github.com/meelgroup/bosphorus/actions/runs/14292531540

but of course after your PR is merged.

Sorry for this delay. I worked on this for a few hours, so hopefully it'll now be a lot easier to release things and to build them for different target architectures.

Mate

msoos avatar Apr 06 '25 12:04 msoos

HI, I am not sure what you mean by "Please check it out and adjust your PR to match them" (them = the tests).

mocenigo avatar Apr 06 '25 13:04 mocenigo

Hi! I just meant that I saw you added some test cases -- I was just trying to ask you to adjust your test cases to the pattern that's in that directory. I think it should be easy, but let me know if you have any trouble! Thank you a lot!

msoos avatar Apr 06 '25 15:04 msoos

Hi! I just meant that I saw you added some test cases -- I was just trying to ask you to adjust your test cases to the pattern that's in that directory. I think it should be easy, but let me know if you have any trouble! Thank you a lot!

Oh, interesting, I am not sure how those ended up there. I may have mixed up things. They seem to be all tests that were in this repo previously (at leat last year). I however pulled the latest before branching for my changes, so they must be yours.

mocenigo avatar Apr 06 '25 18:04 mocenigo

bosphorus --anfread substitute_carefully.anf --cnfwrite substitute_carefully.cnf crashes: libc++abi: terminating due to uncaught exception of type polybori::PBoRiError: Variable index out of bounds. (but also the master from your repo, I think)

FOUND the issue in ANF::readFileForMaxVar — need to handle ()_ better.

mocenigo avatar Apr 06 '25 18:04 mocenigo

Let’s not make it work for special characters :) Instead, let’s emit an error of that happens.

On Mon 7. Apr 2025 at 11:35, mocenigo @.***> wrote:

@.**** commented on this pull request.

In src/anf.cpp https://github.com/meelgroup/bosphorus/pull/48#discussion_r2030860509:

}

size_t ANF::readFile(const std::string& filename) { // Read in the file line by line vectorstd::string text_file;

  • size_t maxes[26] = {0};

I was assuming that only a-z and A-Z can be used, but in this case I am also making assumptions on their encoding (ASCII). Maybe using tolower and a std::is better, so people can also use ö or δ. Why not?

— Reply to this email directly, view it on GitHub https://github.com/meelgroup/bosphorus/pull/48#discussion_r2030860509, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAKF4ON7IZKYFFS7JH5BAS32YJBHNAVCNFSM6AAAAAB2QWYMCKVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDONBWGE4DCNRZG4 . You are receiving this because you commented.Message ID: @.***>

msoos avatar Apr 07 '25 09:04 msoos

Let’s not make it work for special characters :) Instead, let’s emit an error of that happens.

Anyway, since there are then 26 characters (up to lower case/upper case equivalence) I would keep the array of 26 values. note that I am keeping counts of the variables and already adding +1 there, so I removed this addition from bosphorus.cpp .

Omitting "c" and "p" means that there are only 24 valid characters, I am not sure that allowing "C" and "P" are good ideas, so I am not allowing them. This means that their maxes counters will remain zero.

mocenigo avatar Apr 07 '25 09:04 mocenigo

HI @msoos it is not clear to me what I should change. Since we only use latin alphabet letters for the variables, the 26-element array for the counts is sufficient, I have decuded to keep it and I have added a comment. I ran some tests, and added a test using a "ü" — what else should I do?

mocenigo avatar Apr 09 '25 20:04 mocenigo

Can't seem to be able to rebase to remove those ANF and CNF and RESOLVE files. Can you please remove them from your PR?

msoos avatar Apr 10 '25 21:04 msoos

Sorry, I did not have time to work on this today. I will try and find time tomorrow.

On 10. Apr 2025, at 23:02, Mate Soos @.***> wrote:

msoos left a comment (meelgroup/bosphorus#48) Can't seem to be able to rebase to remove those ANF and CNF and RESOLVE files. Can you please remove them from your PR?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.

https://github.com/meelgroup/bosphorus/pull/48#issuecomment-2795159903 https://github.com/notifications/unsubscribe-auth/ABFK7QOHW57I6VEP4GUUXLD2Y3L57AVCNFSM6AAAAAB2QWYMCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGE2TSOJQGM

msoos left a comment (meelgroup/bosphorus#48) https://github.com/meelgroup/bosphorus/pull/48#issuecomment-2795159903 Can't seem to be able to rebase to remove those ANF and CNF and RESOLVE files. Can you please remove them from your PR?

— Reply to this email directly, view it on GitHub https://github.com/meelgroup/bosphorus/pull/48#issuecomment-2795159903, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABFK7QOHW57I6VEP4GUUXLD2Y3L57AVCNFSM6AAAAAB2QWYMCKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDOOJVGE2TSOJQGM. You are receiving this because you authored the thread.

mocenigo avatar Apr 11 '25 23:04 mocenigo

I have now made the GitHub actions work, and build a binary for linux amd64 and arm64, and mac arm64. It now also runs a test suite. You can find the tests under tests/anf-tests -- they specify what needs to run and what the output should mostly look like. It's a very simple system. Please check it out and adjust your PR to match them. Sorry for the system being in such a sorry state before. With this change, I think your PR will also be a lot more impactful, as Bosphorus will finally be available for different architectures, etc.

Sadly, I do not understand how the test system works. Anyway, I changed the name of the "maxes" array and used the vector<uint32_t> you suggested instead. I changed the ending of the "resolve" files to mapping, so that one can used them to map back to the original variables.

mocenigo avatar May 04 '25 13:05 mocenigo