Skip to content

Commit c7357f5

Browse files
committed
update
1 parent b2795a1 commit c7357f5

File tree

31 files changed

+322
-207
lines changed

31 files changed

+322
-207
lines changed

.devcontainer/Dockerfile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
FROM mcr.microsoft.com/devcontainers/base:jammy
2+
3+
USER vscode
4+
WORKDIR /home/vscode
5+
6+
RUN curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
7+
8+
ENV PATH="/home/vscode/.elan/bin:${PATH}"

.devcontainer/devcontainer.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"name": "LAMR dev container",
3+
4+
"build": {
5+
"dockerfile": "Dockerfile"
6+
},
7+
8+
"onCreateCommand": "echo \"Downloading the Lean 4 mathematical library...\" && lake exe cache get! && lake build && echo \"Finished setup! Open a file using the Explorer in the top-left of your screen.\"",
9+
10+
"customizations": {
11+
"vscode" : {
12+
"extensions" : [ "leanprover.lean4" ]
13+
}
14+
}
15+
}

.docker/gitpod/Dockerfile

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
# This is the Dockerfile for `leanprovercommunity/mathlib:gitpod`.
2+
3+
# gitpod doesn't support multiple FROM statements, (or rather, you can't copy from one to another)
4+
# so we just install everything in one go
5+
FROM ubuntu:jammy
6+
7+
USER root
8+
9+
RUN apt-get update && apt-get install sudo git curl git bash-completion -y && apt-get clean
10+
11+
RUN useradd -l -u 33333 -G sudo -md /home/gitpod -s /bin/bash -p gitpod gitpod \
12+
# passwordless sudo for users in the 'sudo' group
13+
&& sed -i.bkp -e 's/%sudo\s\+ALL=(ALL\(:ALL\)\?)\s\+ALL/%sudo ALL=NOPASSWD:ALL/g' /etc/sudoers
14+
USER gitpod
15+
WORKDIR /home/gitpod
16+
17+
SHELL ["/bin/bash", "-c"]
18+
19+
# gitpod bash prompt
20+
RUN { echo && echo "PS1='\[\033[01;32m\]\u\[\033[00m\] \[\033[01;34m\]\w\[\033[00m\]\$(__git_ps1 \" (%s)\") $ '" ; } >> .bashrc
21+
22+
# install elan
23+
RUN curl https://raw.githubusercontent.com/leanprover/elan/master/elan-init.sh -sSf | sh -s -- -y --default-toolchain none
24+
25+
# install whichever toolchain mathlib is currently using
26+
RUN . ~/.profile && elan toolchain install $(curl https://raw.githubusercontent.com/hrmacbeth/math2001/main/lean-toolchain)
27+
28+
ENV PATH="/home/gitpod/.local/bin:/home/gitpod/.elan/bin:${PATH}"
29+
30+
# fix the infoview when the container is used on gitpod:
31+
ENV VSCODE_API_VERSION="1.50.0"
32+
33+
# ssh to github once to bypass the unknown fingerprint warning
34+
RUN ssh -o StrictHostKeyChecking=no github.com || true
35+
36+
# run sudo once to suppress usage info
37+
RUN sudo echo finished

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
## Build directories
1616
build/
1717
_build/
18+
.lake/
1819

1920
## Intermediate documents:
2021
*.dvi
@@ -26,7 +27,7 @@ _build/
2627
# *.pdf
2728

2829
## Generated if empty string is given at "Please type another file name for output:"
29-
.pdf
30+
*.pdf
3031

3132
## Bibliography auxiliary files (bibtex/biblatex/biber):
3233
*.bbl

.gitpod.Dockerfile

Lines changed: 0 additions & 5 deletions
This file was deleted.

.gitpod.yml

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
image:
2-
file: .gitpod.Dockerfile
3-
4-
tasks:
5-
- init: |
6-
lake build
2+
file: .docker/gitpod/Dockerfile
73

84
vscode:
95
extensions:
106
- leanprover.lean4
7+
8+
tasks:
9+
- init: |
10+
lake exe cache get && lake build LAMR
11+

.vscode/settings.json

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"files.exclude": {
3+
"**/.git": true,
4+
"**/.DS_Store": true,
5+
"**/*.olean": true,
6+
"**/.DS_yml": true,
7+
"**/.gitpod.yml": true,
8+
"**/.vscode": true,
9+
".devcontainer.json": true,
10+
".docker": true,
11+
"build": true,
12+
"html": true,
13+
"lake-packages": true,
14+
".gitignore": true,
15+
"lake-manifest.json": true,
16+
"lakefile.lean": true,
17+
"lean-toolchain": true,
18+
".lake": true,
19+
".devcontainer": true
20+
},
21+
"editor.minimap.enabled": false,
22+
"editor.acceptSuggestionOnEnter": "off",
23+
"scm.diffDecorationsGutterVisibility": "hover",
24+
"editor.semanticHighlighting.enabled": true,
25+
"editor.semanticTokenColorCustomizations": {
26+
"[Default Light+]": {"rules": {"variable": "#1a31da"}}
27+
},
28+
"editor.unicodeHighlight.nonBasicASCII": false,
29+
"editor.unicodeHighlight.ambiguousCharacters": false,
30+
"editor.fontLigatures": true,
31+
"files.trimTrailingWhitespace": true,
32+
"files.trimFinalNewlines": true,
33+
"lean4.infoview.emphasizeFirstGoal": true,
34+
"lean4.infoview.showExpectedType": false
35+
}

