`find_theorems` in the AFP - isabelle

How can I use the find_theorems mechanism to search the whole Archive of Formal Proofs (AFP)?
I have downloaded the archive to my machine, and I am able to import theories from it. For instance, if I write imports Kleene_Algebra.Kleene_Algebra_Models then all the theorems in that theory are successfully made available to me. But if I then type find_theorems <expression>, I only get search results from the specific theory I imported. What if I want to search the whole archive? For instance, perhaps somebody has proved a theorem that is useful to me, but I don't know what they called their theory.

find_theorems only works with the loaded theories. You can use any text search tool if you have an idea of the theorem name. On macOS, the Splotlight Search (cmd + space) can be useful.

To put it plain and simple, you can't, unless you import the entirety of the AFP into your theory (which probably won't work).
I'm unsure whether someone is currently working on making what you want happen.

Related

Viewing the Common Lisp HyperSpec offline via Emacs

I'm using Emacs as my Lisp environment, and would like to have offline access to the Common Lisp HyperSpec. I downloaded it, and put the folders into my emacs.d directory. I then put the following code into my .emacs:
(global-set-key [(f2)] 'slime-hyperspec-lookup)
(setq common-lisp-hyperspec-root "/.emacs.d/HyperSpec/")
However, every time I try to search for something in it, my query ends up being malformed. Specifically, suppose I search for dotimes; what gets dumped into my browser is file:///.emacs.d/HyperSpec/Body/m_dolist.htm, which doesn't match the directory structure in the HyperSpec folder, causing the query to fail. The HyperSpec lookup instead formats to suit the web version (in that case, it works absolutely fine).
Is there any way I can fix this, and if so, how? I basically just want to be able to look up the HyperSpec even when I'm not online.
You might like to try my CLHS ASDF wrapper, which is specifically designed to download the CLHS into a standard location (basically the quicklisp directory) and then help you setup emacs to point to it.
Simply invoke (ql:quickload "clhs") and follow the instructions.
Hope this helps!
edit: #JigarParekh I think you may have skimmed my answer a little too fast.
The question's title is "Viewing the Common Lisp HyperSpec offline via Emacs". The question's body basically gets bogged down in the details of manually installing the CLHS and pointing emacs to it, and asks how to solve an immediate subproblem related to that. The selected answer solves the user's immediate subproblem, but is less than optimal given what's available today.
My answer does include the essential part of the answer, which is:
Simply invoke (ql:quickload "clhs") and follow the instructions.
This downloads the CLHS from Quicklisp in a way that should remain available for the foreseeable future, regardless of the helpful but optional additional information I included for reference in the first paragraph. My answer would remain useful even if the reference links' content changed or even if, god forbid, they became 404 Not Found or otherwise unavailable. (I note in passing that since the referenced page is part of a public domain website and available on github, anyone could easily mirror it and provide a replacement link to it here should that ever come to pass. But as I said, it's optional additional reference information anyway.)
Please replace
(setq common-lisp-hyperspec-root "/.emacs.d/HyperSpec/")
with
(setq common-lisp-hyperspec-root "~/.emacs.d/HyperSpec/")
or even
(setq common-lisp-hyperspec-root (expand-file-name "~/.emacs.d/HyperSpec/"))

How to find other built-in DWT fields?

Within a DWT Template Building Block, we can use a few "free" variables such as ##Component.Title## or ##Component.ID## as well as built-in DWT functions.
I didn't realize we can also get a component's schema description with ##Component.Description## or ##Description##.
The out-of-the-box Default Dreamweaver Component Design has a good set of examples, along with the Tridion Cook book's iteration example, and SDL Live Content.
How else could I find other allowed built-in DWT functions and variables, programmatic or otherwise?
In other words, I wouldn't have thought ##Description## was even available in DWT without seeing an example first (not that I have a use for it yet).
Edit (June 8, 2013): I did find additional information on SDL Live Content (requires login). We can of course use available Package variables as described in the documentation.
Researching a bit, I found that if we go to the tridion.contenmanager.config file, we will discover the node, which references to the Dreamweaver mediator type:
<mediator matchMIMEType="text/x-tcm-dreamweaver" type="Tridion.ContentManager.Templating.Dreamweaver.DreamweaverMediator" />
This namespace can be found inside Tridion.ContentManager.Templating.dll
Decompiling is the best way to find out what is inside and learn something. Since it is .Net code, that will not be a problem, there is many free good tools available. I'm using lately JustDecompile
I did not go too deep into the code, but I can see that there is a TridionObjectSource class, with a number of Constants for reserved words, like:
ReservedNameTitle
ReservedNameDescription
Searching where this constants are used on the code, can help to better understand what they do, and the way the Dreamweaver Mediator works inside.
Seems like an interesting learning exercise
I take it that you've searched the documentation for the answer and come up empty. I suggest that you go to the relevant part of the LiveContent documentation and add a comment. This will reach the documentation team directly, and I'm sure they'll be very interested to hear of a feature that isn't properly covered. With a bit of luck they'll update it, and you'll have done us all a favour.
I have some sympathy for the "help yourself" approach too, but if you find a feature by your own analysis of the software, and it gets removed in a later release, you won't have a leg to stand on to complain about this. So help Tridion to get the feature documented, and then it's there to use with confidence.

