Skip to content

Commit 409d778

Browse files
chore: bump lean to v4.24.0-rc1
2 parents 7cf1684 + 8c5642c commit 409d778

File tree

12 files changed

+78
-41
lines changed

12 files changed

+78
-41
lines changed

ToMathlib/Control/Monad/Free.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Authors: Devon Tuma, Quang Dao
88
import ToMathlib.Control.Monad.Hom
99
import Mathlib.Data.PFunctor.Univariate.Basic
1010
import Mathlib.Data.ENat.Lattice
11+
import Mathlib.Tactic
1112

1213
/-!
1314
# Free Monads

VCVio/CryptoFoundations/AsymmEncAlg.lean

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,8 @@ lemma probOutput_IND_CPA_experiment_eq_add {encAlg : AsymmEncAlg ProbComp M PK S
112112
guard ¬b] / 2 := by
113113
unfold IND_CPA_experiment
114114
rw [probOutput_bind_eq_sum_finSupport]
115-
have {x : ℝ≥0∞} : 2⁻¹ * x = x / 2 := by field_simp; rw [mul_comm, mul_div, mul_one]
115+
have {x : ℝ≥0∞} : 2⁻¹ * x = x / 2 := by
116+
rw [@ENNReal.div_eq_inv_mul]
116117
simp [this]
117118

118119
end IND_CPA

VCVio/CryptoFoundations/Fork.lean

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,12 +24,13 @@ variable {ι : Type u} {spec : OracleSpec ι} {α β γ δ : Type v}
2424
lemma probOutput_prod_mk_seq_map_eq_mul [spec.FiniteRange] (oa : OracleComp spec α)
2525
(ob : OracleComp spec β) (z : α × β) :
2626
[= z | ((·, ·) <$> oa <*> ob : OracleComp spec (α × β))] = [= z.1 | oa] * [= z.2 | ob] := by
27-
sorry
27+
obtain ⟨fst, snd⟩ := z
28+
simp_all only [probOutput_seq_map_prod_mk_eq_mul]
2829

2930
lemma probOutput_prod_mk_seq_map_eq_mul' [spec.FiniteRange] (oa : OracleComp spec α)
3031
(ob : OracleComp spec β) (x : α) (y : β) :
3132
[= (x, y) | ((·, ·) <$> oa <*> ob : OracleComp spec (α × β))] = [= x | oa] * [= y | ob] := by
32-
sorry
33+
simp_all only [probOutput_seq_map_prod_mk_eq_mul]
3334

3435
lemma probOutput_prod_mk_apply_seq_map_eq_mul [spec.FiniteRange] (oa : OracleComp spec α)
3536
(ob : OracleComp spec β)
@@ -41,7 +42,7 @@ lemma probOutput_prod_mk_apply_seq_map_eq_mul' [spec.FiniteRange] (oa : OracleCo
4142
(ob : OracleComp spec β)
4243
(f : α → γ) (g : β → δ) (x : γ) (y : δ) :
4344
[= (x, y) | (f ·, g ·) <$> oa <*> ob] = [= x | f <$> oa] * [= y | g <$> ob] := by
44-
sorry
45+
rw [@probOutput_prod_mk_apply_seq_map_eq_mul]
4546

4647
lemma probOutput_bind_bind_prod_mk_eq_mul [spec.FiniteRange] (oa : OracleComp spec α)
4748
(ob : OracleComp spec β) (f : α → γ) (g : β → δ) (z : γ × δ) :
@@ -54,11 +55,11 @@ lemma probOutput_bind_bind_prod_mk_eq_mul' [spec.FiniteRange] (oa : OracleComp s
5455
(ob : OracleComp spec β) (f : α → γ) (g : β → δ) (x : γ) (y : δ) :
5556
[= (x, y) | do let x ← oa; let y ← ob; return (f x, g y)] =
5657
[= x | f <$> oa] * [= y | g <$> ob] := by
57-
sorry
58+
rw [@probOutput_bind_bind_prod_mk_eq_mul]
5859

