Update lean toolchain and incorporate documentation generation.

finite-set-exercises
Joshua Potter 2023-05-03 15:31:33 -06:00
parent a8f12f2ec0
commit e2d293fc3f
7 changed files with 100 additions and 10 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
PORT=5555

View File

@ -1,3 +1,2 @@
import OneVariableCalculus.Apostol.Chapter_I_3
import OneVariableCalculus.Apostol.Exercises_1_7
import OneVariableCalculus.Apostol.Exercises_I_3_12
import OneVariableCalculus.Apostol.Exercises_I_3_12

View File

@ -81,7 +81,6 @@ theorem subdivision_point_leq_right {p : Partition} (h : x ∈ p.xs)
have ⟨_, ⟨_, hs⟩⟩ := self_neq_nil_imp_exists_mem.mp hx
by_cases hz : i = ⟨p.xs.length - 1, by rw [hs]; simp⟩
· rw [hz]
simp
· refine le_of_lt (Sorted.rel_get_of_lt p.sorted ?_)
rw [← ne_eq, Fin.ne_iff_vne] at hz
rw [Fin.lt_iff_val_lt_val]

View File

@ -13,3 +13,17 @@ LaTeX when not.
- [ ] Gustedt, Jens. Modern C. Shelter Island, NY: Manning Publications Co, 2020.
- [ ] Ross, Sheldon. A First Course in Probability Theory. 8th ed. Pearson Prentice Hall, n.d.
- [ ] Smullyan, Raymond M. To Mock a Mockingbird: And Other Logic Puzzles Including an Amazing Adventure in Combinatory Logic. Oxford: Oxford university press, 2000.
## Documentation
To generate Lean documentation, we use [doc-gen4](https://github.com/leanprover/doc-gen4).
Run the following to build and serve this:
```bash
> lake build Bookshelf:docs
> lake run doc-server
```
This assumes you have `python3` available in your `$PATH`. To change how the
server behaves, refer to the `.env` file located in the root directory of this
project.

View File

@ -2,23 +2,59 @@
"packagesDir": "lake-packages",
"packages":
[{"git":
{"url": "https://github.com/xubaiw/CMark.lean",
"subDir?": null,
"rev": "2cc7cdeef67184f84db6731450e4c2b258c28fe8",
"name": "CMark",
"inputRev?": "main"}},
{"git":
{"url": "https://github.com/leanprover/lake",
"subDir?": null,
"rev": "257fc59a6464f5732a4f49e7dda0fc37475819fb",
"name": "lake",
"inputRev?": "master"}},
{"git":
{"url": "https://github.com/leanprover/doc-gen4",
"subDir?": null,
"rev": "cf86cb481501e9f03dce5b0cb362b19cdba1824f",
"name": "doc-gen4",
"inputRev?": "cf86cb481501e9f03dce5b0cb362b19cdba1824f"}},
{"git":
{"url": "https://github.com/mhuisi/lean4-cli",
"subDir?": null,
"rev": "5a858c32963b6b19be0d477a30a1f4b6c120be7e",
"name": "Cli",
"inputRev?": "nightly"}},
{"git":
{"url": "https://github.com/leanprover-community/mathlib4.git",
"subDir?": null,
"rev": "0107c50abf149a48b5b9ad08a0b2a2093bcb567a",
"rev": "d65ed3b2920dbfb0b2bf1aca2189ec177eb68980",
"name": "mathlib",
"inputRev?": "0107c50abf149a48b5b9ad08a0b2a2093bcb567a"}},
"inputRev?": "d65ed3b2920dbfb0b2bf1aca2189ec177eb68980"}},
{"git":
{"url": "https://github.com/gebner/quote4",
"subDir?": null,
"rev": "7ae096b232087096ff0243a2b70d32720d2621ae",
"rev": "c71f94e34c1cda52eef5c93dc9da409ab2727420",
"name": "Qq",
"inputRev?": "master"}},
{"git":
{"url": "https://github.com/JLimperg/aesop",
"subDir?": null,
"rev": "071464ac36e339afb7a87640aa1f8121f707a59a",
"rev": "cdc00b640d0179910ebaa9c931e3b733a04b881c",
"name": "aesop",
"inputRev?": "master"}},
{"git":
{"url": "https://github.com/hargonix/LeanInk",
"subDir?": null,
"rev": "2447df5cc6e48eb965c3c3fba87e46d353b5e9f1",
"name": "leanInk",
"inputRev?": "doc-gen"}},
{"git":
{"url": "https://github.com/fgdorais/lean4-unicode-basic",
"subDir?": null,
"rev": "be1f061688faa1dbb224773c54901661253fb4b8",
"name": "UnicodeBasic",
"inputRev?": "main"}},
{"git":
{"url": "https://github.com/leanprover/std4.git",
"subDir?": null,
@ -28,6 +64,6 @@
{"git":
{"url": "https://github.com/leanprover/std4",
"subDir?": null,
"rev": "5507f9d8409f93b984ce04eccf4914d534e6fca2",
"rev": "6006307d2ceb8743fea7e00ba0036af8654d0347",
"name": "std",
"inputRev?": "main"}}]}

View File

@ -1,14 +1,18 @@
import Lake
open Lake DSL
package «bookshelf»
require mathlib from git
"https://github.com/leanprover-community/mathlib4.git" @
"0107c50abf149a48b5b9ad08a0b2a2093bcb567a"
"d65ed3b2920dbfb0b2bf1aca2189ec177eb68980"
require std4 from git
"https://github.com/leanprover/std4.git" @
"6006307d2ceb8743fea7e00ba0036af8654d0347"
require «doc-gen4» from git
"https://github.com/leanprover/doc-gen4" @
"cf86cb481501e9f03dce5b0cb362b19cdba1824f"
@[default_target]
lean_lib «Bookshelf» {
@ -21,3 +25,40 @@ lean_lib «Bookshelf» {
`TheoremProvingInLean
]
}
/--
The contents of our `.env` file.
-/
structure Config where
port : Nat := 5555
/--
Read in the `.env` file into an in-memory structure.
-/
private def readConfig : StateT Config ScriptM Unit := do
let env <- IO.FS.readFile ".env"
for line in env.trim.split (fun c => c == '\n') do
match line.split (fun c => c == '=') with
| ["PORT", port] => modify (fun c => { c with port := String.toNat! port })
| _ => error "Malformed `.env` file."
return ()
/--
Start an HTTP server for locally serving documentation. It is expected the
documentation has already been generated prior via
```bash
> lake build Bookshelf:docs
```
USAGE:
lake run doc-server
-/
script «doc-server» (_args) do
let ((), config) <- StateT.run readConfig {}
IO.println s!"Running on `http://localhost:{config.port}`"
_ <- IO.Process.run {
cmd := "python3",
args := #["-m", "http.server", toString config.port, "-d", "build/doc"],
}
return 0

View File

@ -1 +1 @@
leanprover/lean4:nightly-2023-04-02
leanprover/lean4:nightly-2023-04-20