This is very cool :tada:
Did anyone make a jscoq version of the terse files in SF?
Hi! In fact I did make such a version but did not upload it to the website yet — it has not been tested sufficiently, or at all. Are you interested in trying it?
BTW the most updated version is at https://coq.vercel.app/ext/sf/, which also includes VFA and SLF. The main github.io page already redirects there, but the subdirectories do not, so we should probably fix that.
@Shachar Itzhaky Yes, I'd be happy to test it.
Great to hear -- I will upload a version and let you know. Cheers.
@Bas Spitters I have set up a terse version of LF here: https://coq-next.vercel.app/ext/sf/lf/terse/toc.html
The page alignment is a bit wonky somehow, but it's otherwise operational. One important note: in slides mode, the default in SF is to go forward/backward using the arrow keys. This is awkward when you also have an editor on the slide. So I have changed it to use PgUp/PgDn when jsCoq is enabled. There is still some weird interaction between switching slides and jsCoq's focus when evaluating sentences. I have not figured out a consistent way to handle this, would love to hear what you think.
That's beautiful :love:
One small issue I noticed was that after entering into an interactive session on a slide, when one presses page-down, then the text does not show up at the top of the page. This is easy to fix though by going back and forward.
hmm I have not noticed that, but that is entirely possible. Scrolling is a daunting issue in these interactive documents.
This is so cool !
There's a minor issue with a spoiler here. It's one of the few places where SF actually uses an interactive session to answer a quiz. This would be very useful in general, and probably SF should be changed a little.
This solution which folds the answer is great:
I have uploaded PLF terse as well. I now see what you meant: if the cursor is in the editor area, normal browser scrolling kicks in when PgDn is pressed instead of SF's hooks. This is weird. I will have to debug it in depth.
Do you know what's happening with the spoilers?
@Shachar Itzhaky about the spoilers. I guess the FOLD keyword is not supported.
Would it be hard to add?
Thanks for pointing me towards an instance where the spoilers occur. Yes, the FOLD directive is translated into some HTML+JS that controls the folding, but that probably gets lost when inserting the CodeMirror widget because it converts to plain text first. CodeMirror does have a folding plugin; let me see how hard it might be to preserve the folds that way.
Ok seems like in the particular use case of the quiz, the entire snippet is in FOLD. In this case it is easy to hack something to show/hide the CodeMirror. I have done that, will let you check it out soon.
Here, take a look: https://coq-p-wr.vercel.app/ext/sf/lf/terse/Logic.html#slide-35
Very nice. Thanks for fixing that!
The folded solution does not animate as a Coq script. Not sure whether that's intended.
I was actually on the fence here. It occurs inside a QUIZ environment. I sort of made an executive decision that only top-level snippets become editable and runnable. WDYT?
I don't see a reason not to make them editable. They are easy to skip, and sometimes it is nice to have the opportunity to elaborate a bit on a quiz, in that case runnable code is good.
Alright! That would be an easy change.
There are too many empty lines here:
Is this a jscoq issue, or an SF issue?
Similarly. Empty line missing here:
Thanks. This clearly needs some more systematic treatment. There is some ad-hoc logic that transforms the coqdoc-generated HTML back to source code, which is is need of revision (or replacement?). It's good to have a list of such inconsistent locations. I guess accumulating them here is as good a place as any :squid:
BTW. You're including quite a few dependencies when displaying LF,
which appears to be unnecessary. I'm not entirely sure where they come
from, but one could imagine cleaning them up.
Perhaps with Jason's tool for dependency analysis.
Another nit. There are a couple of empty pages here:
@Shachar Itzhaky Some more:
wants some line breaks
If this is an SF problem that I can fix easily, I can send a PR to the sfdev repo.
@Bas Spitters This week I will make a short doc for how to build your own version of the jsCoq-ified pages, then perhaps we can investigate this together. As for the deps, I'm afraid
String and that has a world of deps lurking. I did not find any way around that, but I'm open to suggestions.
About the dpes, I believe I saw real numbers coming by. I don't think they'd be needed.
The load time is not too bad, though, so I'm not sure it's worth the effort.
It's definitely annoying for slow internet connections (like my home ISP bleh). But for consecutive loads it will be cached, so that's only half bad.
jsCoq does use coqdep to determine the dependencies. So the reals are, in fact, needed; unless there is a bug in my coqdep clone.
Indeed reals are pulled in by the arithmetic tactics [lia, etc...] which are used in String to do some proofs.
Alright @Bas Spitters, here is a first draft of the instructions:
Quickchick removed the dependency on perl. This was a problem for installation on Windows, it looks like the same problem showed up in jscoq. So, @Shachar Itzhaky this may simplify your experiments. (I'm done with my teaching for this year.)
Thanks! I believe we got around this in the past because @Emilio Jesús Gallego Arias made a Dune build for QuickChick. The problem I encountered was when trying to compile the QC volume of SF, naturally some of the chapters invoke QuickChick for the purpose of performing some property-based testing, and such invocation involves running
ocamlc at some point. I should investigate it some more.
Oh indeed having to run OCaml is a problem, tho I hope that in the medium term Coq can provide an API similar to Isabelle's
to call managed external processes such as smt's or OCaml
jsoo can indeed compile code on the fly and run it, but it is far from trivial :S
not so complex on the technical sense, but more like annoying to setup the whole stuff
In the wasm port it is actually not so hard to invoke ocamlc as a subprocess. waCoq already depends on wasi-kernel and I have previously been able to run
ocamlc as well as the OCaml REPL on top of it. Here, too, it is mostly a matter of collecting all the ingredients and mixing them up correctly :)
@Shachar Itzhaky Just a heads up. Now versions of the SF books are available now (the QC is coming soon I understand).
You may want to update the corresponding jscoq pages at some point.
Yes I started updating @ coq-next.now.sh/ext/sf, but then I saw that pushes are still being made :) Thanks for the reminder
Last updated: Jun 10 2023 at 06:31 UTC