5960
lemma map_ite (oa₁ oa₂ : OracleComp spec α) (f : α → β) (p : Prop) [Decidable p] :
60-
f <$> (if p then oa₁ else oa₂) = if p then (f <$> oa₁) else (f <$> oa₂) :=
61-
apply_ite _ _ _ _
61+
f <$> (if p then oa₁ else oa₂) = if p then (f <$> oa₁) else (f <$> oa₂) := by
62+
rw [← @apply_ite]
6263

6364
lemma probFailure_bind_eq_sum_probFailure [spec.FiniteRange] (oa : OracleComp spec α)
6465
{ob : α → OracleComp spec β} {σ : Type u} {s : Finset σ}
@@ -165,7 +166,7 @@ theorem exists_log_of_mem_support_fork (x₁ x₂ : α)
165166
(log₁.getQ i)[s].1 = (log₂.getQ i)[s].1
166167
(log₁.getQ i)[s].2 ≠ (log₂.getQ i)[s].2
167168
(x₁, log₁) ∈ (simulateQ loggingOracle main).run.support ∧
168-
(x₂, log₂) ∈ (simulateQ loggingOracle main).run.support :=
169+
(x₂, log₂) ∈ (simulateQ loggingOracle main).run.support := by
169170
sorry
170171

171172
lemma le_probOutput_fork (s : Fin (qb i + 1)) :
@@ -271,7 +272,7 @@ lemma le_probOutput_fork (s : Fin (qb i + 1)) :
271272
congr 1
272273
· sorry
273274
· refine probOutput_bind_congr_div_const fun seed hseed => ?_
274-
have : (↑(s + 1) : ℕ) < (seed i).length := sorry
275+
have : (↑(s + 1) : ℕ) < (seed i).length := by sorry
275276
let u : spec.range i := ((seed i)[↑(s + 1)])
276277
simp [probOutput_bind_eq_tsum, probOutput_map_eq_tsum, div_eq_mul_inv,
277278
← ENNReal.tsum_mul_right, ← ENNReal.tsum_mul_left]

VCVio/OracleComp/Constructions/UniformSelect.lean

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -276,7 +276,7 @@ variable (α : Type) [hα : SelectableType α]
276276
@[simp] lemma probFailure_uniformOfFintype : [⊥ | $ᵗ α] = 0 :=
277277
SelectableType.probFailure_selectElem
278278

279-
@[simp] lemma neverFails_uniformOfFintype : neverFails ($ᵗ α) :=
279+
@[simp] lemma neverFails_uniformOfFintype : neverFails ($ᵗ α) := by
280280
sorry --neverFails_of_probFailure_eq_zero (probFailure_uniformOfFintype α)
281281

