Skip to content

Commit ffaf728

Browse files
committed
update to 4.7.0-rc2
1 parent 228c5f8 commit ffaf728

File tree

10 files changed

+29
-30
lines changed

10 files changed

+29
-30
lines changed

Etch/StreamFusion/Examples/Basic.lean

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,10 @@ def d2 : ℕ :=
4343

4444
-- With stream combinators
4545
example : ℕ := eval $ Σ i => (f $[i] predicate(i) * locations(i)) * counts(i)
46+
4647
--example : ℕ := eval $ Σ i => predicate(i) * (f $[i] locations(i)) * counts(i)
4748
def d3 : ℕ := eval $ Σ i => (f $[i] predicate(i) * (ArraySet.toSeqStream locations)(i)) * counts(i)
4849

49-
--def d2 : ℕ :=
50-
-- (locations.filter predicate).foldl
51-
-- (init := 0) (fun result key =>
52-
-- result + counts.findD (f key) 0)
53-
5450
#eval d1
5551
(locations := #["Hi", "There"])
5652
(HashMap.ofList [("HI", 10), ("THERE", 3)])

Etch/StreamFusion/Proofs/Imap.lean

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@ theorem IsLawful.imap {s : Stream ι α} [AddZeroClass α] [IsLawful s] {f : ι
5454
rintro q ⟨j₁, b⟩ j₂ hj
5555
dsimp only [imap_general_seek, imap_general_σ, imap_general_valid]
5656
dsimp at q
57-
suffices : ∀ i, f i = j₂ → s.eval (s.seek q (g (s.index q) j₁, b)) i = s.eval q i
58-
· sorry
57+
suffices ∀ i, f i = j₂ → s.eval (s.seek q (g (s.index q) j₁, b)) i = s.eval q i by sorry
5958
rintro i rfl
6059
by_cases le : s.index q ≤ i
6160
· apply ‹IsLawful s›.seek_spec
@@ -68,6 +67,4 @@ theorem IsLawful.imap {s : Stream ι α} [AddZeroClass α] [IsLawful s] {f : ι
6867
· refine lt_of_lt_of_le ?_ (s.mono q _)
6968
simpa using le
7069

71-
72-
7370
end Etch.Verification.Stream

Etch/StreamFusion/Proofs/StreamProof.lean

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import Mathlib.Tactic.Linarith
2+
import Mathlib.Order.Basic
23

34
import Etch.StreamFusion.Stream
45
import Etch.Verification.FinsuppLemmas
@@ -261,7 +262,7 @@ noncomputable def Stream.eval [AddZeroClass α] (s : Stream ι α) [IsBounded s]
261262
have : (s.advance q) ≺ q := s.next_wf ⟨q, h⟩
262263
s.eval₀ ⟨q, h⟩ + s.eval (s.advance q)
263264
else 0
264-
termination_by _ x => s.wf.wrap x
265+
termination_by x => s.wf.wrap x
265266

266267
@[simp] lemma Stream.eval_zero [AddZeroClass α] : (0 : Stream ι α).eval = 0 := by
267268
ext; rw [Stream.eval]; simp
@@ -283,10 +284,10 @@ end well_founded
283284
let acc' := if hr : hr then f acc i (value q hv hr) else acc
284285
go f valid ready index value next h acc' q'
285286
else acc
287+
termination_by s.wf.wrap q
288+
decreasing_by exact h q hv
286289
go f s.valid (fun q h => s.ready ⟨q,h⟩) (fun q h => s.index ⟨q,h⟩) (fun q v r => s.value ⟨⟨q,v⟩,r⟩) s.next
287290
(fun q hv => s.progress rfl.le) acc q
288-
termination_by _ => s.wf.wrap q
289-
decreasing_by exact h q hv
290291

291292
theorem Stream.fold_wf_spec [Preorder ι] (f : β → ι → α → β) (s : Stream ι α) [IsBounded s]
292293
(q : {q // s.valid q}) (acc : β) :
@@ -446,6 +447,10 @@ theorem Stream.IsStrictMono.eval_seek_eq_zero [AddZeroClass α] {s : Stream ι
446447
refine lt_of_lt_of_le ?_ (hs.1 _ _)
447448
simpa using fst_lt_of_lt_of_lt h₁ h₂
448449

450+
-- not sure why these are needed now
451+
instance instDecidableLT (x y : ι × Bool) [Decidable (x.1 < y.1)] [Decidable (x.2 < y.2)] : Decidable (x < y) := And.decidable
452+
instance (x y : ι × Bool) [Decidable (x.1 < y.1)] [Decidable (x.2 < y.2)] : Decidable (x <ₗ y) := inferInstance
453+
449454
theorem Stream.IsStrictMono.eval₀_eq_eval_filter [AddCommMonoid α] {s : Stream ι α} [IsBounded s]
450455
(hs : s.IsStrictMono) (q : {q // s.valid q}) :
451456
s.eval₀ q = (s.eval q).filter fun i => (i, false) <ₗ s.toOrder q := by

Etch/Util/ExpressionTree.lean

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Lean
22
import Std.Lean.Expr
3-
import Std.Data.Option.Basic
43
import Etch.Util.Labels
54

65
open Lean Elab Term Meta

Etch/Util/Labels.lean

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def LabelIdx.compareAux (x y : Nat) : Ordering :=
5252
| .eq => compareAux (x / 2) (y / 2)
5353
| .lt => .lt
5454
| .gt => .gt
55-
termination_by _ x y => x + y
55+
termination_by x + y
5656

5757
instance : Ord LabelIdx := ⟨fun x y => LabelIdx.compareAux x.data y.data⟩
5858
instance : LT LabelIdx := ⟨fun x y => compare x y == .lt⟩
@@ -81,7 +81,7 @@ def LabelIdx.freshBeforeAux (x y : Nat) : Nat :=
8181
2 * freshAfterAux (xb / 2)
8282
else
8383
panic! "x < y not true in freshBeforeAux"
84-
termination_by _ x y => y
84+
termination_by y
8585

8686
/-- Gives a label that is between `x` and `y`, assuming that `x < y`. -/
8787
def LabelIdx.freshBefore (x y : LabelIdx) : LabelIdx :=

Etch/Verification/FinsuppLemmas.lean

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import Mathlib.Data.Finsupp.Basic
22
import Mathlib.Data.Finsupp.Indicator
3+
import Mathlib.Data.Finsupp.Notation
34

45
variable {α β γ : Type _} [AddCommMonoid β]
56

Etch/Verification/Misc.lean

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import Mathlib.Data.List.FinRange
77
import Mathlib.Data.Option.Basic
88
import Mathlib.Data.PFun
99
import Mathlib.Data.Prod.Lex
10-
import Mathlib.Init.IteSimp
1110

1211
/-!
1312
This is a collection of miscellaneous lemmas. Not all of these are used;
@@ -328,19 +327,21 @@ theorem Finsupp.mul_single_eq_zero {ι β : Type _} [MulZeroClass β] (i₁ i₂
328327
exact hi
329328
#align finsupp.mul_single_eq_zero Finsupp.mul_single_eq_zero
330329

331-
theorem Finsupp.mul_filter {ι β : Type _} [MulZeroClass β] (P Q : ι → Prop) (f g : ι →₀ β) :
330+
variable {ι : Type _} (P Q : ι → Prop) [DecidablePred P] [DecidablePred Q]
331+
332+
theorem Finsupp.mul_filter {β : Type _} [MulZeroClass β] (f g : ι →₀ β) :
332333
f.filter P * g.filter Q = (f * g).filter fun i => P i ∧ Q i := by
333334
ext i
334335
by_cases h₁ : P i <;> by_cases h₂ : Q i <;> simp [h₁, h₂]
335336
#align finsupp.mul_filter Finsupp.mul_filter
336337

337-
theorem Finsupp.mul_filter' {ι β : Type _} [MulZeroClass β] (P : ι → Prop) (f g : ι →₀ β) :
338+
theorem Finsupp.mul_filter' {β : Type _} [MulZeroClass β] (f g : ι →₀ β) :
338339
(f * g).filter P = f.filter P * g.filter P := by simp [Finsupp.mul_filter]
339340
#align finsupp.mul_filter' Finsupp.mul_filter'
340341

341-
theorem Finsupp.filter_ext_iff {ι β : Type _} [AddZeroClass β] (P : ι → Prop) (f g : ι →₀ β) :
342+
theorem Finsupp.filter_ext_iff {β : Type _} [AddZeroClass β] (f g : ι →₀ β) :
342343
f.filter P = g.filter P ↔ ∀ a, P a → f a = g a := by classical
343-
simp [FunLike.ext_iff, Finsupp.filter_apply, apply_ite₂ (· = ·), ← imp_iff_not_or]
344+
simp [DFunLike.ext_iff, Finsupp.filter_apply, apply_ite₂ (· = ·), ← imp_iff_not_or]
344345
#align finsupp.filter_ext_iff Finsupp.filter_ext_iff
345346

346347
theorem mul_eq_zero_of {α : Type _} [MulZeroClass α] {x y : α} : x = 0 ∨ y = 0 → x * y = 0

lake-manifest.json

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
[{"url": "https://github.com/leanprover/std4",
55
"type": "git",
66
"subDir": null,
7-
"rev": "c1a3cdf748424810985b479d2712998921c7c797",
7+
"rev": "ff9850c4726f6b9fb8d8e96980c3fcb2900be8bd",
88
"name": "std",
99
"manifestFile": "lake-manifest.json",
1010
"inputRev": "main",
@@ -13,7 +13,7 @@
1313
{"url": "https://github.com/leanprover-community/quote4",
1414
"type": "git",
1515
"subDir": null,
16-
"rev": "1c88406514a636d241903e2e288d21dc6d861e01",
16+
"rev": "fd760831487e6835944e7eeed505522c9dd47563",
1717
"name": "Qq",
1818
"manifestFile": "lake-manifest.json",
1919
"inputRev": "master",
@@ -22,7 +22,7 @@
2222
{"url": "https://github.com/leanprover-community/aesop",
2323
"type": "git",
2424
"subDir": null,
25-
"rev": "69404390bdc1de946bf0a2e51b1a69f308e56d7a",
25+
"rev": "056ca0fa8f5585539d0b940f532d9750c3a2270f",
2626
"name": "aesop",
2727
"manifestFile": "lake-manifest.json",
2828
"inputRev": "master",
@@ -31,10 +31,10 @@
3131
{"url": "https://github.com/leanprover-community/ProofWidgets4",
3232
"type": "git",
3333
"subDir": null,
34-
"rev": "8dd18350791c85c0fc9adbd6254c94a81d260d35",
34+
"rev": "fb65c476595a453a9b8ffc4a1cea2db3a89b9cd8",
3535
"name": "proofwidgets",
3636
"manifestFile": "lake-manifest.json",
37-
"inputRev": "v0.0.25",
37+
"inputRev": "v0.0.30",
3838
"inherited": true,
3939
"configFile": "lakefile.lean"},
4040
{"url": "https://github.com/leanprover/lean4-cli",
@@ -49,7 +49,7 @@
4949
{"url": "https://github.com/leanprover-community/import-graph.git",
5050
"type": "git",
5151
"subDir": null,
52-
"rev": "6f42d2822aba47eb690ed98c508a23e6f0becce2",
52+
"rev": "64d082eeaad1a8e6bbb7c23b7a16b85a1715a02f",
5353
"name": "importGraph",
5454
"manifestFile": "lake-manifest.json",
5555
"inputRev": "main",
@@ -58,10 +58,10 @@
5858
{"url": "https://github.com/leanprover-community/mathlib4/",
5959
"type": "git",
6060
"subDir": null,
61-
"rev": "702f3fe16c773ae1e34fbf179342d0877f8cb4f1",
61+
"rev": "35909eaa5b71d0bd5a6e259b5cc9732132d977c7",
6262
"name": "mathlib",
6363
"manifestFile": "lake-manifest.json",
64-
"inputRev": "702f3fe16c773ae1e34fbf179342d0877f8cb4f1",
64+
"inputRev": "35909eaa5b71d0bd5a6e259b5cc9732132d977c7",
6565
"inherited": false,
6666
"configFile": "lakefile.lean"}],
6767
"name": "etch",

lakefile.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ lean_exe seq {
5151
lean_lib Etch.Verification.Semantics.Example
5252

5353
require mathlib from git
54-
"https://github.com/leanprover-community/mathlib4/"@"702f3fe16c773ae1e34fbf179342d0877f8cb4f1"
54+
"https://github.com/leanprover-community/mathlib4/"@"35909eaa5b71d0bd5a6e259b5cc9732132d977c7"

lean-toolchain

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
leanprover/lean4:v4.5.0-rc1
1+
leanprover/lean4:v4.7.0-rc2

0 commit comments

Comments
 (0)