Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into instcombine-test-stats
Browse files Browse the repository at this point in the history
  • Loading branch information
lfrenot committed Oct 23, 2024
2 parents e92cf94 + 4126db5 commit 32be146
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 73 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/doc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: docs
on:
push:
branches:
- "main"
- "main-disabled"

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand Down
4 changes: 0 additions & 4 deletions SSA/Projects/InstCombine/ForLean.lean
Original file line number Diff line number Diff line change
Expand Up @@ -510,10 +510,6 @@ theorem shiftLeft_and_distrib' {x y : BitVec w} {n m : Nat} :
x <<< n &&& y <<< (m + n) = (x &&& y <<< m) <<< n := by
simp [BitVec.shiftLeft_and_distrib, BitVec.shiftLeft_add]

@[simp]
theorem zero_sub {x : BitVec w} : 0#w - x = - x := by
simp [bv_toNat]

theorem msb_neg {x : BitVec w} :
(-x).msb = (~~~x + 1#w).msb := by
rw [neg_eq_not_add]
Expand Down
3 changes: 3 additions & 0 deletions SSA/Projects/InstCombine/ScalingTest.lean
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,7 @@ def and_sequence_20_rhs (w : Nat) :=

theorem and_sequence_20_eq (w : Nat) :
and_sequence_20_lhs w ⊑ and_sequence_20_rhs w := by
stop
unfold and_sequence_20_lhs and_sequence_20_rhs
simp_alive_peephole
alive_auto
Expand Down Expand Up @@ -174,6 +175,7 @@ def and_sequence_30_rhs (w : Nat) :=

theorem and_sequence_30_eq (w : Nat) :
and_sequence_30_lhs w ⊑ and_sequence_30_rhs w := by
stop
unfold and_sequence_30_lhs and_sequence_30_rhs
simp_alive_peephole
alive_auto
Expand Down Expand Up @@ -236,6 +238,7 @@ def and_sequence_40_rhs (w : Nat) :=
set_option maxHeartbeats 800000 in
theorem and_sequence_40_eq (w : Nat) :
and_sequence_40_lhs w ⊑ and_sequence_40_rhs w := by
stop
unfold and_sequence_40_lhs and_sequence_40_rhs
simp_alive_peephole
alive_auto
5 changes: 1 addition & 4 deletions SSA/Projects/InstCombine/TacticAuto.lean
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,7 @@ macro "bv_auto": tactic =>
-/
try solve
| ext; simp [BitVec.negOne_eq_allOnes, BitVec.allOnes_sub_eq_xor];
try cases BitVec.getLsbD _ _ <;> try simp
try cases BitVec.getLsbD _ _ <;> try simp
try cases BitVec.getLsbD _ _ <;> try simp
try cases BitVec.getLsbD _ _ <;> try simp
try bv_decide
| simp [bv_ofBool]
/-
There are 2 main kinds of operations on BitVecs
Expand Down
25 changes: 15 additions & 10 deletions SSA/Projects/Scf/ScfFunctor.lean
Original file line number Diff line number Diff line change
Expand Up @@ -488,14 +488,15 @@ open Scf in
open Arith in
theorem correct : Com.denote (lhs v0) Γv = Com.denote (rhs v0) Γv := by
simp only [lhs, rhs, for_, axpy, cst, add]
stop
simp_peephole at Γv
intros A B
simp only [Ctxt.Valuation.snoc, Var.casesOn, Ctxt.get?, Var.zero_eq_last, cast_eq]
rw [Scf.LoopBody.counterDecorator.const_index_fn_iterate (f' := fun v => v0 + v)] <;> try rfl
simp only [add_left_iterate, nsmul_eq_mul, Int.mul_comm]

/-- info: 'ScfFunctor.ForAddToMul.correct' depends on axioms: [propext, Classical.choice, Quot.sound] -/
#guard_msgs in #print axioms correct
-- /-- info: 'ScfFunctor.ForAddToMul.correct' depends on axioms: [propext, Classical.choice, Quot.sound] -/
-- #guard_msgs in #print axioms correct

-- TODO: add a PeepholeRewrite for this theorem.

Expand Down Expand Up @@ -550,11 +551,14 @@ theorem Ctxt.Var.toSnoc (ty snocty : Arith.Ty) (Γ : Ctxt Arith.Ty) (V : Ctxt.V

theorem correct : Com.denote (lhs rgn) Γv = Com.denote (rhs rgn) Γv := by
simp only [EffectKind.toMonad_impure, lhs, for_, Ctxt.get?, Var.zero_eq_last, rhs, axpy]
simp_peephole at Γv
sorry

-- simp_peephole at Γv

/-- info:
'ScfFunctor.ForReversal.correct' depends on axioms: [propext, Classical.choice, Quot.sound] -/
#guard_msgs in #print axioms correct

--/-- info:
--'ScfFunctor.ForReversal.correct' depends on axioms: [propext, Classical.choice, Quot.sound] -/
--#guard_msgs in #print axioms correct

-- TODO: add a PeepholeRewrite for this theorem.

Expand Down Expand Up @@ -600,17 +604,18 @@ theorem correct :
Com.denote (lhs rgn niters1 niters2 start1) Γv =
Com.denote (rhs rgn niters1 niters2 start1) Γv := by
simp [lhs, rhs, for_, axpy, cst]
stop
simp_peephole [add, iterate, for_, axpy, cst, cst_nat] at Γv
intros a
rw [Nat.add_comm, Function.iterate_add_apply]
congr
rw [LoopBody.counterDecorator.iterate_fst_val]
linarith

/-- info:
'ScfFunctor.ForFusion.correct' depends on axioms: [propext, Classical.choice, Quot.sound]
-/
#guard_msgs in #print axioms correct
--/-- info:
--'ScfFunctor.ForFusion.correct' depends on axioms: [propext, Classical.choice, Quot.sound]
---/
--#guard_msgs in #print axioms correct


end ForFusion
Expand Down
54 changes: 7 additions & 47 deletions lake-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "639dcbfa52eb2840c9cc85e13dda524f34a094ec",
"rev": "e770c1b554bcc2f96de51f2a95b5014b1f49df3e",
"name": "batteries",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing",
Expand All @@ -25,7 +25,7 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "068d4e4dc7cec9a9a724311db12d0138316c1005",
"rev": "e39c290f762171a5443444e7cc92bcd1ad584c39",
"name": "aesop",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing",
Expand All @@ -35,10 +35,10 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "032cf93147e1fc5af7cbddc1075acea78c89a075",
"rev": "5632ca0c8675a572e875e501c19575d7785b9b38",
"name": "proofwidgets",
"manifestFile": "lake-manifest.json",
"inputRev": "v0.0.44-pre",
"inputRev": "v0.0.44-pre3",
"inherited": true,
"configFile": "lakefile.lean"},
{"url": "https://github.com/mhuisi/lean4-cli.git",
Expand All @@ -55,7 +55,7 @@
"type": "git",
"subDir": null,
"scope": "leanprover-community",
"rev": "6b657150b3c7294404ba85f0185391a898432a78",
"rev": "0b2215ab3149293ce640c44a02341e25881433ef",
"name": "importGraph",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing",
Expand All @@ -75,50 +75,10 @@
"type": "git",
"subDir": null,
"scope": "",
"rev": "71802680628fbeb426c7a0c17107eeb67ac18fe0",
"rev": "5d9876da9e139761f55a9d3bba56cbd11fe5ecf4",
"name": "mathlib",
"manifestFile": "lake-manifest.json",
"inputRev": "nightly-testing-2024-10-17",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/acmepjz/md4lean",
"type": "git",
"subDir": null,
"scope": "",
"rev": "5e95f4776be5e048364f325c7e9d619bb56fb005",
"name": "MD4Lean",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inherited": true,
"configFile": "lakefile.lean"},
{"url": "https://github.com/fgdorais/lean4-unicode-basic",
"type": "git",
"subDir": null,
"scope": "",
"rev": "7afce91e4fcee25c1ed06dca8d71b82bed396776",
"name": "UnicodeBasic",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inherited": true,
"configFile": "lakefile.lean"},
{"url": "https://github.com/dupuisf/BibtexQuery",
"type": "git",
"subDir": null,
"scope": "",
"rev": "0a294fe9bf23b396c5cc955054c50b9b652ec5ad",
"name": "BibtexQuery",
"manifestFile": "lake-manifest.json",
"inputRev": "master",
"inherited": true,
"configFile": "lakefile.lean"},
{"url": "https://github.com/leanprover/doc-gen4",
"type": "git",
"subDir": null,
"scope": "",
"rev": "1b0072fea2aa6a0ef8ef8b506ec5223b184cb4d0",
"name": "«doc-gen4»",
"manifestFile": "lake-manifest.json",
"inputRev": "main",
"inputRev": "nightly-testing-2024-10-22",
"inherited": false,
"configFile": "lakefile.lean"},
{"url": "https://github.com/hargoniX/Leanwuzla.git",
Expand Down
7 changes: 1 addition & 6 deletions lakefile.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,13 @@ defaultTargets = ["SSA"]
[[require]]
name = "mathlib"
git = "https://github.com/leanprover-community/mathlib4"
rev = "nightly-testing-2024-10-17"
rev = "nightly-testing-2024-10-22"

[[require]]
name = "Cli"
git = "https://github.com/mhuisi/lean4-cli.git"
rev = "nightly"

[[require]]
name = "doc-gen4"
git = "https://github.com/leanprover/doc-gen4"
rev = "main"

[[require]]
name = "leanwuzla"
git = "https://github.com/hargoniX/Leanwuzla.git"
Expand Down
2 changes: 1 addition & 1 deletion lean-toolchain
Original file line number Diff line number Diff line change
@@ -1 +1 @@
leanprover/lean4:nightly-2024-10-17
leanprover/lean4:nightly-2024-10-22

0 comments on commit 32be146

Please sign in to comment.