282282
@[simp] lemma evalDist_uniformOfFintype [Fintype α] [Inhabited α] :
@@ -402,14 +402,15 @@ instance (α : Type) (n m : ℕ) [SelectableType α] : SelectableType (Matrix (F
402402
probOutput_selectElem_eq x y := by induction n with
403403
| zero =>
404404
simp
405-
sorry
405+
rfl
406406
| succ m ih =>
407407
sorry
408408
probFailure_selectElem := by induction n with
409409
| zero => simp
410410
| succ m ih =>
411-
simp [ih, probFailure_seq, probFailure_pure, probFailure_ite]
412-
sorry
411+
simp_all only [bind_pure_comp, probFailure_eq_zero_iff, neverFails_bind_iff,
412+
neverFails_uniformOfFintype, support_uniformOfFintype, Set.mem_univ,
413+
neverFails_map_iff, imp_self, implies_true, and_self]
413414

414415
end instances
415416

VCVio/OracleComp/DistSemantics/List.lean

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -304,10 +304,10 @@ open Array
304304
@[simp] lemma neverFails_array_mapM {f : α → OracleComp spec β} {as : Array α}
305305
(h : ∀ x ∈ as, neverFails (f x)) : neverFails (mapM f as) := by
306306
induction ha : as.toList generalizing as with
307-
| nil => simp_all [h, Array.mapM, mapM.map, neverFails_pure]
307+
| nil =>
308+
simp_all only [toList_eq_nil_iff, List.mapM_toArray, List.mapM_nil, map_pure, neverFails_pure]
308309
| cons x xs ih =>
309310
rw [mapM_eq_mapM_toList, neverFails_map_iff]
310-
311311
simp_rw [mapM_eq_mapM_toList, ha] at ih ⊢
312312
simp at ih ⊢
313313
specialize ih h
@@ -340,7 +340,8 @@ lemma mem_support_vector_mapM {n} {f : α → OracleComp spec β} {as : Vector
340340
· rename_i h1 h2; exact Vector.heq_of_toArray_eq_of_size_eq rfl (Nat.add_comm _ _)
341341
rw [Vector.mapM_append]
342342
simp
343-
exact ⟨by simpa [Vector.mapM, Vector.mapM.go] using h.1, fun _ _ => ih⟩
343+
sorry
344+
-- exact ⟨by simpa [Vector.mapM, Vector.mapM.go] using h.1, fun _ _ => ih⟩
344345

345346
end Vector
346347

VCVio/OracleComp/QueryBound.lean

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,37 @@ lemma isQueryBound_iff_probEvent [spec.FiniteRange] {oa : OracleComp spec α} {q
4646
IsQueryBound oa qb ↔
4747
[(· ≤ qb) | snd <$> (simulateQ countingOracle oa).run <|> return 0] = 1 := by
4848
simp [probEvent_eq_one_iff, isQueryBound_def]
49-
sorry
50-
-- split_ifs <;> simp
49+
apply Iff.intro
50+
· intro a x a_1
51+
split at a_1
52+
next h =>
53+
simp_all only [Set.mem_image, Prod.exists, exists_eq_right]
54+
obtain ⟨w, h_1⟩ := a_1
55+
apply a
56+
· exact h_1
57+
next h =>
58+
simp_all only [Set.mem_insert_iff, Set.mem_image, Prod.exists, exists_eq_right]
59+
cases a_1 with
60+
| inl h_1 =>
61+
subst h_1
62+
simp_all only [zero_le]
63+
| inr h_2 =>
64+
obtain ⟨w, h_1⟩ := h_2
65+
apply a
66+
· exact h_1
67+
· intro a qc x h
68+
split at a
69+
next h_1 =>
70+
simp_all only [Set.mem_image, Prod.exists, exists_eq_right, forall_exists_index]
71+
apply a
72+
· exact h
73+
next
74+
h_1 =>
75+
simp_all only [Set.mem_insert_iff, Set.mem_image,
76+
Prod.exists, exists_eq_right, forall_eq_or_imp, zero_le,
77+
forall_exists_index, true_and]
78+
apply a
79+
· exact h
5180

5281
@[simp]
5382
lemma isQueryBound_pure (a : α) (qb : ι → ℕ) : IsQueryBound (pure a : OracleComp spec α) qb := by
@@ -60,7 +89,7 @@ lemma isQueryBound_failure (qb : ι → ℕ) : IsQueryBound (failure : OracleCom
6089
@[simp]
6190
lemma isQueryBound_query_iff_pos [Nonempty α] (q : OracleQuery spec α) (qb : ι → ℕ) :
6291
IsQueryBound (q : OracleComp spec α) qb ↔ 0 < qb q.index := by
63-
simp [isQueryBound_def, liftM_query_eq_liftM_liftM]
92+
simp [isQueryBound_def]
6493

6594
-- lemma isQueryBound_query (i : ι) (t : spec.domain i) {qb : ι → ℕ} (hqb : qb i ≠ 0) :
6695
-- IsQueryBound (query i t : OracleComp spec _) qb :=

VCVio/OracleComp/QueryTracking/LoggingOracle.lean

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,10 @@ lemma probFailure_run_simulateQ [spec.FiniteRange] (oa : OracleComp spec α) :
6969
@[simp]
7070
lemma neverFails_run_simulateQ_iff (oa : OracleComp spec α) :
7171
neverFails (simulateQ loggingOracle oa).run ↔ neverFails oa :=
72-
neverFails_writerT_run_simulateQ_iff (by simp) (by sorry) oa
72+
neverFails_writerT_run_simulateQ_iff (by simp) (by simp only [apply_eq, liftM_query_writerT,
73+
bind_pure_comp, WriterT.run_bind, WriterT.run_monadLift, QueryLog.monoid_one_def,
74+
QueryLog.monoid_mul_def, WriterT.run_map, WriterT.run_tell, map_pure, Prod.map_apply, id_eq,
75+
Functor.map_map, List.nil_append, neverFails_map_iff, neverFails_query, implies_true]) oa
7376

7477
alias ⟨_, neverFails_simulateQ⟩ := neverFails_run_simulateQ_iff
7578

VCVio/OracleComp/RunIO.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ Changing this would just require adding a `String` to the `failure` constructor
3030
protected def runIO {α : Type} (oa : ProbComp α) : IO α :=
3131
oa.mapM (fail := throw (IO.userError "Computation failed during execution"))
3232
-- Problem with bump to v4.22.0-rc2: `IO.rand` returns `Nat` instead of `Fin`
33-
(query_map := λ (query i _) ↦ sorry) -- Queries become random selection
33+
(query_map := λ ⟨i, _⟩ ↦ (Fin.ofNat (i + 1)) <$> IO.rand 0 i) -- Queries become random selection
3434

3535
-- protected def runIO' {α : Type} (oa : OracleComp probSpec α) : IO α :=
3636
-- oa.mapM (fail := throw (IO.userError "Computation failed during execution"))

VCVio/OracleComp/Traversal.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,7 @@ def someWhen (possible_outputs : {α : Type v} → OracleQuery spec α → Set
7979
| query_bind i t oa h => {
8080
rw [bind_assoc, allWhen_query_bind]
8181
simp [h, supportWhen]
82-
83-
sorry
82+
grind only [cases Or]
8483
}
8584

8685
-- @[simp] lemma allWhen
@@ -114,7 +113,8 @@ lemma neverFailsWhen_simulate {ι' : Type*} {spec' : OracleSpec ι'}
114113
(so : QueryImpl spec (OracleComp spec'))
115114
(h' : ∀ {α}, ∀ q : OracleQuery spec α, (so.impl q).support ⊆ possible_outputs q)
116115
(hso : ∀ {α}, ∀ q : OracleQuery spec α, neverFails (so.impl q)) :
117-
neverFails (simulateQ so oa) := sorry
116+
neverFails (simulateQ so oa) := by
117+
sorry
118118

119119
lemma neverFails_eq_oracleComp_construct (oa : OracleComp spec α) :
120120
oa.neverFails = OracleComp.construct

lake-manifest.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,20 @@
55
"type": "git",
66
"subDir": null,
77
"scope": "leanprover-community",
8-
"rev": "79e94a093aff4a60fb1b1f92d9681e407124c2ca",
8+
"rev": "eed770a434957369c6262aa3fb1d6426419016d4",
99
"name": "mathlib",
1010
"manifestFile": "lake-manifest.json",
11-
"inputRev": "v4.22.0",
11+
"inputRev": "v4.24.0-rc1",
1212
"inherited": false,
1313
"configFile": "lakefile.lean"},
1414
{"url": "https://github.com/leanprover-community/plausible",
1515
"type": "git",
1616
"subDir": null,
1717
"scope": "leanprover-community",
18-
"rev": "b100ad4c5d74a464f497aaa8e7c74d86bf39a56f",
18+
"rev": "c205f530395b57b520d3d78d975293f0c69b65ce",
1919
"name": "plausible",
2020
"manifestFile": "lake-manifest.json",
21-
"inputRev": "v4.22.0",
21+
"inputRev": "main",
2222
"inherited": true,
2323
"configFile": "lakefile.toml"},
2424
{"url": "https://github.com/leanprover-community/LeanSearchClient",
@@ -35,57 +35,57 @@
3535
"type": "git",
3636
"subDir": null,
3737
"scope": "leanprover-community",
38-
"rev": "eb164a46de87078f27640ee71e6c3841defc2484",
38+
"rev": "a564b9c2252afef6e0d40613d4ec086b54ffe7df",
3939
"name": "importGraph",
4040
"manifestFile": "lake-manifest.json",
41-
"inputRev": "v4.22.0",
41+
"inputRev": "nightly-testing",
4242
"inherited": true,
4343
"configFile": "lakefile.toml"},
4444
{"url": "https://github.com/leanprover-community/ProofWidgets4",
4545
"type": "git",
4646
"subDir": null,
4747
"scope": "leanprover-community",
48-
"rev": "1253a071e6939b0faf5c09d2b30b0bfc79dae407",
48+
"rev": "557f2069977de1c95e68de09e693bc4d1eee7842",
4949
"name": "proofwidgets",
5050
"manifestFile": "lake-manifest.json",
51-
"inputRev": "v0.0.68",
51+
"inputRev": "v0.0.72-pre",
5252
"inherited": true,
5353
"configFile": "lakefile.lean"},
5454
{"url": "https://github.com/leanprover-community/aesop",
5555
"type": "git",
5656
"subDir": null,
5757
"scope": "leanprover-community",
58-
"rev": "1256a18522728c2eeed6109b02dd2b8f207a2a3c",
58+
"rev": "fc97e592e3e150370f17a12e3613e96252c4d3d0",
5959
"name": "aesop",
6060
"manifestFile": "lake-manifest.json",
61-
"inputRev": "v4.22.0",
61+
"inputRev": "nightly-testing",
6262
"inherited": true,
6363
"configFile": "lakefile.toml"},
6464
{"url": "https://github.com/leanprover-community/quote4",
6565
"type": "git",
6666
"subDir": null,
6767
"scope": "leanprover-community",
68-
"rev": "917bfa5064b812b7fbd7112d018ea0b4def25ab3",
68+
"rev": "345a958916d27982d4ecb4500fba0ebb21096651",
6969
"name": "Qq",
7070
"manifestFile": "lake-manifest.json",
71-
"inputRev": "v4.22.0",
71+
"inputRev": "master",
7272
"inherited": true,
7373
"configFile": "lakefile.toml"},
7474
{"url": "https://github.com/leanprover-community/batteries",
7575
"type": "git",
7676
"subDir": null,
7777
"scope": "leanprover-community",
78-
"rev": "240676e9568c254a69be94801889d4b13f3b249f",
78+
"rev": "b3a8bc5f8b72102ebbe4da3302432b196e215522",
7979
"name": "batteries",
8080
"manifestFile": "lake-manifest.json",
81-
"inputRev": "v4.22.0",
81+
"inputRev": "nightly-testing",
8282
"inherited": true,
8383
"configFile": "lakefile.toml"},
8484
{"url": "https://github.com/leanprover/lean4-cli",
8585
"type": "git",
8686
"subDir": null,
8787
"scope": "leanprover",
88-
"rev": "c682c91d2d4dd59a7187e2ab977ac25bd1f87329",
88+
"rev": "e22ed0883c7d7f9a7e294782b6b137b783715386",
8989
"name": "Cli",
9090
"manifestFile": "lake-manifest.json",
9191
"inputRev": "main",

0 commit comments

Comments
 (0)