Skip to content

Commit 4b160e7

Browse files
committed
added a small numerical example
1 parent 20a713a commit 4b160e7

5 files changed

Lines changed: 35 additions & 22 deletions

File tree

MDPLib/Probability/Basic.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ theorem nneg_dotProd_pos_ex_pos (h1 : ∀ ω, p ω ≥ 0) (h2 : ∀ ω, x ω ≥
3434
| succ n ih =>
3535
by_cases hn : x ⟨0, Nat.zero_lt_succ n⟩ > 0
3636
· exact ⟨0, hn⟩
37-
· push_neg at hn
37+
· push Not at hn
3838
have hvh0 : 0 = vecHead x := le_antisymm (h2 0) hn
3939
rewrite [dotProduct_head_tail, ←hvh0] at h
4040
obtain ⟨ω, hω⟩ := ih (Fin.tail h1) (Fin.tail h2) (by simpa [vecHead, vecTail] using h)
@@ -141,7 +141,7 @@ theorem rv_le_step_lt_max (h0 : t < (FinRV.max P X)) : ∃q > t, (X ≤ᵣ t) =
141141
have hxω : X ω ∉ 𝓨 := by
142142
by_contra! inY; exact false_of_le_gt (Finset.min'_le 𝓨 (X ω) inY) h2
143143
rw [Finset.mem_filter] at hxω
144-
push_neg at hxω
144+
push Not at hxω
145145
exact hxω (Finset.mem_image_of_mem X (Finset.mem_univ ω))
146146

147147
theorem rv_le_step_lt (P : Findist n) : ∃q > t, (X ≤ᵣ t) = (X <ᵣ q) :=

MDPLib/Risk/VaR.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ theorem isquantilelower_le_isquantile : IsCofinalFor (QuantileLower P X α.val)
134134
· exfalso; exact false_of_lt_ge h2r h
135135

136136
theorem isquantile_le_isquantilelower : IsCofinalFor (Quantile P X α.val) (QuantileLower P X α.val) :=
137-
HasSubset.Subset.iscofinalfor quantile_subset_quantilelower
137+
HasSubset.Subset.isCofinalFor quantile_subset_quantilelower
138138

139139
theorem varq_eq_var : IsVaR_Q P X α v ↔ IsVaR P X α v :=
140140
fun h => ⟨varq_is_quantilelower h, (upperBounds_mono_of_isCofinalFor isquantilelower_le_isquantile) h.2⟩,

Main.lean

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,17 @@
11
import MDPLib
2+
import MDPLib.Risk.VaR
3+
4+
theorem fancy : True := True.intro
25

36
def main : IO Unit := -- main
4-
IO.println s!"Hello!"
7+
let x : Fin 3 → ℚ := ![1,2,3]
8+
let p : Fin 3 → ℚ := ![0.1, 0.5, 0.4]
9+
let P : Findist 3 :=
10+
{p := p, prob := by simp [dotProduct, p]; sorry; , nneg := by sorry }
11+
let α : Risk.RiskLevel := ⟨0.5, by unfold Risk.IsRiskLevel; constructor; linarith; linarith ⟩
12+
13+
let v := Risk.FinVaR P x α
14+
15+
IO.println s!"VaR value: {v}"
16+
517

lake-manifest.json

Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
{"version": "1.1.0",
1+
{"version": "1.2.0",
22
"packagesDir": ".lake/packages",
33
"packages":
44
[{"url": "https://github.com/leanprover-community/mathlib4",
55
"type": "git",
66
"subDir": null,
77
"scope": "leanprover-community",
8-
"rev": "d86a5de2ff21aa80102530624e079756b2723855",
8+
"rev": "d4c205d5773673a2e8112f8c72bf33a0358e333d",
99
"name": "mathlib",
1010
"manifestFile": "lake-manifest.json",
1111
"inputRev": "master",
@@ -15,7 +15,7 @@
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "",
18-
"rev": "68a23ef0da7598345429a493ca8d4250fd44087f",
18+
"rev": "aa4c3e4e14f5b31495b7c7238762ecceddd9f52c",
1919
"name": "«doc-gen4»",
2020
"manifestFile": "lake-manifest.json",
2121
"inputRev": "main",
@@ -35,7 +35,7 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "leanprover-community",
38-
"rev": "e84e3e16aea6b72cc5d311ca1bb25caad417e162",
38+
"rev": "f449eabb8f7e3feef0366856c20e28a6d2c97ee3",
3939
"name": "plausible",
4040
"manifestFile": "lake-manifest.json",
4141
"inputRev": "main",
@@ -55,7 +55,7 @@
5555
"type": "git",
5656
"subDir": null,
5757
"scope": "leanprover-community",
58-
"rev": "f207d9fcf0cef00ba79962a33ef156061914d9c7",
58+
"rev": "86503d416c875fdcf3b6b6c54c22581e96c6bda7",
5959
"name": "importGraph",
6060
"manifestFile": "lake-manifest.json",
6161
"inputRev": "main",
@@ -65,50 +65,50 @@
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "2e58165a9dcdca9837b666528f974299ee1a51cc",
68+
"rev": "82d457fb3bdd9efadbae06608ff337d689efdddf",
6969
"name": "proofwidgets",
7070
"manifestFile": "lake-manifest.json",
71-
"inputRev": "v0.0.92",
71+
"inputRev": "v0.0.97",
7272
"inherited": true,
7373
"configFile": "lakefile.lean"},
7474
{"url": "https://github.com/leanprover-community/aesop",
7575
"type": "git",
7676
"subDir": null,
7777
"scope": "leanprover-community",
78-
"rev": "c3361708f266893de5d1769192b60d4b1831f2bb",
78+
"rev": "f74c7555aaa94eadd7b7bff9170f7983f92aac21",
7979
"name": "aesop",
8080
"manifestFile": "lake-manifest.json",
81-
"inputRev": "master",
81+
"inputRev": "v4.30.0-rc1",
8282
"inherited": true,
8383
"configFile": "lakefile.toml"},
8484
{"url": "https://github.com/leanprover-community/quote4",
8585
"type": "git",
8686
"subDir": null,
8787
"scope": "leanprover-community",
88-
"rev": "221e8088e3a066b8676dc471ff10638cf1c10835",
88+
"rev": "7aa86cb20b8458748dc24d55dab2d7ea01161057",
8989
"name": "Qq",
9090
"manifestFile": "lake-manifest.json",
91-
"inputRev": "master",
91+
"inputRev": "v4.30.0-rc1",
9292
"inherited": true,
9393
"configFile": "lakefile.toml"},
9494
{"url": "https://github.com/leanprover-community/batteries",
9595
"type": "git",
9696
"subDir": null,
9797
"scope": "leanprover-community",
98-
"rev": "77a5160a74772214ef37caba2847cfe9ab600285",
98+
"rev": "bf597c77bf9b8e66720d724928207f5911533113",
9999
"name": "batteries",
100100
"manifestFile": "lake-manifest.json",
101-
"inputRev": "main",
101+
"inputRev": "v4.30.0-rc1",
102102
"inherited": true,
103103
"configFile": "lakefile.toml"},
104104
{"url": "https://github.com/leanprover/lean4-cli",
105105
"type": "git",
106106
"subDir": null,
107107
"scope": "leanprover",
108-
"rev": "3de531c1135f5e3a01f3ac04830996fda476b28e",
108+
"rev": "f7d0ca7c926cdde0562af20394dd25d028b839a5",
109109
"name": "Cli",
110110
"manifestFile": "lake-manifest.json",
111-
"inputRev": "v4.29.0-rc6",
111+
"inputRev": "v4.30.0-rc1",
112112
"inherited": true,
113113
"configFile": "lakefile.toml"},
114114
{"url": "https://github.com/kim-em/leansqlite",
@@ -125,7 +125,7 @@
125125
"type": "git",
126126
"subDir": null,
127127
"scope": "",
128-
"rev": "d7f24379ba37ec711f3f96b7187ca8dcc98b20e3",
128+
"rev": "9539e34e5cb2d52a6454d9b6218f6b6835cad071",
129129
"name": "UnicodeBasic",
130130
"manifestFile": "lake-manifest.json",
131131
"inputRev": "main",
@@ -152,4 +152,5 @@
152152
"inherited": true,
153153
"configFile": "lakefile.lean"}],
154154
"name": "mdplib",
155-
"lakeDir": ".lake"}
155+
"lakeDir": ".lake",
156+
"fixedToolchain": false}

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.29.0-rc6
1+
leanprover/lean4:v4.30.0-rc1

0 commit comments

Comments
 (0)