The work I'm doing is in the intersection of math and programming and I'm often coding functions or computations that I've proven to satisfy certain mathematical properties or follow from certain axioms. The math, and thus the code, is usually sufficiently opaque that just reading it, you wouldn't necessarily guess why it is the way it is, but the proofs are typically simple (5-10 steps) and upon reading them, the code makes sense. The question is where to put the proofs.
On the one hand I'm tempted to put the proofs into block comments preceding the code so that they're immediately available when reading the code. However, it's hard to present math well in plain text (although Unicode math symbols help) - especially when it's indented several levels and thus horizontally challenged. It would be far more readable in LaTeX and the code could point readers to the external documentation, which would be in version control. In this latter case, I could put all external documentation in a folder separate from the code, perhaps organized into subfolders paralleling the organization of the code, or I could place it in the same subfolders as the code, which wouldn't interfere with the build process and would obviate the need to navigate to two different places, but which some devs seem to feel uncomfortable about. If I go with LaTeX, I'm not sure whether to check in rendered PDFs in case other people on the project (me) don't have LaTeX or whether to keep the VCS repository clean and require all devs (me) to have LaTeX.
Any thoughts/ideas/experience?
On the one hand I'm tempted to put the proofs into block comments preceding the code so that they're immediately available when reading the code. However, it's hard to present math well in plain text (although Unicode math symbols help) - especially when it's indented several levels and thus horizontally challenged. It would be far more readable in LaTeX and the code could point readers to the external documentation, which would be in version control. In this latter case, I could put all external documentation in a folder separate from the code, perhaps organized into subfolders paralleling the organization of the code, or I could place it in the same subfolders as the code, which wouldn't interfere with the build process and would obviate the need to navigate to two different places, but which some devs seem to feel uncomfortable about. If I go with LaTeX, I'm not sure whether to check in rendered PDFs in case other people on the project (me) don't have LaTeX or whether to keep the VCS repository clean and require all devs (me) to have LaTeX.
Any thoughts/ideas/experience?