LAMR.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import Mathlib
21
import LAMR.Util.Propositional
32
import LAMR.Util.FirstOrder
43
import LAMR.Util.DisjointSet

LAMR/Examples/decision_procedures_for_first_order_logic/FourierMotzkin.lean

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ def List.toLinearExp (l : List (String × Int)) : LinearExp := l.toHashMap
3232
instance : Coe (List (String × Int)) LinearExp := ⟨List.toLinearExp⟩
3333

3434
instance : ToString LinearExp := ⟨fun linexp =>
35-
String.intercalate " + " $ linexp.toList.map (fun (s, i) => (ToString.toString i ++ "*" ++ s))⟩
35+
String.intercalate " + " <| linexp.toList.map (fun (s, i) => (ToString.toString i ++ "*" ++ s))⟩
3636

3737
def ex1 : LinearExp := [("x", 3), ("y", -2), ("z", 4)]
3838
def ex2 : LinearExp := [("x", 4), ("y", 2), ("w", -1), ("v", 3)]
3939

40-
#eval toString $ ex1
41-
#eval toString $ ex2
40+
#eval toString ex1
41+
#eval toString ex2
4242

4343

4444
/--
@@ -59,13 +59,13 @@ def linearCombination (a : Int) (u : LinearExp) (b : Int) (v : LinearExp) : Line
5959
result := result.insert t (b * j)
6060
result
6161

62-
#eval toString $ linearCombination 1 ex1 1 ex2
63-
#eval toString $ linearCombination 1 ex1 (-1) ex1
64-
#eval toString $ linearCombination 2 ex1 (-3) ex2
62+
#eval toString <| linearCombination 1 ex1 1 ex2
63+
#eval toString <| linearCombination 1 ex1 (-1) ex1
64+
#eval toString <| linearCombination 2 ex1 (-3) ex2
6565

6666
-- checks whether an expression is empty
6767
#eval ex1.isEmpty
68-
#eval HashMap.isEmpty $ linearCombination 1 ex1 (-1) ex1
68+
#eval HashMap.isEmpty <| linearCombination 1 ex1 (-1) ex1
6969

7070
-- you can erase a term from an expression
7171
#eval let ex' : LinearExp := ex1.erase "x"
@@ -191,8 +191,8 @@ def wikipedia_constraints : List LinearExp :=
191191
[("one", -7), ("x", 1), ("y", -5), ("z", 2)],
192192
[("one", 12), ("x", 3), ("y", -2), ("z", -6)] ]
193193

194-
#eval toString $ sortGtConstraints "x" wikipedia_constraints
195-
#eval toString $ elimVarGtConstraints "x" wikipedia_constraints
194+
#eval toString <| sortGtConstraints "x" wikipedia_constraints
195+
#eval toString <| elimVarGtConstraints "x" wikipedia_constraints
196196

197197
/-
198198
Given a pair `eq, gts`, we want to eliminate all the variables to determine whether it is

LAMR/Examples/implementing_first_order_logic/TarskisWorld.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def World.toArray (world : World) : Array (Array (Option Object)) := Id.run do
133133
for obj in world do
134134
assert! obj.row < 8
135135
assert! obj.col < 8
136-
arr := arr.set! obj.row $ arr[obj.row]!.set! obj.col (some obj)
136+
arr := arr.set! obj.row <| arr[obj.row]!.set! obj.col (some obj)
137137
arr
138138

139139
instance : ToString World :=
@@ -148,7 +148,7 @@ instance : ToString World :=
148148
s := s ++ "\n" ++ rowDashes ++ "\n"
149149
s⟩
150150

151-
def World.show (world : World) : IO Unit := do IO.print $ toString world
151+
def World.show (world : World) : IO Unit := do IO.print <| toString world
152152

153153
/-
154154
Implement the language

0 commit comments

Comments
 (0)