How to auto-post math markup on my github repo's page(s)?

I'm not sure if this is possible, but this is what I'd like to do:
I'd like to create a literate program, hosted on github, and have the resulting human-friendly literature automatically published on my github's project page. By "automatically published," I mean that I can run a script on my local machine that ends with "git push origin master," and ends up with a published human-friendly, math-containing document on github. I'm open to compromises on the procedure to get there, but the simpler, the better.
Many people don't know what literate programming is, so I'll summarize that. It's a system where you write a single document that can be translated into either source code or a human-friendly document. The purpose is to very clearly explain the algorithm, in English (or other natural language), and it is considered useful when users may be as interested in reading about your algorithm as they are in using it directly. Some folks (like Donald Knuth) consider literate programming as a critical tool in building any complex piece of software.
One idea to do this would be to generate something like a README.md file as the output of the literate program, but I don't know of any math support in github's markdown formatting. It looks like github's wikis might support some math, but I don't know how to make the wiki be generated from the code -- as in, I'd like to be able to do a git push origin master from my machine, and have the github wiki automatically updated.
(Also, to understand why math support is important: I'm coming from a world of always using TeX or LaTeX to write papers, and I'm interested in a general system that other authors used to LaTeX could also use.)
Any ideas how to achieve this?
The wikis are backed by their own git repo, so you can push to it and have it automatically update. That's a different repo than the main one though. As far as I know that stuff is only supported in the wikis, not in the main repo markdown processor.

Where can one post nicely formatted code combined with LaTeX for mathematical expressions?

Admittedly not a programming question, but I don't really know where else to ask this...
I'm planning to start a blog to post the stuff I'm working on, which is mostly about Expression Trees & Mathematics. Hopefully this will help me focus on the problem at hand instead of going off every possible tangent that comes up.
I wonder if someone out there knows a good place to host a blog with the two following requirements:
(1) Nice support for code listings (as seen here, for example).
(2) Support for complex mathematical expressions, ideally in LaTeX (as seen here, for example).
For a while now I've been looking around for posts/articles combining both nicely formatted code and mathematical expressions, but I haven't found anything.
Thanks a lot!
PS - If there's another Q&A forum where this question would fit better, then please let me know and I'll move it there.
EDIT(1): While carrying out some additional research, I found this related SO question (see also resources therein), which then took me to here. Leaving the question open for now though in case someone wants to suggest alternatives.
Read here:
http://sixthform.info/steve/wordpress/?cat=2
http://fugato.net/2007/01/20/latex-in-wordpress/
about LaTeX on Wordpress, syntax higlighting is easy (hint: google for "syntax highlighting") and you can go on any host with WP.
Good luck.
Edit: Okay, about that latex - it seems you need to have administrator rights, so any hosting with friendly administrator or virtual server or server hosting/housing :)
Edit: As for syntax highlighting:
PHP SH: http://xtractpro.com/articles/CSharp-Syntax-Highlighter.aspx
JS SH: http://wordpress.org/extend/plugins/google-syntax-highlighter/
For math expressions in LaTeX syntax checkout MathJax. It can probably be used with most blog hosting services. You just need to be able to add javascript to the page.

StyleCop vs ReSharper and general coding-style questions

Just found StyleCop, looks like something worth using for my projects. Then I found out you could use it with ReSharper (a tool I've also never used). So I downloaded ReSharper, as well as StyleCop for ReSharper. I'm just a bit confused about it, though:
With just StyleCop installed (no ReSharper), I get yelled at for referring directly to private variables in code-behind. It wants me to instead do this.variable. Alright, fine.
If I use just ReSharper, it tells me to remove all of the 'this' calls I just added. Which one is better?
If I use ReSharper + StyleCop for ReSharper, it now tells me to add 'this' to all private member references (just like StyleCop did all by itself). However, now it also wants me to add 'this' to all of the controls I'm referencing from the .aspx page (i.e., Label.Text = this.variable -> this.Label.Text = this.variable).
I'm so confused. What is the best standard to follow? Or am I just fine doing it the way I am now (Label.Text = variable)?
The key point is consistency. Your particular formatting with regard to this point comes down to personal preference.
Does the extra wordiness provide additional clarity as to which variable you're referencing or does it obscure the meaning by flooding the page with extra text?
This is a judgment call. They do enforce other rules that make sense; however, a large part of what they do is enforce consistency. As #Martin said, feel free to disable rules that don't make sense for your workflow.
Sorry when working on a team it all comes down to understanding the politics; after all, we work to get paid!
If the person that decided your next
pay raise uses StyleCop, then you
should always include the “this.”
likewise if the boss uses ReSharper
you should do what ReSharper says.
There are a lot more important wars to win this, e.g. 10,000 line classes, over sized method
If you are luckly enough to decide what tools (and coding standards) are used yourself, then I would just choose ReSharper and read the “clean code” book.
I think it's up to you which conventions you want to follow (it's a matter of personal preferences). At least in ReSharper, you can edit the rules to no longer show certain warnings/hints.

Resources