Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enigma example in "Programming Cryptol" needs to be updated #1745

Open
smithdtyler opened this issue Sep 4, 2024 · 2 comments
Open

Enigma example in "Programming Cryptol" needs to be updated #1745

smithdtyler opened this issue Sep 4, 2024 · 2 comments
Labels
book The "Programming in Cryptol" book docs LaTeX, markdown, literate haskell, or in-REPL documentation

Comments

@smithdtyler
Copy link

In section 3.2, the call to elem in mkRotor is incorrect, as elem does not take a tuple.

mkRotor : {n} (fin n) => (Permutation, String n) -> Rotor
mkRotor (perm, notchLocations) = [ (p, elem (p, notchLocations))
| p <- perm
]

Should be

mkRotor (perm, notchLocations) = [ (p, elem p notchLocations)
                                | p <- perm
                                ]
@RyanGlScott RyanGlScott added the docs LaTeX, markdown, literate haskell, or in-REPL documentation label Sep 4, 2024
@sauclovian-g
Copy link
Contributor

It's more complicated than that since this elem is a private definition (see line 762 of Enigma.tex for the copy that's used here) so one should change not just this usage, but also that definition and also the real one elsewhere in the book that the comment about an exercise refers to. And there are other references scattered around the book, some of which use one signature and some the other, and they should probably all be updated as well.

Is there any reason that one would deliberately use a different type signature for the exercise version? Or is it all just Olde?

@RyanGlScott RyanGlScott added the book The "Programming in Cryptol" book label Sep 9, 2024
@yav
Copy link
Member

yav commented Oct 28, 2024

I think in old Cryptol things used to take tuples as arguments more often, because a long time ago there was an idea that maybe Cryptol could kind of look like C. So, quite likely, this falls directly in the "olde" category.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
book The "Programming in Cryptol" book docs LaTeX, markdown, literate haskell, or in-REPL documentation
Projects
None yet
Development

No branches or pull requests

4 participants