task_id stringlengths 21 23 | challenge_id stringlengths 16 16 | proof_assistant stringclasses 1
value | session stringclasses 1
value | repo stringclasses 57
values | revision stringclasses 57
values | file_path stringlengths 13 92 | theory stringlengths 1 48 | variant int64 0 132 | challenge_type stringclasses 1
value | difficulty null | count null | by_centrality bool 1
class | ablation_prob float64 0.5 0.5 | min_depth int64 1 1 | max_depth int64 1 1 | leaves_only bool 1
class | min_size int64 0 0 | max_size stringclasses 1
value | min_centrality int64 0 0 | max_centrality stringclasses 1
value | seed int64 42 42 | n_proofs int64 1 173 | n_ablated int64 1 60 | holes_filled listlengths 1 60 | deleted_lemmas listlengths 1 1 | corollaries listlengths 1 1 | closure_size int64 1 172 | challenge_file_content stringlengths 133 350k | solution_file_content stringlengths 394 351k | solution_diff stringlengths 243 134k | manifest dict |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
ablate_ba76cea00de3_1 | c0850ad7591dddbe | lean | lean | github.com/AeneasVerif/aeneas | 483333f74278333101795c4e55dbf09e50763f37 | Aeneas/Data/BitVec.lean | BitVec | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 2 | [
{
"theorem_name": "BitVec.or_mod_two_pow_iff_true",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [BitVec.or_mod_two_pow]",
"n_chars": 39,
"n_subproofs": 0,
"n_tactics": 2,
"cyclom... | [
{
"name": "BitVec.or_mod_two_pow",
"text": "theorem BitVec.or_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :\n (a ||| b) % 2#n ^ k = (a % 2#n ^ k) ||| (b % 2#n ^ k) := by\n by_cases k < n <;> natify <;> simp\n · have : 2 ^ k < 2 ^ n := by simp_scalar\n cases k\n · simp; simp_scalar; rfl\n · ... | [
{
"name": "BitVec.or_mod_two_pow_iff_true",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 6,
"n_chars": 196,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": true,
... | 1 | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | @@ -604,13 +604,29 @@
BitVec.getElem!_eq_false x (8 * i + j) hw]
· exact BitVec.testBit_toNat_eq_false _ j (by omega)
+theorem BitVec.or_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :
+ (a ||| b) % 2#n ^ k = (a % 2#n ^ k) ||| (b % 2#n ^ k) := by
+ by_cases k < n <;> natify <;> simp
+ · have : 2... | {
"repo": "aeneas",
"git_repo": "github.com/AeneasVerif/aeneas",
"revision": "483333f74278333101795c4e55dbf09e50763f37",
"lean_toolchain": "leanprover/lean4:v4.31.0",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--corollary-delete-lemm... |
ablate_ba76cea00de3_2 | ae55ee58853e717b | lean | lean | github.com/AeneasVerif/aeneas | 483333f74278333101795c4e55dbf09e50763f37 | Aeneas/Data/BitVec.lean | BitVec | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 2 | [
{
"theorem_name": "BitVec.and_mod_two_pow_iff_true",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [BitVec.and_mod_two_pow]",
"n_chars": 40,
"n_subproofs": 0,
"n_tactics": 2,
"cycl... | [
{
"name": "BitVec.and_mod_two_pow",
"text": "theorem BitVec.and_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :\n (a &&& b) % 2#n ^ k = (a % 2#n ^ k) &&& (b % 2#n ^ k) := by\n by_cases k < n <;> natify <;> simp\n · have : 2 ^ k < 2 ^ n := by simp_scalar\n cases k\n · simp; simp_scalar; rfl\n ... | [
{
"name": "BitVec.and_mod_two_pow_iff_true",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 6,
"n_chars": 198,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": true,
... | 1 | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | @@ -628,13 +628,29 @@
((a % 2#n ^ k) ||| (b % 2#n ^ k) = (a ||| b) % 2#n ^ k) ↔ True := by
simp only [BitVec.or_mod_two_pow]
+theorem BitVec.and_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :
+ (a &&& b) % 2#n ^ k = (a % 2#n ^ k) &&& (b % 2#n ^ k) := by
+ by_cases k < n <;> natify <;> simp
+ · have : 2 ^... | {
"repo": "aeneas",
"git_repo": "github.com/AeneasVerif/aeneas",
"revision": "483333f74278333101795c4e55dbf09e50763f37",
"lean_toolchain": "leanprover/lean4:v4.31.0",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--corollary-delete-lemm... |
ablate_ba76cea00de3_3 | 69873e3d148b2650 | lean | lean | github.com/AeneasVerif/aeneas | 483333f74278333101795c4e55dbf09e50763f37 | Aeneas/Data/BitVec.lean | BitVec | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 2 | [
{
"theorem_name": "BitVec.xor_mod_two_pow_iff_true",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [BitVec.xor_mod_two_pow]",
"n_chars": 40,
"n_subproofs": 0,
"n_tactics": 2,
"cycl... | [
{
"name": "BitVec.xor_mod_two_pow",
"text": "theorem BitVec.xor_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :\n (a ^^^ b) % 2#n ^ k = (a % 2#n ^ k) ^^^ (b % 2#n ^ k) := by\n by_cases k < n <;> natify <;> simp\n · have : 2 ^ k < 2 ^ n := by simp_scalar\n cases k\n · simp; simp_scalar; rfl\n ... | [
{
"name": "BitVec.xor_mod_two_pow_iff_true",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 6,
"n_chars": 198,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": true,
... | 1 | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | import Init.Data.List.OfFn
import Init.Data.BitVec.Lemmas
import Batteries.Data.BitVec.Lemmas
import Mathlib.Data.Nat.Basic
import Mathlib.Data.Fin.Basic
import Mathlib.Data.Nat.Cast.Basic
import Mathlib.Data.BitVec
import Mathlib.Tactic.Ring
import Mathlib.Data.Nat.Bitwise
import Aeneas.Data.Byte
import Aeneas.Tactic.... | @@ -652,13 +652,29 @@
((a % 2#n ^ k) &&& (b % 2#n ^ k) = (a &&& b) % 2#n ^ k) ↔ True := by
simp only [BitVec.and_mod_two_pow]
+theorem BitVec.xor_mod_two_pow {n : Nat} (a b : BitVec n) (k : Nat) :
+ (a ^^^ b) % 2#n ^ k = (a % 2#n ^ k) ^^^ (b % 2#n ^ k) := by
+ by_cases k < n <;> natify <;> simp
+ · have : 2 ... | {
"repo": "aeneas",
"git_repo": "github.com/AeneasVerif/aeneas",
"revision": "483333f74278333101795c4e55dbf09e50763f37",
"lean_toolchain": "leanprover/lean4:v4.31.0",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--corollary-delete-lemm... |
ablate_a34dad4c02af_0 | b0eccbf3742ad71a | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagUnify.lean | FlagUnify | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 1 | [
{
"theorem_name": "fuCheck_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 184,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold fuCheck at h\n cases hd : fuPairData? bs facts domCs biX biY x with\n | none => rw [hd] at h; simp at h\n | some ... | [
{
"name": "residue_uniq",
"text": "/-- Two summands below `M` that complete the same integer against multiples of `M` are equal. -/\ntheorem residue_uniq (M A B w1 w2 : Nat) (h : M * A + w1 = M * B + w2)\n (h1 : w1 < M) (h2 : w2 < M) : w1 = w2 := by\n have e1 : (M * A + w1) % M = w1 := by rw [Nat.mul_ad... | [
{
"name": "fuCheck_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 195,
"n_chars": 12172,
"n_subproofs": 44,
"n_tactics": 196,
"cyclomatic": 11,
"n_automation": 36,
"n_rewrites": 34,
"n_structural": 31,
"automation_only": false,
"ma... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
set_option autoImplicit false
/-! # Flag unification across duplicate scaled range checks
After the two-root unification (`RootPairUnify.lean`) both the surviving and the eliminated
memory access range-check the **same** low limb `x`, each through its ... | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
set_option autoImplicit false
/-! # Flag unification across duplicate scaled range checks
After the two-root unification (`RootPairUnify.lean`) both the surviving and the eliminated
memory access range-check the **same** low limb `x`, each through its ... | @@ -22,6 +22,15 @@
variable {p : ℕ}
+/-- Two summands below `M` that complete the same integer against multiples of `M` are equal. -/
+theorem residue_uniq (M A B w1 w2 : Nat) (h : M * A + w1 = M * B + w2)
+ (h1 : w1 < M) (h2 : w2 < M) : w1 = w2 := by
+ have e1 : (M * A + w1) % M = w1 := by rw [Nat.mul_add_mod... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_0389ef93493f_0 | a12747794abbf8dc | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/RootPairUnify.lean | RootPairUnify | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 2 | [
{
"theorem_name": "twoRootOf?_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 41,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold twoRootOf? at h\n split at h\n case h_2 => exact absurd h (by simp)\n case h_1 f1 f2 =>\n cases hl1 : linear... | [
{
"name": "LinExpr.eval_of_terms_eq",
"text": "/-- Two normalized linear forms with equal term lists evaluate a constant apart. -/\ntheorem LinExpr.eval_of_terms_eq (a b : LinExpr p) (h : b.terms = a.terms)\n (env : Variable → ZMod p) : b.eval env = a.eval env + (b.const - a.const) := by\n simp only [Li... | [
{
"name": "twoRootOf?_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 2,
"n_lines": 46,
"n_chars": 2328,
"n_subproofs": 10,
"n_tactics": 44,
"cyclomatic": 4,
"n_automation": 11,
"n_rewrites": 10,
"n_structural": 8,
"automation_only": false,
"max_... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | @@ -62,6 +62,11 @@
/-! ## Recognizing a two-root constraint -/
+/-- Two normalized linear forms with equal term lists evaluate a constant apart. -/
+theorem LinExpr.eval_of_terms_eq (a b : LinExpr p) (h : b.terms = a.terms)
+ (env : Variable → ZMod p) : b.eval env = a.eval env + (b.const - a.const) := by
+ sim... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_0389ef93493f_1 | 2a8d1405391f0531 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/RootPairUnify.lean | RootPairUnify | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "le_foldl_max",
"depth": 1,
"n_commands": 0,
"n_lines": 8,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction l with\n | nil => intro b a ha; simp at ha\n | cons c rest ih =>\n intro b a ha\n rcases List.mem_cons.1 ha ... | [
{
"name": "init_le_foldl_max",
"text": "/-- The seed is at most the `foldl max` accumulation. -/\ntheorem init_le_foldl_max (l : List Nat) : ∀ b : Nat, b ≤ l.foldl max b := by\n induction l with\n | nil => intro b; simp\n | cons c rest ih => intro b; exact le_trans (le_max_left b c) (ih (max b c))\n\n",
... | [
{
"name": "le_foldl_max",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 11,
"n_chars": 405,
"n_subproofs": 0,
"n_tactics": 9,
"cyclomatic": 3,
"n_automation": 2,
"n_rewrites": 0,
"n_structural": 6,
"automation_only": false,
"max_nesting":... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | @@ -235,6 +235,12 @@
`x = k⁻¹·slot − k⁻¹·R` is bounded once the offset part enumerates over its (tiny, provable)
flag domains: `x.val < m.val·(bound−1) + Wmax + 1`, provided nothing wraps `p`. -/
+/-- The seed is at most the `foldl max` accumulation. -/
+theorem init_le_foldl_max (l : List Nat) : ∀ b : Nat, b ≤ l.f... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_0389ef93493f_2 | 22ec8681d7de9d2e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/RootPairUnify.lean | RootPairUnify | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "scaledSlotBound_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 93,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold scaledSlotBound at h\n cases hmv : bi.multiplicity.constValue? with\n | none => rw [hmv] at h; simp at h\n ... | [
{
"name": "le_foldl_max",
"text": "/-- Everything in a list is at most its `foldl max` accumulation. -/\ntheorem le_foldl_max (l : List Nat) : ∀ (b : Nat), ∀ a ∈ l, a ≤ l.foldl max b := by\n induction l with\n | nil => intro b a ha; simp at ha\n | cons c rest ih =>\n intro b a ha\n rcases List.mem_... | [
{
"name": "scaledSlotBound_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 3,
"n_lines": 100,
"n_chars": 5094,
"n_subproofs": 22,
"n_tactics": 96,
"cyclomatic": 6,
"n_automation": 21,
"n_rewrites": 16,
"n_structural": 23,
"automation_only": false,
... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | @@ -241,6 +241,16 @@
| nil => intro b; simp
| cons c rest ih => intro b; exact le_trans (le_max_left b c) (ih (max b c))
+/-- Everything in a list is at most its `foldl max` accumulation. -/
+theorem le_foldl_max (l : List Nat) : ∀ (b : Nat), ∀ a ∈ l, a ≤ l.foldl max b := by
+ induction l with
+ | nil => intr... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_0389ef93493f_3 | b0a9253e10368c3e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/RootPairUnify.lean | RootPairUnify | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "anyVarBound_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold anyVarBound at h\n cases hfb : findVarBound bs facts bis x with\n | some B' =>\n simp only [hfb, Option.some... | [
{
"name": "scaledSlotBound_sound",
"text": "theorem scaledSlotBound_sound [Fact p.Prime] (bs : BusSemantics p) (facts : BusFacts p bs)\n (domCs : List (Expression p)) (bi : BusInteraction (Expression p)) (x : Variable)\n (B : Nat) (h : scaledSlotBound bs facts domCs bi x = some B) (env : Variable → ZM... | [
{
"name": "anyVarBound_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 4,
"n_lines": 20,
"n_chars": 877,
"n_subproofs": 1,
"n_tactics": 10,
"cyclomatic": 2,
"n_automation": 2,
"n_rewrites": 1,
"n_structural": 4,
"automation_only": false,
"max_nes... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | @@ -284,6 +284,105 @@
else none
else none)
+theorem scaledSlotBound_sound [Fact p.Prime] (bs : BusSemantics p) (facts : BusFacts p bs)
+ (domCs : List (Expression p)) (bi : BusInteraction (Expression p)) (x : Variable)
+ (B : Nat) (h : scaledSlotBound bs facts domCs bi x = some B) (e... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_0389ef93493f_4 | d56254b78b22b38c | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/RootPairUnify.lean | RootPairUnify | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "rpCheckPair_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 34,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold rpCheckPair at h\n cases hx : twoRootOf? cX x with\n | none => rw [hx] at h; simp at h\n | some t =>\n obta... | [
{
"name": "anyVarBound_sound",
"text": "theorem anyVarBound_sound [Fact p.Prime] (bs : BusSemantics p) (facts : BusFacts p bs)\n (bis : List (BusInteraction (Expression p))) (domCs : List (Expression p))\n (x : Variable) (B : Nat) (h : anyVarBound bs facts bis domCs x = some B)\n (env : Variable → ... | [
{
"name": "rpCheckPair_sound",
"fan_in": 0,
"n_deps_direct": 4,
"n_deps_transitive": 9,
"n_lines": 44,
"n_chars": 2081,
"n_subproofs": 6,
"n_tactics": 39,
"cyclomatic": 5,
"n_automation": 6,
"n_rewrites": 10,
"n_structural": 9,
"automation_only": false,
"max_n... | 9 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Two-root decomposition unification (bounded-integer reasoning)
Memory-pointer decompositions pin each limb by a **two-root carry constraint**
`(A + k·x) · (A + δ ... | @@ -391,6 +391,25 @@
| some B => some B
| none => bis.findSome? (fun bi => scaledSlotBound bs facts domCs bi x)
+theorem anyVarBound_sound [Fact p.Prime] (bs : BusSemantics p) (facts : BusFacts p bs)
+ (bis : List (BusInteraction (Expression p))) (domCs : List (Expression p))
+ (x : Variable) (B : Nat) (h... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_546d71dc5f68_0 | fa0613480c57f792 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Gauss.lean | Gauss | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 1 | [
{
"theorem_name": "eval_reduce",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n rw [Expression.normalize_eval, Expression.eval_substF, σ.envF_self env hsat]",
"n_chars": 83,
"n_subproofs": 0,
"n_... | [
{
"name": "envF_self",
"text": "/-- Under a satisfying assignment, rebinding by the solution map changes nothing. -/\ntheorem envF_self (σ : Solved p cs bs) (env : Variable → ZMod p)\n (hsat : cs.satisfies bs env) : envF σ.fn env = env :=\n envF_eq_self σ.fn env (fun y t hyt => σ.sound env hsat y t hyt)... | [
{
"name": "eval_reduce",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 8,
"n_chars": 370,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 0,
"automation_only": false,
"max_nesting": 2... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Batch linear elimination (Gaussian elimination... | import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Batch linear elimination (Gaussian elimination... | @@ -82,11 +82,17 @@
/-- The map as a lookup function (what `substF` consumes). -/
def fn (σ : Solved p cs bs) : Variable → Option (Expression p) := fun y => σ.map[y]?
+/-- Under a satisfying assignment, rebinding by the solution map changes nothing. -/
+theorem envF_self (σ : Solved p cs bs) (env : Variable → ZMod ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_72bd20866c9a_0 | ddf3f25a32bb7819 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CarryBranch.lean | CarryBranch | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "linNeverZeroSplit",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro h0\n haveI : NeZero p := ⟨hp.ne'⟩\n have hcp : l.const.val < p := ZMod.val_lt l.const\n obtain ⟨P, N, hsum, hPl... | [
{
"name": "splitSum_val",
"text": "theorem splitSum_val (B : Std.HashMap Variable Nat)\n (terms : List (Variable × ZMod p)) (mp mn : Nat)\n (h : splitSumMax B terms = some (mp, mn)) (hmp : mp < p) (hmn : mn < p)\n (env : Variable → ZMod p)\n (hB : ∀ v bound, B[v]? = some bound → (env v).val < bo... | [
{
"name": "linNeverZeroSplit",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 23,
"n_chars": 993,
"n_subproofs": 4,
"n_tactics": 13,
"cyclomatic": 1,
"n_automation": 4,
"n_rewrites": 2,
"n_structural": 2,
"automation_only": false,
"max_nes... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | @@ -50,6 +50,51 @@
else none
| _, _ => none
+theorem splitSum_val (B : Std.HashMap Variable Nat)
+ (terms : List (Variable × ZMod p)) (mp mn : Nat)
+ (h : splitSumMax B terms = some (mp, mn)) (hmp : mp < p) (hmn : mn < p)
+ (env : Variable → ZMod p)
+ (hB : ∀ v bound, B[v]? = some bound → (env... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_72bd20866c9a_1 | 99c2483b6386474e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CarryBranch.lean | CarryBranch | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "intervalCert_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 8,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold intervalCert at h\n split at h\n · exact absurd h (by simp)\n · rename_i acc hacc\n obtain ⟨mp, mn⟩ := acc\... | [
{
"name": "linNeverZeroSplit",
"text": "/-- The never-zero certificate: an affine form whose bounded value interval\n `[const.val − maxNeg, const.val + maxPos]` stays strictly inside `(0, p)` can never evaluate\n to zero. Two-sided generalization of `linNeverZero`. -/\ntheorem linNeverZeroSplit (B : S... | [
{
"name": "neverZeroB_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 3,
"n_lines": 19,
"n_chars": 679,
"n_subproofs": 2,
"n_tactics": 12,
"cyclomatic": 2,
"n_automation": 1,
"n_rewrites": 3,
"n_structural": 4,
"automation_only": false,
"max_nest... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | @@ -95,6 +95,28 @@
· rw [ZMod.val_add_of_lt haddlt, hheadval]; omega
case _ => exact absurd h (by simp)
+/-- The never-zero certificate: an affine form whose bounded value interval
+ `[const.val − maxNeg, const.val + maxPos]` stays strictly inside `(0, p)` can never evaluate
+ to zero. Two-sid... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_72bd20866c9a_2 | 46e446d48d6b65f2 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CarryBranch.lean | CarryBranch | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "neverZeroB_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 12,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold neverZeroB at h\n split at h\n · exact absurd h (by simp)\n · rename_i l hl\n rw [List.any_eq_true] at h\n ... | [
{
"name": "intervalCert_sound",
"text": "theorem intervalCert_sound (hp : 0 < p) (B : Std.HashMap Variable Nat) (l : LinExpr p)\n (h : intervalCert B l = true) (env : Variable → ZMod p)\n (hB : ∀ v bound, B[v]? = some bound → (env v).val < bound) :\n l.eval env ≠ 0 := by\n unfold intervalCert at h... | [
{
"name": "resolveMap_correct",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 6,
"n_lines": 45,
"n_chars": 2089,
"n_subproofs": 3,
"n_tactics": 36,
"cyclomatic": 6,
"n_automation": 2,
"n_rewrites": 1,
"n_structural": 23,
"automation_only": false,
"max_... | 6 | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Carry-branch resolution (interval analysis on product factors)
Byte-decomposed adders leave degree-2 *carry-branch* constraints of the shape
`(b₀ − a₀) · (b₀ − a₀ − 256) = 0` — "the difference is either `0` or `256`". ... | @@ -124,6 +124,18 @@
| some acc =>
decide (acc.2 < l.const.val) && decide (l.const.val + acc.1 < p)
+theorem intervalCert_sound (hp : 0 < p) (B : Std.HashMap Variable Nat) (l : LinExpr p)
+ (h : intervalCert B l = true) (env : Variable → ZMod p)
+ (hB : ∀ v bound, B[v]? = some bound → (env v).val < boun... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_6ad1765b2ee3_0 | af7156ebfbc7e3ff | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/ByteCheckPack.lean | ByteCheckPack | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 1 | [
{
"theorem_name": "svCheck?_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 63,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold svCheck? at h\n split at h\n case h_2 => exact absurd h (by simp)\n case h_1 e1 e2 e3 e4 hpay =>\n -- payload ... | [
{
"name": "isByteCompl_sound",
"text": "theorem isByteCompl_sound (a b : Expression p) (h : isByteCompl a b = true)\n (env : Variable → ZMod p) : b.eval env = 255 - a.eval env := by\n unfold isByteCompl at h\n have hc : (Expression.add b (.mul (.const (-1)) (complExpr a))).normalize.constValue? = some ... | [
{
"name": "svCheck?_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 72,
"n_chars": 4017,
"n_subproofs": 23,
"n_tactics": 74,
"cyclomatic": 2,
"n_automation": 21,
"n_rewrites": 17,
"n_structural": 28,
"automation_only": false,
"max_n... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.TupleRange
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Generalized single-value byte-check packing (`byteCheckPackPass`)
On a bitwise-style lookup bus a ... | import ApcOptimizer.Implementation.OptimizerPasses.TupleRange
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Generalized single-value byte-check packing (`byteCheckPackPass`)
On a bitwise-style lookup bus a ... | @@ -45,6 +45,19 @@
def isByteCompl (a b : Expression p) : Bool :=
(Expression.add b (.mul (.const (-1)) (complExpr a))).normalize.constValue? == some 0
+theorem isByteCompl_sound (a b : Expression p) (h : isByteCompl a b = true)
+ (env : Variable → ZMod p) : b.eval env = 255 - a.eval env := by
+ unfold isByte... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ef8bbea1e2be_0 | c638e7cbb87184ee | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainBatch.lean | DomainBatch | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 15 | 2 | [
{
"theorem_name": "envOfFast_eq",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n funext y\n induction a with\n | nil => rfl\n | cons t rest ih =>\n obtain ⟨x, v⟩ := t\n simp only [envOfFast, envOf]... | [
{
"name": "varFastEq_iff",
"text": "/-- `(y.powdrId? == x.powdrId? && y.name == x.name) = true` decides `y = x` (both fields agree),\n but checks the cheap `powdrId?` first. -/\ntheorem varFastEq_iff (y x : Variable) :\n ((y.powdrId? == x.powdrId? && y.name == x.name) = true) ↔ y = x := by\n rw [Bool... | [
{
"name": "envOfFast_eq",
"fan_in": 2,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 12,
"n_chars": 380,
"n_subproofs": 1,
"n_tactics": 11,
"cyclomatic": 2,
"n_automation": 2,
"n_rewrites": 2,
"n_structural": 4,
"automation_only": false,
"max_nesting"... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | @@ -254,6 +254,15 @@
overwhelmingly common mismatched entries. It is extensionally equal to `envOf` (`envOfFast_eq`),
so every soundness lemma reduces to the `envOf` versions by rewriting with that one equation. -/
+/-- `(y.powdrId? == x.powdrId? && y.name == x.name) = true` decides `y = x` (both fields agree),
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ef8bbea1e2be_1 | c45d93c6aafc383d | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainBatch.lean | DomainBatch | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 15 | 1 | [
{
"theorem_name": "compileE_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 36,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e generalizing ie with\n | const n =>\n simp only [compileE, Option.some.injEq] at h\n subst h\n rfl\n ... | [
{
"name": "varIx_lookup",
"text": "/-- Positional lookup at `y`'s first position is exactly the `envOfFast` scan, on any\n assignment with the given keys. -/\ntheorem varIx_lookup (keys : List Variable) (y : Variable) (i : Nat)\n (h : varIx keys y = some i) (pt : List (Variable × ZMod p))\n (hpt : ... | [
{
"name": "compileE_eval",
"fan_in": 3,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 40,
"n_chars": 1423,
"n_subproofs": 1,
"n_tactics": 40,
"cyclomatic": 6,
"n_automation": 9,
"n_rewrites": 16,
"n_structural": 11,
"automation_only": false,
"max_nest... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | @@ -349,6 +349,31 @@
if (y.powdrId? == x.powdrId? && y.name == x.name) = true then some 0
else (varIx rest y).map (· + 1)
+/-- Positional lookup at `y`'s first position is exactly the `envOfFast` scan, on any
+ assignment with the given keys. -/
+theorem varIx_lookup (keys : List Variable) (y : Variable)... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ef8bbea1e2be_2 | b92fa21682cba68f | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainBatch.lean | DomainBatch | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 15 | 3 | [
{
"theorem_name": "compileEs_map",
"depth": 1,
"n_commands": 0,
"n_lines": 19,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction es generalizing ces with\n | nil =>\n simp only [compileEs, Option.some.injEq] at h\n subst h\n rfl\n |... | [
{
"name": "compileE_eval",
"text": "theorem compileE_eval (keys : List Variable) (e : Expression p) (ie : IExpr p)\n (h : compileE keys e = some ie) (pt : List (Variable × ZMod p))\n (hpt : pt.map Prod.fst = keys) : ie.eval pt = e.eval (envOfFast pt) := by\n induction e generalizing ie with\n | cons... | [
{
"name": "compileEs_map",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 24,
"n_chars": 865,
"n_subproofs": 0,
"n_tactics": 21,
"cyclomatic": 4,
"n_automation": 5,
"n_rewrites": 7,
"n_structural": 5,
"automation_only": false,
"max_nesting... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | @@ -387,6 +387,45 @@
| some ia, some ib => some (.mul ia ib)
| _, _ => none
+theorem compileE_eval (keys : List Variable) (e : Expression p) (ie : IExpr p)
+ (h : compileE keys e = some ie) (pt : List (Variable × ZMod p))
+ (hpt : pt.map Prod.fst = keys) : ie.eval pt = e.eval (envOfFast pt) := by
+ i... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ef8bbea1e2be_3 | 55b5370718cc827e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainBatch.lean | DomainBatch | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 15 | 1 | [
{
"theorem_name": "scanInit_some",
"depth": 1,
"n_commands": 0,
"n_lines": 27,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction pts with\n | nil => exact absurd h (by simp [scanInit])\n | cons pt rest ih =>\n rw [scanInit] at h\n by_c... | [
{
"name": "scanWith_agrees",
"text": "/-- The intersection certificate: every candidate returned by `scanWith` was among the input\n candidates and agrees with every surviving point of the scanned list. -/\ntheorem scanWith_agrees (surv : List (Variable × ZMod p) → Bool)\n (pts : List (List (Variable ... | [
{
"name": "scanInit_some",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 35,
"n_chars": 1306,
"n_subproofs": 3,
"n_tactics": 27,
"cyclomatic": 5,
"n_automation": 4,
"n_rewrites": 6,
"n_structural": 17,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | @@ -771,6 +771,41 @@
some (scanWith surv rest (keys.map (fun x => (x, envOfFast pt x))))
else scanInit surv keys rest
+/-- The intersection certificate: every candidate returned by `scanWith` was among the input
+ candidates and agrees with every surviving point of the scanned list. -/
+theorem scanWit... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ef8bbea1e2be_4 | 5b736b8af4d77f6b | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainBatch.lean | DomainBatch | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 15 | 2 | [
{
"theorem_name": "restriction_survives",
"depth": 1,
"n_commands": 0,
"n_lines": 29,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have hkeys : doms.map Prod.fst = xs := T.doms_fst xs doms hdoms\n set a₀ := doms.map (fun yd => (yd.1, env yd.1)) wi... | [
{
"name": "envOfFast_eq",
"text": "theorem envOfFast_eq (a : List (Variable × ZMod p)) : envOfFast a = envOf a := by\n funext y\n induction a with\n | nil => rfl\n | cons t rest ih =>\n obtain ⟨x, v⟩ := t\n simp only [envOfFast, envOf]\n by_cases hyx : y = x\n · rw [if_pos ((varFastEq_iff y ... | [
{
"name": "scanForced_sound",
"fan_in": 0,
"n_deps_direct": 4,
"n_deps_transitive": 7,
"n_lines": 31,
"n_chars": 1791,
"n_subproofs": 5,
"n_tactics": 14,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 3,
"n_structural": 4,
"automation_only": false,
"max_nes... | 7 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.CoveredIndex
set_option autoImplicit false
/-! # Batch finite-domain propagation
`domainPropPass` substitutes one forced variable per invocation, a... | @@ -270,6 +270,17 @@
| (x, v) :: rest, y =>
if (y.powdrId? == x.powdrId? && y.name == x.name) = true then v else envOfFast rest y
+theorem envOfFast_eq (a : List (Variable × ZMod p)) : envOfFast a = envOf a := by
+ funext y
+ induction a with
+ | nil => rfl
+ | cons t rest ih =>
+ obtain ⟨x, v⟩ := t
... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_82c2f86a1330_0 | 69baa802ce1bc71e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/MemoryBusDrop.lean | MemoryBusDrop | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 1 | [
{
"theorem_name": "admissibleMemoryBus_dropPair",
"depth": 1,
"n_commands": 0,
"n_lines": 38,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n -- Step 1: remove `S₀`. `A ++ S₀ :: B ++ R₀ :: C = A ++ S₀ :: (B ++ R₀ :: C)`.\n have hadm1 : admissibleMemo... | [
{
"name": "admissibleMemoryBus_dropOne",
"text": "/-- Removing a single interaction `e` from an `admissibleMemoryBus` list preserves the discipline,\n provided `e` is inactive or **every active same-address send in `P` is followed by an active\n same-address receive in `P`** (the *shield* condition; s... | [
{
"name": "admissibleMemoryBus_dropPair",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 57,
"n_chars": 3682,
"n_subproofs": 9,
"n_tactics": 33,
"cyclomatic": 3,
"n_automation": 5,
"n_rewrites": 2,
"n_structural": 10,
"automation_only": false,... | 1 | import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Dropping matched send/receive pairs preserves `admissibleMemoryBus`
The `MemoryBus`-level machinery behind the pair-cancellation pass (`OptimizerPasses/BusPairCancel`).
When a memory access chain leaves a *send* `S` (multiplicity `1`) and a later *rec... | import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Dropping matched send/receive pairs preserves `admissibleMemoryBus`
The `MemoryBus`-level machinery behind the pair-cancellation pass (`OptimizerPasses/BusPairCancel`).
When a memory access chain leaves a *send* `S` (multiplicity `1`) and a later *rec... | @@ -19,6 +19,86 @@
/-! ## List split/filter/map plumbing (used to transport the shield across `filter`/`map`) -/
+/-- Removing a single interaction `e` from an `admissibleMemoryBus` list preserves the discipline,
+ provided `e` is inactive or **every active same-address send in `P` is followed by an active
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_2784655e81ae_0 | 83520b96554d52dd | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/MonicScale.lean | MonicScale | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "monicScale_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 14,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e with\n | const n => exact monicScaleAffine_eval _ env\n | var y => exact monicScaleAffine_eval _ env\n | ad... | [
{
"name": "monicScaleAffine_eval",
"text": "theorem monicScaleAffine_eval (e : Expression p) (env : Variable → ZMod p) :\n (monicScaleAffine e).1.eval env = (monicScaleAffine e).2.1 * e.eval env := by\n unfold monicScaleAffine\n split\n · simp\n · rename_i l hlin\n split\n · rename_i y k rest h... | [
{
"name": "monicScale_eval",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 17,
"n_chars": 643,
"n_subproofs": 0,
"n_tactics": 14,
"cyclomatic": 3,
"n_automation": 1,
"n_rewrites": 5,
"n_structural": 5,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | @@ -36,6 +36,21 @@
else (e, 1, 1)
| [] => (e, 1, 1)
+theorem monicScaleAffine_eval (e : Expression p) (env : Variable → ZMod p) :
+ (monicScaleAffine e).1.eval env = (monicScaleAffine e).2.1 * e.eval env := by
+ unfold monicScaleAffine
+ split
+ · simp
+ · rename_i l hlin
+ split
+ · rename... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_2784655e81ae_1 | 5f47d6276841127a | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/MonicScale.lean | MonicScale | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "monicScale_unit",
"depth": 1,
"n_commands": 0,
"n_lines": 16,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e with\n | const n => exact monicScaleAffine_unit _\n | var y => exact monicScaleAffine_unit _\n | add a b _ ... | [
{
"name": "monicScaleAffine_unit",
"text": "theorem monicScaleAffine_unit (e : Expression p) :\n (monicScaleAffine e).2.1 * (monicScaleAffine e).2.2 = 1 := by\n unfold monicScaleAffine\n split\n · simp\n · split\n · rename_i y k rest ht\n split_ifs with hk\n · simpa [mul_comm] using hk.1... | [
{
"name": "monicScale_unit",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 19,
"n_chars": 747,
"n_subproofs": 0,
"n_tactics": 16,
"cyclomatic": 3,
"n_automation": 1,
"n_rewrites": 3,
"n_structural": 6,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | @@ -51,6 +51,18 @@
· simp
· simp
+theorem monicScaleAffine_unit (e : Expression p) :
+ (monicScaleAffine e).2.1 * (monicScaleAffine e).2.2 = 1 := by
+ unfold monicScaleAffine
+ split
+ · simp
+ · split
+ · rename_i y k rest ht
+ split_ifs with hk
+ · simpa [mul_comm] using hk.1
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_2784655e81ae_2 | 256d944775f3dea5 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/MonicScale.lean | MonicScale | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "monicScale_vars",
"depth": 1,
"n_commands": 0,
"n_lines": 12,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e with\n | const n => exact monicScaleAffine_vars _\n | var y => exact monicScaleAffine_vars _\n | add a b _ ... | [
{
"name": "monicScaleAffine_vars",
"text": "theorem monicScaleAffine_vars (e : Expression p) :\n ∀ z ∈ (monicScaleAffine e).1.vars, z ∈ e.vars := by\n intro z hz\n unfold monicScaleAffine at hz\n split at hz\n · exact hz\n · rename_i l hlin\n split at hz\n · rename_i y k rest ht\n split_i... | [
{
"name": "monicScale_vars",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 16,
"n_chars": 558,
"n_subproofs": 0,
"n_tactics": 12,
"cyclomatic": 3,
"n_automation": 1,
"n_rewrites": 1,
"n_structural": 7,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | import ApcOptimizer.Implementation.OptimizerPasses.Normalize
set_option autoImplicit false
/-! # Monic scaling of constraint factors (canonicalization)
An algebraic constraint only matters through its **zero set**, so it may be rescaled by any
*unit* without changing satisfiability — unlike bus expressions, whose va... | @@ -63,6 +63,22 @@
· simp
· simp
+theorem monicScaleAffine_vars (e : Expression p) :
+ ∀ z ∈ (monicScaleAffine e).1.vars, z ∈ e.vars := by
+ intro z hz
+ unfold monicScaleAffine at hz
+ split at hz
+ · exact hz
+ · rename_i l hlin
+ split at hz
+ · rename_i y k rest ht
+ split_ifs at hz... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_c527e745f8cb_0 | 0520d4b7c48bf7a0 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/ConstantFold.lean | ConstantFold | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 1 | [
{
"theorem_name": "Expression.fold_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 6,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e with\n | const n => rfl\n | var x => rfl\n | add a b iha ihb => rw [Expression.fold, Expression.foldAdd... | [
{
"name": "Expression.foldMul_eval",
"text": "theorem Expression.foldMul_eval (a b : Expression p) (env : Variable → ZMod p) :\n (a.foldMul b).eval env = a.eval env * b.eval env := by\n unfold Expression.foldMul\n split <;> (try split_ifs) <;> simp_all [Expression.eval]\n\n",
"fan_in": 1,
"n_li... | [
{
"name": "Expression.fold_eval",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 2,
"n_lines": 9,
"n_chars": 341,
"n_subproofs": 0,
"n_tactics": 8,
"cyclomatic": 2,
"n_automation": 4,
"n_rewrites": 2,
"n_structural": 1,
"automation_only": false,
"max_ne... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Constant folding / algebraic normalization
The optimizer's foundational *enabler* pass. It rewrites every expression to a normal form using
only the ring identities that never change a value:
* `const a + const b ↝ const ... | import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Constant folding / algebraic normalization
The optimizer's foundational *enabler* pass. It rewrites every expression to a normal form using
only the ring identities that never change a value:
* `const a + const b ↝ const ... | @@ -44,6 +44,11 @@
unfold Expression.foldAdd
split <;> (try split_ifs) <;> simp_all [Expression.eval]
+theorem Expression.foldMul_eval (a b : Expression p) (env : Variable → ZMod p) :
+ (a.foldMul b).eval env = a.eval env * b.eval env := by
+ unfold Expression.foldMul
+ split <;> (try split_ifs) <;> simp_a... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_c527e745f8cb_1 | 3eaf0d9f1534b761 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/ConstantFold.lean | ConstantFold | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 1 | [
{
"theorem_name": "Expression.fold_vars",
"depth": 1,
"n_commands": 0,
"n_lines": 16,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction e with\n | const n => intro x hx; simp [Expression.fold, Expression.vars] at hx\n | var y => intro x hx; ... | [
{
"name": "Expression.foldMul_vars",
"text": "theorem Expression.foldMul_vars (a b : Expression p) :\n ∀ x ∈ (a.foldMul b).vars, x ∈ a.vars ++ b.vars := by\n intro x hx\n unfold Expression.foldMul at hx\n split at hx <;> (try split_ifs at hx) <;> simp_all [Expression.vars]\n\n",
"fan_in": 1,
"... | [
{
"name": "Expression.fold_vars",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 2,
"n_lines": 18,
"n_chars": 751,
"n_subproofs": 0,
"n_tactics": 18,
"cyclomatic": 4,
"n_automation": 2,
"n_rewrites": 2,
"n_structural": 11,
"automation_only": false,
"max... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Constant folding / algebraic normalization
The optimizer's foundational *enabler* pass. It rewrites every expression to a normal form using
only the ring identities that never change a value:
* `const a + const b ↝ const ... | import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Constant folding / algebraic normalization
The optimizer's foundational *enabler* pass. It rewrites every expression to a normal form using
only the ring identities that never change a value:
* `const a + const b ↝ const ... | @@ -71,6 +71,12 @@
unfold Expression.foldAdd at hx
split at hx <;> (try split_ifs at hx) <;> simp_all [Expression.vars]
+theorem Expression.foldMul_vars (a b : Expression p) :
+ ∀ x ∈ (a.foldMul b).vars, x ∈ a.vars ++ b.vars := by
+ intro x hx
+ unfold Expression.foldMul at hx
+ split at hx <;> (try split... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_0 | 82aac30b30b6ede4 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "affineRootsIn_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 8,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [affineRootsIn, Option.bind_eq_some_iff] at h\n obtain ⟨l, hlin, hroot⟩ := h\n have heval : l.norm.const + ... | [
{
"name": "rootsOfTerms_sound",
"text": "theorem rootsOfTerms_sound [Fact p.Prime] (x : Variable) (c : ZMod p)\n (ts : List (Variable × ZMod p)) (roots : List (ZMod p))\n (h : rootsOfTerms x c ts = some roots) (env : Variable → ZMod p)\n (hsum : c + (ts.map (fun t => t.2 * env t.1)).sum = 0) : env ... | [
{
"name": "affineRootsIn_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 12,
"n_chars": 621,
"n_subproofs": 3,
"n_tactics": 9,
"cyclomatic": 1,
"n_automation": 2,
"n_rewrites": 1,
"n_structural": 3,
"automation_only": false,
"max_ne... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -100,13 +100,43 @@
if y = x ∧ a ≠ 0 ∧ a * r + c = 0 then some [r] else none
| _ :: _ :: _ => none
+theorem rootsOfTerms_sound [Fact p.Prime] (x : Variable) (c : ZMod p)
+ (ts : List (Variable × ZMod p)) (roots : List (ZMod p))
+ (h : rootsOfTerms x c ts = some roots) (env : Variable → ZMod p)
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_1 | dd65e73fc1fb1aa2 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "varSlot_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 12,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction payload generalizing slot with\n | nil => exact absurd h (by simp [varSlot])\n | cons e rest ih =>\n rw [varS... | [
{
"name": "isVarOf_sound",
"text": "theorem isVarOf_sound (x : Variable) (e : Expression p) (h : isVarOf x e = true) :\n e = .var x := by\n cases e with\n | var y =>\n simp only [isVarOf, decide_eq_true_eq] at h\n rw [h]\n | const n => exact absurd h (by simp [isVarOf])\n | add a b => exact... | [
{
"name": "varSlot_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 15,
"n_chars": 518,
"n_subproofs": 1,
"n_tactics": 12,
"cyclomatic": 2,
"n_automation": 5,
"n_rewrites": 3,
"n_structural": 3,
"automation_only": false,
"max_nesting... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -222,6 +222,16 @@
| .var y => y = x
| _ => false
+theorem isVarOf_sound (x : Variable) (e : Expression p) (h : isVarOf x e = true) :
+ e = .var x := by
+ cases e with
+ | var y =>
+ simp only [isVarOf, decide_eq_true_eq] at h
+ rw [h]
+ | const n => exact absurd h (by simp [isVarOf])
+ | add... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_2 | d87e0af26e199352 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "interactionBound_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 26,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold interactionBound at h\n split at h\n · exact absurd h (by simp)\n · rename_i mval hm\n split_ifs at h ... | [
{
"name": "varSlot_sound",
"text": "theorem varSlot_sound (x : Variable) (payload : List (Expression p)) (slot : Nat)\n (h : varSlot x payload = some slot) : payload[slot]? = some (.var x) := by\n induction payload generalizing slot with\n | nil => exact absurd h (by simp [varSlot])\n | cons e rest ih... | [
{
"name": "findVarBound_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 4,
"n_lines": 20,
"n_chars": 859,
"n_subproofs": 0,
"n_tactics": 14,
"cyclomatic": 3,
"n_automation": 2,
"n_rewrites": 3,
"n_structural": 5,
"automation_only": false,
"max_ne... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -237,6 +237,20 @@
| [] => none
| e :: rest => if isVarOf x e then some 0 else (varSlot x rest).map (· + 1)
+theorem varSlot_sound (x : Variable) (payload : List (Expression p)) (slot : Nat)
+ (h : varSlot x payload = some slot) : payload[slot]? = some (.var x) := by
+ induction payload generalizing slot ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_3 | 875792166c50c282 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "interactionBound_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 26,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold interactionBound at h\n split at h\n · exact absurd h (by simp)\n · rename_i mval hm\n split_ifs at h ... | [
{
"name": "varSlot_sound",
"text": "theorem varSlot_sound (x : Variable) (payload : List (Expression p)) (slot : Nat)\n (h : varSlot x payload = some slot) : payload[slot]? = some (.var x) := by\n induction payload generalizing slot with\n | nil => exact absurd h (by simp [varSlot])\n | cons e rest ih... | [
{
"name": "interactionDomain_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 5,
"n_lines": 16,
"n_chars": 641,
"n_subproofs": 0,
"n_tactics": 10,
"cyclomatic": 2,
"n_automation": 2,
"n_rewrites": 2,
"n_structural": 2,
"automation_only": false,
"m... | 5 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -237,6 +237,20 @@
| [] => none
| e :: rest => if isVarOf x e then some 0 else (varSlot x rest).map (· + 1)
+theorem varSlot_sound (x : Variable) (payload : List (Expression p)) (slot : Nat)
+ (h : varSlot x payload = some slot) : payload[slot]? = some (.var x) := by
+ induction payload generalizing slot ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_4 | 5606648720099d02 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "findDomainAlg_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 15,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction all with\n | nil => exact absurd h (by simp [findDomainAlg])\n | cons c rest ih =>\n rw [findDomainAlg]... | [
{
"name": "rootsIn_sound",
"text": "theorem rootsIn_sound [Fact p.Prime] (x : Variable) (e : Expression p) (roots : List (ZMod p))\n (h : rootsIn x e = some roots) (env : Variable → ZMod p) (he : e.eval env = 0) :\n env x ∈ roots := by\n induction e generalizing roots with\n | const n => exact affin... | [
{
"name": "findDomain_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 11,
"n_lines": 17,
"n_chars": 754,
"n_subproofs": 0,
"n_tactics": 10,
"cyclomatic": 2,
"n_automation": 1,
"n_rewrites": 3,
"n_structural": 3,
"automation_only": false,
"max_nes... | 11 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -153,6 +153,31 @@
| some ra, some rb => some (ra ++ rb)
| _, _ => none
+theorem rootsIn_sound [Fact p.Prime] (x : Variable) (e : Expression p) (roots : List (ZMod p))
+ (h : rootsIn x e = some roots) (env : Variable → ZMod p) (he : e.eval env = 0) :
+ env x ∈ roots := by
+ induction e generali... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d5a9d9ccf558_5 | 3c311c9b4e68af16 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainProp.lean | DomainProp | 5 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 20 | 1 | [
{
"theorem_name": "findDomain_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold findDomain at h\n cases ha : findDomainAlg all x with\n | some d' =>\n rw [ha] at h\n simp only [Optio... | [
{
"name": "findDomainAlg_sound",
"text": "theorem findDomainAlg_sound [Fact p.Prime] (all : List (Expression p)) (x : Variable)\n (d : List (ZMod p)) (h : findDomainAlg all x = some d) (env : Variable → ZMod p)\n (hall : ∀ c ∈ all, c.eval env = 0) : env x ∈ d := by\n induction all with\n | nil => ex... | [
{
"name": "buildDoms_sound",
"fan_in": 2,
"n_deps_direct": 1,
"n_deps_transitive": 12,
"n_lines": 29,
"n_chars": 1255,
"n_subproofs": 0,
"n_tactics": 22,
"cyclomatic": 5,
"n_automation": 6,
"n_rewrites": 6,
"n_structural": 9,
"automation_only": false,
"max_nes... | 12 | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | import ApcOptimizer.Implementation.OptimizerPasses.Gauss
import ApcOptimizer.Implementation.OptimizerPasses.Normalize
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Utils.Size
import Mathlib.Algebra.Field.ZMod
set_option autoI... | @@ -192,6 +192,26 @@
| none => findDomainAlg rest x
else findDomainAlg rest x
+theorem findDomainAlg_sound [Fact p.Prime] (all : List (Expression p)) (x : Variable)
+ (d : List (ZMod p)) (h : findDomainAlg all x = some d) (env : Variable → ZMod p)
+ (hall : ∀ c ∈ all, c.eval env = 0) : env x ∈ d := ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_be41edd15188_0 | 6df0055879a30eb4 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CoveredIndex.lean | CoveredIndex | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 11 | 1 | [
{
"theorem_name": "coveredIdx_mem_list",
"depth": 1,
"n_commands": 0,
"n_lines": 6,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n obtain ⟨i, hi, hei, hq⟩ := coveredIdx_mem idx l.toArray Q xs he\n subst hei\n have hi' : i < l.length := by simpa usi... | [
{
"name": "coveredIdx_mem",
"text": "/-- **Soundness.** Every item `coveredIdx` returns is a genuine item of `arr` (hence of the\n underlying list) that satisfies `Q`. This is all the enumeration proofs need; the index need\n not be complete for correctness (completeness only affects effectiveness, ch... | [
{
"name": "coveredIdx_mem_list",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 11,
"n_chars": 572,
"n_subproofs": 3,
"n_tactics": 6,
"cyclomatic": 1,
"n_automation": 2,
"n_rewrites": 1,
"n_structural": 2,
"automation_only": false,
"max_ne... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | @@ -63,10 +63,32 @@
(uniq.mergeSort (· ≤ ·)).filterMap (fun i =>
if h : i < arr.size then (if Q arr[i] then some arr[i] else none) else none)
+/-- **Soundness.** Every item `coveredIdx` returns is a genuine item of `arr` (hence of the
+ underlying list) that satisfies `Q`. This is all the enumeration proof... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_be41edd15188_1 | a1d21b9fcdf15938 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CoveredIndex.lean | CoveredIndex | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 11 | 1 | [
{
"theorem_name": "coveredIdx_mem_of_eq",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n subst harr; exact coveredIdx_mem_list idx l Q xs he",
"n_chars": 57,
"n_subproofs": 0,
"n_tactics": 3,
... | [
{
"name": "coveredIdx_mem_list",
"text": "/-- Soundness, specialized to the array being a list's `toArray` (what the passes pass in): every\n returned item is a genuine member of the list and satisfies `Q`. -/\ntheorem coveredIdx_mem_list (idx : CovIndex) (l : List α) (Q : α → Bool) (xs : List Variable)\... | [
{
"name": "coveredIdx_mem_of_eq",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 19,
"n_chars": 1293,
"n_subproofs": 0,
"n_tactics": 3,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 1,
"automation_only": false,
"max_... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | @@ -80,11 +80,22 @@
· rw [if_neg hq] at hfe; exact absurd hfe (by simp)
· rw [dif_neg h] at hfe; exact absurd hfe (by simp)
+/-- Soundness, specialized to the array being a list's `toArray` (what the passes pass in): every
+ returned item is a genuine member of the list and satisfies `Q`. -/
+theorem cover... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_be41edd15188_2 | 2a8d79314602ca74 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CoveredIndex.lean | CoveredIndex | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 11 | 2 | [
{
"theorem_name": "inner_getD_self",
"depth": 1,
"n_commands": 0,
"n_lines": 11,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction vs with\n | nil => intro m hv; simp at hv\n | cons v0 rest ih =>\n intro m hv\n simp only [List.foldl_co... | [
{
"name": "inner_getD_mono",
"text": "/-- Inserting a position into buckets never removes an existing membership. -/\ntheorem inner_getD_mono (i : Nat) (vs : List Variable) (w : Variable) (j : Nat) :\n ∀ (m : Std.HashMap Variable (List Nat)), j ∈ m.getD w [] →\n j ∈ (vs.foldl (fun m v => m.insert v (i... | [
{
"name": "inner_getD_self",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 16,
"n_chars": 612,
"n_subproofs": 0,
"n_tactics": 12,
"cyclomatic": 3,
"n_automation": 4,
"n_rewrites": 1,
"n_structural": 7,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | @@ -63,6 +63,24 @@
(uniq.mergeSort (· ≤ ·)).filterMap (fun i =>
if h : i < arr.size then (if Q arr[i] then some arr[i] else none) else none)
+/-- Inserting a position into buckets never removes an existing membership. -/
+theorem inner_getD_mono (i : Nat) (vs : List Variable) (w : Variable) (j : Nat) :
+ ∀... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_be41edd15188_3 | 13f3f762ef4b45e3 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CoveredIndex.lean | CoveredIndex | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 11 | 1 | [
{
"theorem_name": "buildStep_bucket_complete",
"depth": 1,
"n_commands": 0,
"n_lines": 20,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro l\n induction l with\n | nil => intro a i hai; simp at hai\n | cons ai0 rest ih =>\n intro a i hai v... | [
{
"name": "buildStep_buckets_nil",
"text": "/-- The `.buckets` of one `buildStep` when the item has no variables (unchanged). -/\ntheorem buildStep_buckets_nil (varsOf : α → List Variable) (ai : α × Nat) (idx : CovIndex)\n (h : varsOf ai.1 = []) : (buildStep varsOf ai idx).buckets = idx.buckets := by\n ... | [
{
"name": "buildStep_bucket_complete",
"fan_in": 1,
"n_deps_direct": 4,
"n_deps_transitive": 4,
"n_lines": 26,
"n_chars": 1231,
"n_subproofs": 1,
"n_tactics": 24,
"cyclomatic": 5,
"n_automation": 2,
"n_rewrites": 7,
"n_structural": 11,
"automation_only": false,
... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | @@ -96,6 +96,11 @@
exact List.mem_cons_self
· exact ih _ hv
+/-- The `.buckets` of one `buildStep` when the item has no variables (unchanged). -/
+theorem buildStep_buckets_nil (varsOf : α → List Variable) (ai : α × Nat) (idx : CovIndex)
+ (h : varsOf ai.1 = []) : (buildStep varsOf ai idx).buckets = id... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_be41edd15188_4 | 5341683cd53c6aa1 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/CoveredIndex.lean | CoveredIndex | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 11 | 1 | [
{
"theorem_name": "coveredIdx_eq_filter",
"depth": 1,
"n_commands": 0,
"n_lines": 97,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n rw [coveredIdx]\n simp only [List.size_toArray, List.getElem_toArray]\n set cand := candidates (build varsOf items)... | [
{
"name": "buildStep_bucket_complete",
"text": "/-- **Index completeness (buckets).** Every item at position `i` with variable `v` bucketed under\n `v`: the fold inserts `i` into `v`'s bucket and later steps never remove it. -/\ntheorem buildStep_bucket_complete (varsOf : α → List Variable) :\n ∀ (l :... | [
{
"name": "coveredIdx_eq_filter",
"fan_in": 0,
"n_deps_direct": 5,
"n_deps_transitive": 9,
"n_lines": 107,
"n_chars": 5633,
"n_subproofs": 22,
"n_tactics": 94,
"cyclomatic": 7,
"n_automation": 12,
"n_rewrites": 19,
"n_structural": 25,
"automation_only": false,
... | 9 | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
set_option autoImplicit false
/-! # Inverted index for covered-set scans
The finite-domain passes (`domainBatch`, `domainFold`, `reencode`) repeatedly ask, for a *target*
variable set `xs`, which items (algebraic constraints / bus interactions) have **all... | @@ -126,6 +126,31 @@
= (w0 :: ws).foldl (fun m v => m.insert v (ai.2 :: m.getD v [])) idx.buckets := by
simp only [buildStep, h]
+/-- **Index completeness (buckets).** Every item at position `i` with variable `v` bucketed under
+ `v`: the fold inserts `i` into `v`'s bucket and later steps never remove it... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_8c847b9735eb_0 | 1f8080007e578e1e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SplitBytePair.lean | SplitBytePair | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 5 | [
{
"theorem_name": "splitOne_P",
"depth": 1,
"n_commands": 0,
"n_lines": 20,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold splitOne\n cases hab : asBytePair facts bi with\n | none => simp\n | some t =>\n obtain ⟨busId, a, b⟩ := t\n ob... | [
{
"name": "asBytePair_eq",
"text": "/-- A recognizer hit pins the whole interaction: `bi` is exactly `byteCheck2 busId a b`, and both\n facts hold on `busId`. -/\ntheorem asBytePair_eq {bs : BusSemantics p} (facts : BusFacts p bs)\n (bi : BusInteraction (Expression p)) (busId : Nat) (a b : Expression ... | [
{
"name": "splitOne_P",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 25,
"n_chars": 1531,
"n_subproofs": 6,
"n_tactics": 26,
"cyclomatic": 2,
"n_automation": 6,
"n_rewrites": 8,
"n_structural": 8,
"automation_only": false,
"max_nesting":... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.BytePack
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Byte-check pair splitting (`splitBytePairPass`)
The inverse of `bytePackPass` (`BytePack.lean`): explode every packed pair byte check
`[a, b, 0, 0]` on a `bytePairBus` back into the ... | import ApcOptimizer.Implementation.OptimizerPasses.BytePack
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Byte-check pair splitting (`splitBytePairPass`)
The inverse of `bytePackPass` (`BytePack.lean`): explode every packed pair byte check
`[a, b, 0, 0]` on a `bytePairBus` back into the ... | @@ -48,6 +48,31 @@
| _, _ => none
else none
+/-- A recognizer hit pins the whole interaction: `bi` is exactly `byteCheck2 busId a b`, and both
+ facts hold on `busId`. -/
+theorem asBytePair_eq {bs : BusSemantics p} (facts : BusFacts p bs)
+ (bi : BusInteraction (Expression p)) (busId : Nat) (a b : Expr... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_8c847b9735eb_1 | 86db715ca7becb0b | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SplitBytePair.lean | SplitBytePair | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 2 | [
{
"theorem_name": "filter_stateful_flatMap",
"depth": 1,
"n_commands": 0,
"n_lines": 6,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction l with\n | nil => rfl\n | cons a rest ih =>\n rw [List.flatMap_cons, List.filter_append, splitOne_fi... | [
{
"name": "filter_cons_append",
"text": "/-- `[x].filter p ++ ys.filter p = (x :: ys).filter p`. -/\nprivate theorem filter_cons_append {α : Type} (q : α → Bool) (x : α) (ys : List α) :\n ([x].filter q) ++ ys.filter q = (x :: ys).filter q := by\n cases h : q x <;> simp [List.filter_cons, h]\n\n",
"f... | [
{
"name": "filter_stateful_flatMap",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 3,
"n_lines": 12,
"n_chars": 521,
"n_subproofs": 0,
"n_tactics": 6,
"cyclomatic": 2,
"n_automation": 1,
"n_rewrites": 1,
"n_structural": 2,
"automation_only": false,
"ma... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.BytePack
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Byte-check pair splitting (`splitBytePairPass`)
The inverse of `bytePackPass` (`BytePack.lean`): explode every packed pair byte check
`[a, b, 0, 0]` on a `bytePairBus` back into the ... | import ApcOptimizer.Implementation.OptimizerPasses.BytePack
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Byte-check pair splitting (`splitBytePairPass`)
The inverse of `bytePackPass` (`BytePack.lean`): explode every packed pair byte check
`[a, b, 0, 0]` on a `bytePairBus` back into the ... | @@ -80,6 +80,11 @@
| some (busId, a, b) => [byteCheck1 busId a, byteCheck1 busId b]
| none => [bi]
+/-- `[x].filter p ++ ys.filter p = (x :: ys).filter p`. -/
+private theorem filter_cons_append {α : Type} (q : α → Bool) (x : α) (ys : List α) :
+ ([x].filter q) ++ ys.filter q = (x :: ys).filter q := by
+ ca... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_86ffd4b434f9_0 | a191ebdf947a5a09 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Subst.lean | Subst | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 1 | [
{
"theorem_name": "ConstraintSystem.subst_vars_subset",
"depth": 1,
"n_commands": 0,
"n_lines": 18,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro z hz\n rw [ConstraintSystem.mem_vars] at hz\n rcases hz with ⟨c, hc, hzc⟩ | ⟨bi, hbi, hzbi⟩\n ... | [
{
"name": "Expression.subst_vars",
"text": "/-- Substitution introduces no variable outside `e` and `t`. -/\ntheorem Expression.subst_vars (e : Expression p) (x : Variable) (t : Expression p) :\n ∀ z ∈ (e.subst x t).vars, z ∈ e.vars ∨ z ∈ t.vars := by\n induction e with\n | const n => intro z hz; simp ... | [
{
"name": "ConstraintSystem.subst_vars_subset",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 23,
"n_chars": 1134,
"n_subproofs": 3,
"n_tactics": 18,
"cyclomatic": 3,
"n_automation": 7,
"n_rewrites": 1,
"n_structural": 9,
"automation_only": f... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Substitution: the core equivalence machinery for variable elimination
The single most important building block for the optimizer. If a constraint system entails that
some variable `x` always equals an expression `t` (e.g. be... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Substitution: the core equivalence machinery for variable elimination
The single most important building block for the optimizer. If a constraint system entails that
some variable `x` always equals an expression `t` (e.g. be... | @@ -122,6 +122,30 @@
· simp only [if_pos hstate, List.map_cons, ih, BusInteraction.eval_subst]
· simp only [if_neg hstate, ih]
+/-- Substitution introduces no variable outside `e` and `t`. -/
+theorem Expression.subst_vars (e : Expression p) (x : Variable) (t : Expression p) :
+ ∀ z ∈ (e.subst x t).v... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_a2a21bef2dcc_0 | dd5fcd3021f944fa | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Optimizer.lean | Optimizer | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 2 | [
{
"theorem_name": "simpleOptimizer_maintainsCorrectness",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n optimizerWithBusFacts_maintainsCorrectness bs (BusFacts.trivial bs)",
"n_chars": 70,
"n_subproofs... | [
{
"name": "optimizerWithBusFacts_maintainsCorrectness",
"text": "theorem optimizerWithBusFacts_maintainsCorrectness (bs : BusSemantics p) (facts : BusFacts p bs) :\n Optimizer.isCorrect (optimizerWithBusFacts facts) bs :=\n ⟨fun cs => optimizerWithBusFacts_correct facts cs,\n fun cs => optimizerWithBu... | [
{
"name": "simpleOptimizer_maintainsCorrectness",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 5,
"n_chars": 191,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": fa... | 1 | import ApcOptimizer.Implementation.Optimizer
import ApcOptimizer.Implementation.OpenVmFacts
set_option autoImplicit false
/-! # The optimizers and their correctness (audited) -/
variable {p : ℕ}
/-! ## The optimizers
Three optimizers are available:
- `optimizerWithBusFacts facts`: This is the most general ... | import ApcOptimizer.Implementation.Optimizer
import ApcOptimizer.Implementation.OpenVmFacts
set_option autoImplicit false
/-! # The optimizers and their correctness (audited) -/
variable {p : ℕ}
/-! ## The optimizers
Three optimizers are available:
- `optimizerWithBusFacts facts`: This is the most general ... | @@ -34,8 +34,14 @@
In the following theorems, we establish that the optimizers maintain correctness. -/
+theorem optimizerWithBusFacts_maintainsCorrectness (bs : BusSemantics p) (facts : BusFacts p bs) :
+ Optimizer.isCorrect (optimizerWithBusFacts facts) bs :=
+ ⟨fun cs => optimizerWithBusFacts_correct fa... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_a2a21bef2dcc_1 | f99d0a873928ff80 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Optimizer.lean | Optimizer | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 2 | [
{
"theorem_name": "simpleOptimizer_maintainsCorrectness",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n optimizerWithBusFacts_maintainsCorrectness bs (BusFacts.trivial bs)",
"n_chars": 70,
"n_subproofs... | [
{
"name": "optimizerWithBusFacts_maintainsCorrectness",
"text": "theorem optimizerWithBusFacts_maintainsCorrectness (bs : BusSemantics p) (facts : BusFacts p bs) :\n Optimizer.isCorrect (optimizerWithBusFacts facts) bs :=\n ⟨fun cs => optimizerWithBusFacts_correct facts cs,\n fun cs => optimizerWithBu... | [
{
"name": "openVmOptimizer_maintainsCorrectness",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 7,
"n_chars": 277,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": fa... | 1 | import ApcOptimizer.Implementation.Optimizer
import ApcOptimizer.Implementation.OpenVmFacts
set_option autoImplicit false
/-! # The optimizers and their correctness (audited) -/
variable {p : ℕ}
/-! ## The optimizers
Three optimizers are available:
- `optimizerWithBusFacts facts`: This is the most general ... | import ApcOptimizer.Implementation.Optimizer
import ApcOptimizer.Implementation.OpenVmFacts
set_option autoImplicit false
/-! # The optimizers and their correctness (audited) -/
variable {p : ℕ}
/-! ## The optimizers
Three optimizers are available:
- `optimizerWithBusFacts facts`: This is the most general ... | @@ -34,11 +34,18 @@
In the following theorems, we establish that the optimizers maintain correctness. -/
+theorem optimizerWithBusFacts_maintainsCorrectness (bs : BusSemantics p) (facts : BusFacts p bs) :
+ Optimizer.isCorrect (optimizerWithBusFacts facts) bs :=
+ ⟨fun cs => optimizerWithBusFacts_correct f... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_ebd3159112fc_0 | 260c7dd927ee6581 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OpenVmFacts.lean | OpenVmFacts | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 1 | [
{
"theorem_name": "memory_send_ok",
"depth": 1,
"n_commands": 0,
"n_lines": 18,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n by_cases hc : (1 : ZMod p) = -1\n · -- `p ∣ 2`: every value is `< 2 ≤ 256`, so the byte test never fails.\n have hadd :... | [
{
"name": "memory_nonRecv_ok",
"text": "/-- A memory message that is not a receive (multiplicity ≠ -1) never violates. -/\nprivate theorem memory_nonRecv_ok (busMap : Nat → Option OpenVmBusType)\n (m : BusInteraction (ZMod p)) (hbus : busMap m.busId = some .memory)\n (hm : m.multiplicity ≠ -1) : viola... | [
{
"name": "memory_send_ok",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 24,
"n_chars": 1239,
"n_subproofs": 5,
"n_tactics": 20,
"cyclomatic": 3,
"n_automation": 4,
"n_rewrites": 4,
"n_structural": 5,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.OpenVmSemantics
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-!
# Proven bus facts for the OpenVM semantics
The `BusFacts` instance for `openVmBusSemantics` (see `ApcOptimizer/Implementation/BusFacts.lean` for the desi... | import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.OpenVmSemantics
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-!
# Proven bus facts for the OpenVM semantics
The `BusFacts` instance for `openVmBusSemantics` (see `ApcOptimizer/Implementation/BusFacts.lean` for the desi... | @@ -136,6 +136,17 @@
isByte, decide_eq_true_eq] at hok
exact ⟨hok.1, hok.2.1, hok.2.2.1, hok.2.2.2⟩
+/-- A memory message that is not a receive (multiplicity ≠ -1) never violates. -/
+private theorem memory_nonRecv_ok (busMap : Nat → Option OpenVmBusType)
+ (m : BusInteraction (ZMod p)) (hbus : busMap m.bu... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_1d5bdc5a5bfc_0 | f675a9b74b54cd05 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FactPass.lean | FactPass | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 2 | [
{
"theorem_name": "iterateToFixpoint_respectsDeg",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro cs\n induction cs using sizeKey_wf.induction with\n | _ cs ih =>\n intro bs facts hcs\n rw [it... | [
{
"name": "sizeKey_wf",
"text": "/-- The `sizeKey` order on constraint systems is well-founded (it is the inverse image of `<` on\n the lexicographic `Nat ×ₗ Nat ×ₗ Nat`, which is well-founded). Used to prove properties of\n `iterateToFixpoint` by strong induction on the measure it recurses on. -/\nth... | [
{
"name": "iterateToFixpoint_respectsDeg",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 16,
"n_chars": 583,
"n_subproofs": 0,
"n_tactics": 10,
"cyclomatic": 3,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 5,
"automation_only": false,
... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.Utils.Size
import Mathlib.Data.Prod.Lex
set_option autoImplicit false
/-! # Fact-aware verified passes
A `VerifiedPassW` is a `VerifiedPass` that may additionally consult proven `BusFacts` about t... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.Utils.Size
import Mathlib.Data.Prod.Lex
set_option autoImplicit false
/-! # Fact-aware verified passes
A `VerifiedPassW` is a `VerifiedPass` that may additionally consult proven `BusFacts` about t... | @@ -111,10 +111,25 @@
| 0 => fun _ _ _ h => h
| n + 1 => VerifiedPassW.andThen_respectsDeg (iterate_respectsDeg hf n) hf
+/-- The `sizeKey` order on constraint systems is well-founded (it is the inverse image of `<` on
+ the lexicographic `Nat ×ₗ Nat ×ₗ Nat`, which is well-founded). Used to prove properties ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_1d5bdc5a5bfc_1 | e79e9a22baeca95c | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FactPass.lean | FactPass | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 1 | 2 | [
{
"theorem_name": "iterateToFixpoint_respectsDeg",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro cs\n induction cs using sizeKey_wf.induction with\n | _ cs ih =>\n intro bs facts hcs\n rw [it... | [
{
"name": "sizeKey_wf",
"text": "/-- The `sizeKey` order on constraint systems is well-founded (it is the inverse image of `<` on\n the lexicographic `Nat ×ₗ Nat ×ₗ Nat`, which is well-founded). Used to prove properties of\n `iterateToFixpoint` by strong induction on the measure it recurses on. -/\nth... | [
{
"name": "iterateToFixpoint_monotone",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 14,
"n_chars": 689,
"n_subproofs": 0,
"n_tactics": 8,
"cyclomatic": 3,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 3,
"automation_only": false,
... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.Utils.Size
import Mathlib.Data.Prod.Lex
set_option autoImplicit false
/-! # Fact-aware verified passes
A `VerifiedPassW` is a `VerifiedPass` that may additionally consult proven `BusFacts` about t... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.BusFacts
import ApcOptimizer.Utils.Size
import Mathlib.Data.Prod.Lex
set_option autoImplicit false
/-! # Fact-aware verified passes
A `VerifiedPassW` is a `VerifiedPass` that may additionally consult proven `BusFacts` about t... | @@ -111,10 +111,23 @@
| 0 => fun _ _ _ h => h
| n + 1 => VerifiedPassW.andThen_respectsDeg (iterate_respectsDeg hf n) hf
+/-- The `sizeKey` order on constraint systems is well-founded (it is the inverse image of `<` on
+ the lexicographic `Nat ×ₗ Nat ×ₗ Nat`, which is well-founded). Used to prove properties ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_fd1b2bb08242_0 | f928b7351cbb7ad5 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/ZeroWidthRange.lean | ZeroWidthRange | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 2 | 1 | [
{
"theorem_name": "rangeEq?_violates_iff",
"depth": 1,
"n_commands": 0,
"n_lines": 17,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n obtain ⟨hm, v, hcase⟩ := rangeEq?_spec one bs facts bi e h\n rcases hcase with ⟨hz, hp', rfl⟩ | ⟨hone', hv, hp', rf... | [
{
"name": "val_lt_two_iff",
"text": "/-- On a prime field, `x < 2` (as a value) is exactly booleanity. -/\ntheorem val_lt_two_iff (hp : Nat.Prime p) (x : ZMod p) :\n x.val < 2 ↔ x * (x - 1) = 0 := by\n haveI : Fact p.Prime := ⟨hp⟩\n constructor\n · intro hlt\n have : x.val = 0 ∨ x.val = 1 := by ome... | [
{
"name": "rangeEq?_violates_iff",
"fan_in": 0,
"n_deps_direct": 3,
"n_deps_transitive": 3,
"n_lines": 24,
"n_chars": 1381,
"n_subproofs": 5,
"n_tactics": 21,
"cyclomatic": 3,
"n_automation": 5,
"n_rewrites": 8,
"n_structural": 6,
"automation_only": false,
"ma... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Width-0 / width-1 range-check → equality / booleanity (C3 + idea 4(b))
powdr-exported blocks keep, on the variable range checker, two families of degenerate rang... | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Width-0 / width-1 range-check → equality / booleanity (C3 + idea 4(b))
powdr-exported blocks keep, on the variable range checker, two families of degenerate rang... | @@ -51,6 +51,25 @@
simp only [boolC, Expression.vars, List.mem_append, List.not_mem_nil, or_false] at hx
tauto
+/-- On a prime field, `x < 2` (as a value) is exactly booleanity. -/
+theorem val_lt_two_iff (hp : Nat.Prime p) (x : ZMod p) :
+ x.val < 2 ↔ x * (x - 1) = 0 := by
+ haveI : Fact p.Prime := ⟨hp⟩
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_0 | c130fa68c0328d14 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 2 | [
{
"theorem_name": "cleanupCycle_respectsDeg",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold cleanupCycle\n refine chainPasses_respectsDeg (fun f hf => ?_)\n simp only [cleanupPasses, List.map_cons,... | [
{
"name": "chainPasses_respectsDeg",
"text": "/-- Any list of degree-respecting passes folds (`chainPasses`) to a degree-respecting pass. -/\ntheorem chainPasses_respectsDeg {l : List (VerifiedPassW p)} (h : ∀ f ∈ l, RespectsDeg f) :\n RespectsDeg (chainPasses l) := by\n unfold chainPasses\n exact fold... | [
{
"name": "cleanupCycle_respectsDeg",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 7,
"n_chars": 278,
"n_subproofs": 0,
"n_tactics": 6,
"cyclomatic": 2,
"n_automation": 1,
"n_rewrites": 1,
"n_structural": 2,
"automation_only": false,
"ma... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -150,8 +150,18 @@
(VerifiedPassW.andThen_respectsDeg hinit (hall g (List.mem_cons_self ..)))
(fun f hf => hall f (List.mem_cons_of_mem _ hf))
-theorem cleanupCycle_respectsDeg : RespectsDeg (cleanupCycle (p := p)) := sorry
+/-- Any list of degree-respecting passes folds (`chainPasses`) to a degre... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_1 | b8db29ffdadaa2e7 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 2 | [
{
"theorem_name": "cleanupCycle_respectsDeg",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold cleanupCycle\n refine chainPasses_respectsDeg (fun f hf => ?_)\n simp only [cleanupPasses, List.map_cons,... | [
{
"name": "chainPasses_respectsDeg",
"text": "/-- Any list of degree-respecting passes folds (`chainPasses`) to a degree-respecting pass. -/\ntheorem chainPasses_respectsDeg {l : List (VerifiedPassW p)} (h : ∀ f ∈ l, RespectsDeg f) :\n RespectsDeg (chainPasses l) := by\n unfold chainPasses\n exact fold... | [
{
"name": "pipeline_respectsDeg",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 2,
"n_lines": 13,
"n_chars": 585,
"n_subproofs": 0,
"n_tactics": 12,
"cyclomatic": 2,
"n_automation": 2,
"n_rewrites": 1,
"n_structural": 3,
"automation_only": false,
"max_... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -150,8 +150,18 @@
(VerifiedPassW.andThen_respectsDeg hinit (hall g (List.mem_cons_self ..)))
(fun f hf => hall f (List.mem_cons_of_mem _ hf))
-theorem cleanupCycle_respectsDeg : RespectsDeg (cleanupCycle (p := p)) := sorry
+/-- Any list of degree-respecting passes folds (`chainPasses`) to a degre... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_2 | 341297233650388a | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 3 | [
{
"theorem_name": "ConstraintSystem.satisfies_congr",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have imp : ∀ e1 e2 : Variable → ZMod p, (∀ x ∈ cs.vars, e1 x = e2 x) →\n cs.satisfies bs e1 → cs.sat... | [
{
"name": "ConstraintSystem.busEval_congr",
"text": "/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/\ntheorem ConstraintSystem.busEval_congr {cs : ConstraintSystem p} {f g : Variable → ZMod p}\n (h : ∀ x ∈ cs.vars, f x = g x) {bi : BusInteraction (Expression p... | [
{
"name": "ConstraintSystem.satisfies_congr",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 17,
"n_chars": 844,
"n_subproofs": 2,
"n_tactics": 13,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 3,
"n_structural": 5,
"automation_only": fals... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -176,6 +176,16 @@
(proved among the passes) to the system level; the completeness bridge below uses them to swap the
abstract per-pass witness for the concrete `witgen` output the spec now names. -/
+/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/
+theorem ConstraintS... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_3 | 7d76112b5aa93019 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 3 | [
{
"theorem_name": "ConstraintSystem.satisfies_congr",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have imp : ∀ e1 e2 : Variable → ZMod p, (∀ x ∈ cs.vars, e1 x = e2 x) →\n cs.satisfies bs e1 → cs.sat... | [
{
"name": "ConstraintSystem.busEval_congr",
"text": "/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/\ntheorem ConstraintSystem.busEval_congr {cs : ConstraintSystem p} {f g : Variable → ZMod p}\n (h : ∀ x ∈ cs.vars, f x = g x) {bi : BusInteraction (Expression p... | [
{
"name": "ConstraintSystem.admissible_congr",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 10,
"n_chars": 457,
"n_subproofs": 1,
"n_tactics": 6,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 2,
"n_structural": 0,
"automation_only": fals... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -176,11 +176,22 @@
(proved among the passes) to the system level; the completeness bridge below uses them to swap the
abstract per-pass witness for the concrete `witgen` output the spec now names. -/
+/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/
+theorem Constraint... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_4 | e3738290595ca242 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 3 | [
{
"theorem_name": "ConstraintSystem.satisfies_congr",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have imp : ∀ e1 e2 : Variable → ZMod p, (∀ x ∈ cs.vars, e1 x = e2 x) →\n cs.satisfies bs e1 → cs.sat... | [
{
"name": "ConstraintSystem.busEval_congr",
"text": "/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/\ntheorem ConstraintSystem.busEval_congr {cs : ConstraintSystem p} {f g : Variable → ZMod p}\n (h : ∀ x ∈ cs.vars, f x = g x) {bi : BusInteraction (Expression p... | [
{
"name": "ConstraintSystem.sideEffects_congr",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 8,
"n_chars": 375,
"n_subproofs": 0,
"n_tactics": 4,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 1,
"n_structural": 1,
"automation_only": fals... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -176,8 +176,21 @@
(proved among the passes) to the system level; the completeness bridge below uses them to swap the
abstract per-pass witness for the concrete `witgen` output the spec now names. -/
+/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/
+theorem ConstraintS... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_5 | 573e283ac866e8b6 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 5 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 3 | [
{
"theorem_name": "ConstraintSystem.satisfies_congr",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have imp : ∀ e1 e2 : Variable → ZMod p, (∀ x ∈ cs.vars, e1 x = e2 x) →\n cs.satisfies bs e1 → cs.sat... | [
{
"name": "ConstraintSystem.busEval_congr",
"text": "/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/\ntheorem ConstraintSystem.busEval_congr {cs : ConstraintSystem p} {f g : Variable → ZMod p}\n (h : ∀ x ∈ cs.vars, f x = g x) {bi : BusInteraction (Expression p... | [
{
"name": "optimizerWithBusFacts_correct",
"fan_in": 0,
"n_deps_direct": 3,
"n_deps_transitive": 4,
"n_lines": 44,
"n_chars": 2464,
"n_subproofs": 7,
"n_tactics": 34,
"cyclomatic": 3,
"n_automation": 6,
"n_rewrites": 3,
"n_structural": 16,
"automation_only": false... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -176,6 +176,16 @@
(proved among the passes) to the system level; the completeness bridge below uses them to swap the
abstract per-pass witness for the concrete `witgen` output the spec now names. -/
+/-- A bus interaction of `cs` evaluates the same under assignments agreeing on `cs.vars`. -/
+theorem ConstraintS... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_323ad4517330_6 | b80e47ad49ea942f | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/Optimizer.lean | Optimizer | 6 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 7 | 2 | [
{
"theorem_name": "cleanupCycle_respectsDeg",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold cleanupCycle\n refine chainPasses_respectsDeg (fun f hf => ?_)\n simp only [cleanupPasses, List.map_cons,... | [
{
"name": "chainPasses_respectsDeg",
"text": "/-- Any list of degree-respecting passes folds (`chainPasses`) to a degree-respecting pass. -/\ntheorem chainPasses_respectsDeg {l : List (VerifiedPassW p)} (h : ∀ f ∈ l, RespectsDeg f) :\n RespectsDeg (chainPasses l) := by\n unfold chainPasses\n exact fold... | [
{
"name": "optimizerWithBusFacts_respectsDegree",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 3,
"n_lines": 8,
"n_chars": 404,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": fa... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Identity
import ApcOptimizer.Implementation.OptimizerPasses.ConstantFold
import ApcOptimizer.Implementation.OptimizerPasses.TrivialConstraint
import Apc... | @@ -150,8 +150,18 @@
(VerifiedPassW.andThen_respectsDeg hinit (hall g (List.mem_cons_self ..)))
(fun f hf => hall f (List.mem_cons_of_mem _ hf))
-theorem cleanupCycle_respectsDeg : RespectsDeg (cleanupCycle (p := p)) := sorry
+/-- Any list of degree-respecting passes folds (`chainPasses`) to a degre... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_0 | 78459f55352b641f | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "peel_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 8,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction ds generalizing E with\n | nil => simp [peel]\n | cons d ds ih =>\n simp only [peel]\n rw [extractLinear_ev... | [
{
"name": "extractLinear_eval",
"text": "theorem extractLinear_eval (d : Variable) (E : Expression p) (env : Variable → ZMod p) :\n E.eval env = (extractLinear d E).1.eval env * env d + (extractLinear d E).2.eval env := by\n induction E with\n | const c => simp [extractLinear, Expression.eval]\n | var... | [
{
"name": "peel_eval",
"fan_in": 2,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 15,
"n_chars": 537,
"n_subproofs": 0,
"n_tactics": 8,
"cyclomatic": 2,
"n_automation": 4,
"n_rewrites": 1,
"n_structural": 1,
"automation_only": false,
"max_nesting": 6
... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -51,6 +51,21 @@
let (c2, r2) := extractLinear d e2
(.mul e1 c2, .mul e1 r2)
+theorem extractLinear_eval (d : Variable) (E : Expression p) (env : Variable → ZMod p) :
+ E.eval env = (extractLinear d E).1.eval env * env d + (extractLinear d E).2.eval env := by
+ induction E with
+ | const c =>... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_1 | c0b307b516f437f0 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "sum_zero_all_zero",
"depth": 1,
"n_commands": 0,
"n_lines": 11,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n haveI : NeZero p := ⟨hp.ne'⟩\n have hval : (L.map (fun x => x.val)).sum = 0 := by\n have := sum_val_eq hp L hfit\n ... | [
{
"name": "sum_val_eq",
"text": "/-- If a list of field elements each has `.val < p` and their `.val`s sum to `< p`, the field sum's\n `.val` equals the natural-number sum (no wraparound). -/\ntheorem sum_val_eq (hp : 0 < p) :\n ∀ (L : List (ZMod p)), (L.map (fun x => x.val)).sum < p →\n L.sum.va... | [
{
"name": "sum_zero_all_zero",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 19,
"n_chars": 777,
"n_subproofs": 4,
"n_tactics": 13,
"cyclomatic": 1,
"n_automation": 3,
"n_rewrites": 1,
"n_structural": 4,
"automation_only": false,
"max_nes... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -89,11 +89,36 @@
/-! ## A byte-bounded field sum that is zero forces every summand to zero -/
+/-- If a list of field elements each has `.val < p` and their `.val`s sum to `< p`, the field sum's
+ `.val` equals the natural-number sum (no wraparound). -/
+theorem sum_val_eq (hp : 0 < p) :
+ ∀ (L : List (ZM... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_2 | c0e4ef24ebffe4fa | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 2 | [
{
"theorem_name": "peel_snd_vars",
"depth": 1,
"n_commands": 0,
"n_lines": 7,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction D generalizing E with\n | nil => simp [peel]\n | cons d ds ih =>\n intro x hx\n simp only [peel] at hx\... | [
{
"name": "extractLinear_vars",
"text": "theorem extractLinear_vars (d : Variable) (E : Expression p) :\n (∀ x ∈ (extractLinear d E).1.vars, x ∈ E.vars) ∧\n (∀ x ∈ (extractLinear d E).2.vars, x ∈ E.vars) := by\n induction E with\n | const c => simp [extractLinear, Expression.vars]\n | var x => by... | [
{
"name": "peel_snd_vars",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 10,
"n_chars": 312,
"n_subproofs": 0,
"n_tactics": 7,
"cyclomatic": 2,
"n_automation": 2,
"n_rewrites": 0,
"n_structural": 3,
"automation_only": false,
"max_nesting"... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -163,11 +163,40 @@
| nil => simp [peel]
| cons d ds ih => simp only [peel, List.length_cons]; rw [ih]
+theorem extractLinear_vars (d : Variable) (E : Expression p) :
+ (∀ x ∈ (extractLinear d E).1.vars, x ∈ E.vars) ∧
+ (∀ x ∈ (extractLinear d E).2.vars, x ∈ E.vars) := by
+ induction E with
+ | cons... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_3 | d6c40a16c4c91a31 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 2 | [
{
"theorem_name": "foldr_reassign",
"depth": 1,
"n_commands": 0,
"n_lines": 13,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction pairs with\n | nil => simp\n | cons cd rest ih =>\n simp only [List.foldr_cons, List.map_cons, List.sum_co... | [
{
"name": "eval_reassign_free",
"text": "/-- An expression free of every `D` variable is unaffected by reassigning `D`. -/\ntheorem eval_reassign_free (c : Expression p) (D : List Variable) (w : ZMod p)\n (env : Variable → ZMod p) (h : ∀ d ∈ D, d ∉ c.vars) :\n c.eval (reassign D w env) = c.eval env :=... | [
{
"name": "foldr_reassign",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 22,
"n_chars": 1182,
"n_subproofs": 2,
"n_tactics": 14,
"cyclomatic": 2,
"n_automation": 3,
"n_rewrites": 4,
"n_structural": 1,
"automation_only": false,
"max_nesti... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -148,6 +148,16 @@
def reassign (D : List Variable) (w : ZMod p) (env : Variable → ZMod p) : Variable → ZMod p :=
fun v => if v ∈ D then w else env v
+/-- An expression free of every `D` variable is unaffected by reassigning `D`. -/
+theorem eval_reassign_free (c : Expression p) (D : List Variable) (w : ZMod p)... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_4 | ea21cd4c5e91dd03 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "assocReassign_key",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [assocReassign, find?_snd_of_nodup P hnd cd hmem]",
"n_chars": 65,
"n_subproofs": 0,
"n_tactics": 2... | [
{
"name": "find?_snd_of_nodup",
"text": "/-- On a witness list with distinct keys, `find?` on a member's key returns that member. -/\ntheorem find?_snd_of_nodup (P : List (Expression p × Variable))\n (hnd : (P.map (·.2)).Nodup) (cd : Expression p × Variable) (hmem : cd ∈ P) :\n P.find? (fun x => x.2 =... | [
{
"name": "assocReassign_key",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 7,
"n_chars": 398,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": true,
"max_nestin... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -502,10 +502,25 @@
exact hv (List.mem_map.2 ⟨cd, hcd, of_decide_eq_true hbeq⟩)
simp only [assocReassign, hnone]
+/-- On a witness list with distinct keys, `find?` on a member's key returns that member. -/
+theorem find?_snd_of_nodup (P : List (Expression p × Variable))
+ (hnd : (P.map (·.2)).Nodup) (cd ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_5 | 4fa694a5be95db39 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 5 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "coeffsByteOK_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 23,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro coeffs\n induction coeffs with\n | nil => intro _ c hc; simp at hc\n | cons c0 cs ih =>\n intro h c hc\n ... | [
{
"name": "coeffVar_sound",
"text": "theorem coeffVar_sound {c : Expression p} {a : Variable} (h : coeffVar c = some a) :\n (∀ env, c.eval env = env a) ∧ (∀ x ∈ c.vars, x = a) := by\n unfold coeffVar at h\n split at h\n · rename_i a'; simp only [Option.some.injEq] at h; subst h\n exact ⟨fun _ => rf... | [
{
"name": "coeffsByteOK_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 30,
"n_chars": 1384,
"n_subproofs": 1,
"n_tactics": 30,
"cyclomatic": 5,
"n_automation": 7,
"n_rewrites": 2,
"n_structural": 19,
"automation_only": false,
"max_... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -598,6 +598,18 @@
| .mul (.const c) (.var a) => if c = 1 then some a else none
| _ => none
+theorem coeffVar_sound {c : Expression p} {a : Variable} (h : coeffVar c = some a) :
+ (∀ env, c.eval env = env a) ∧ (∀ x ∈ c.vars, x = a) := by
+ unfold coeffVar at h
+ split at h
+ · rename_i a'; simp only [Op... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_805bf2e221d2_6 | e05817d477f9dc2c | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/HintCollapse.lean | HintCollapse | 6 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "sqCoeffsOK_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 26,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro coeffs\n induction coeffs with\n | nil => intro _ c hc; simp at hc\n | cons c0 cs ih =>\n intro h c hc\n ... | [
{
"name": "diffVarsOf_sound",
"text": "theorem diffVarsOf_sound {c : Expression p} {a b : Variable} (h : diffVarsOf c = some (a, b)) :\n (∀ env, c.eval env = env a - env b) ∧ (∀ x ∈ c.vars, x = a ∨ x = b) := by\n unfold diffVarsOf at h\n split at h\n · rename_i a' c' b'\n split_ifs at h with hc1\n ... | [
{
"name": "sqCoeffsOK_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 32,
"n_chars": 1618,
"n_subproofs": 3,
"n_tactics": 38,
"cyclomatic": 6,
"n_automation": 9,
"n_rewrites": 2,
"n_structural": 25,
"automation_only": false,
"max_ne... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.TautoBus
set_option autoImplicit false
/-! # Collapsing a multi-limb reciprocal-witness group to one hint (finishes powdr's `seqz`/`seq`)
A com... | @@ -660,6 +660,19 @@
| .add (.var a) (.mul (.const c) (.var b)) => if c = -1 then some (a, b) else none
| _ => none
+theorem diffVarsOf_sound {c : Expression p} {a b : Variable} (h : diffVarsOf c = some (a, b)) :
+ (∀ env, c.eval env = env a - env b) ∧ (∀ x ∈ c.vars, x = a ∨ x = b) := by
+ unfold diffVarsOf... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_cf6c908cd58c_0 | 735acf9b70f10632 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/AddrDiseq.lean | AddrDiseq | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 1 | [
{
"theorem_name": "ptrReductions_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 28,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold ptrReductions at hmem\n cases hL : linearize E with\n | none => rw [hL] at hmem; simp at hmem\n | some L =>\... | [
{
"name": "ptrBranchesOf_eval",
"text": "theorem ptrBranchesOf_eval (k : ZMod p) (A : LinExpr p) (δ cx : ZMod p) (rest : LinExpr p)\n (env : Variable → ZMod p) :\n ((ptrBranchesOf k A δ cx rest).1).eval env = rest.eval env + cx * (-(k⁻¹) * A.eval env) ∧\n ((ptrBranchesOf k A δ cx rest).2).eval env\... | [
{
"name": "ptrReductions_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 35,
"n_chars": 1572,
"n_subproofs": 9,
"n_tactics": 34,
"cyclomatic": 4,
"n_automation": 5,
"n_rewrites": 8,
"n_structural": 7,
"automation_only": false,
"max_... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | @@ -40,6 +40,27 @@
let r2 := r1.add ⟨-(k⁻¹ * δ), []⟩
((rest.add (r1.scale cx)).norm, (rest.add (r2.scale cx)).norm)
+theorem ptrBranchesOf_eval (k : ZMod p) (A : LinExpr p) (δ cx : ZMod p) (rest : LinExpr p)
+ (env : Variable → ZMod p) :
+ ((ptrBranchesOf k A δ cx rest).1).eval env = rest.eval env + cx * ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_cf6c908cd58c_1 | e6495860e2c29f37 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/AddrDiseq.lean | AddrDiseq | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 1 | [
{
"theorem_name": "exprTwoRootNeq_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 15,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold exprTwoRootNeq at h\n rw [List.any_eq_true] at h\n obtain ⟨⟨a1, a2⟩, hred, hinner⟩ := h\n rw [List.any_eq_t... | [
{
"name": "constDiffNZ_sound",
"text": "theorem constDiffNZ_sound (a b : LinExpr p) (h : constDiffNZ a b = true)\n (env : Variable → ZMod p) : a.eval env ≠ b.eval env := by\n unfold constDiffNZ at h\n simp only [Bool.and_eq_true] at h\n obtain ⟨hterms, hconst⟩ := h\n have hd : ((a.add (b.scale (-1)))... | [
{
"name": "exprTwoRootNeq_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 3,
"n_lines": 19,
"n_chars": 877,
"n_subproofs": 5,
"n_tactics": 17,
"cyclomatic": 5,
"n_automation": 1,
"n_rewrites": 4,
"n_structural": 9,
"automation_only": false,
"max_... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | @@ -179,6 +179,21 @@
let d := (a.add (b.scale (-1))).norm
d.terms.isEmpty && decide (d.const ≠ 0)
+theorem constDiffNZ_sound (a b : LinExpr p) (h : constDiffNZ a b = true)
+ (env : Variable → ZMod p) : a.eval env ≠ b.eval env := by
+ unfold constDiffNZ at h
+ simp only [Bool.and_eq_true] at h
+ obtain ⟨ht... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_cf6c908cd58c_2 | 70eef5711cb5d0da | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/AddrDiseq.lean | AddrDiseq | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 4 | 1 | [
{
"theorem_name": "addrTwoRootNeq_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 26,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold addrTwoRootNeq at h\n obtain ⟨slot, hslot, hcond⟩ := List.any_eq_true.1 h\n intro heq\n obtain ⟨j, hj⟩ : ∃ ... | [
{
"name": "exprTwoRootNeq_sound",
"text": "theorem exprTwoRootNeq_sound (T : TwoRootMap p constraints)\n (e e' : Expression p) (h : exprTwoRootNeq T e e' = true) (env : Variable → ZMod p)\n (hcon : ∀ c ∈ constraints, c.eval env = 0) : e.eval env ≠ e'.eval env := by\n unfold exprTwoRootNeq at h\n rw ... | [
{
"name": "addrTwoRootNeq_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 4,
"n_lines": 31,
"n_chars": 1789,
"n_subproofs": 7,
"n_tactics": 30,
"cyclomatic": 3,
"n_automation": 5,
"n_rewrites": 10,
"n_structural": 7,
"automation_only": false,
"ma... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | import ApcOptimizer.Implementation.OptimizerPasses.RootPairUnify
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Two-root address disequality (symbolic-timestamp forwarding enabler)
`addrConstsNeq` (`BusUnify.lean`) can only refute an in-window memory message as a
*different-address* one when both ... | @@ -202,6 +202,24 @@
constDiffNZ red.1 red'.1 && constDiffNZ red.1 red'.2 &&
constDiffNZ red.2 red'.1 && constDiffNZ red.2 red'.2))
+theorem exprTwoRootNeq_sound (T : TwoRootMap p constraints)
+ (e e' : Expression p) (h : exprTwoRootNeq T e e' = true) (env : Variable → ZMod p)
+ (hcon : ∀ c ∈ cons... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_2708f40fb3e9_0 | 9c2639a7d0fee892 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusUnify.lean | BusUnify | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 3 | 1 | [
{
"theorem_name": "consecutivePayloadEq",
"depth": 1,
"n_commands": 0,
"n_lines": 14,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have hadm' : bs.admissible ((cs.busInteractions.map (fun bi => bi.eval env)).filter\n (fun m => decide (m.multip... | [
{
"name": "map_eval_filter_busId",
"text": "/-- Filtering evaluated messages by bus id equals evaluating the bus-filtered interactions\n (evaluation preserves the bus id). -/\ntheorem map_eval_filter_busId (l : List (BusInteraction (Expression p))) (busId : Nat)\n (env : Variable → ZMod p) :\n (l.m... | [
{
"name": "consecutivePayloadEq",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 32,
"n_chars": 1863,
"n_subproofs": 3,
"n_tactics": 14,
"cyclomatic": 1,
"n_automation": 3,
"n_rewrites": 1,
"n_structural": 4,
"automation_only": false,
"max... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.AddrDiseq
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Unified consecutive-match bus unification (one pass for memory *and* the execution bridge)
The abstract `admissible` spec — *co... | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.AddrDiseq
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Unified consecutive-match bus unification (one pass for memory *and* the execution bridge)
The abstract `admissible` spec — *co... | @@ -71,6 +71,21 @@
/-! ## The `admissible` → payload-equality bridge -/
+/-- Filtering evaluated messages by bus id equals evaluating the bus-filtered interactions
+ (evaluation preserves the bus id). -/
+theorem map_eval_filter_busId (l : List (BusInteraction (Expression p))) (busId : Nat)
+ (env : Variable... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_2708f40fb3e9_1 | 95f421b5dd7bd7a9 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusUnify.lean | BusUnify | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 3 | 1 | [
{
"theorem_name": "checkPair_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 38,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold checkPair at hchk\n simp only [Bool.and_eq_true] at hchk\n obtain ⟨⟨⟨⟨hspl, hSm⟩, hRm⟩, haddrEq⟩, hmidall⟩ := hch... | [
{
"name": "addrConstsNeq_sound",
"text": "theorem addrConstsNeq_sound (shape : MemoryBusShape) (S bi : BusInteraction (Expression p))\n (h : addrConstsNeq shape S bi = true) (env : Variable → ZMod p) :\n shape.address (S.eval env) ≠ shape.address (bi.eval env) := by\n obtain ⟨slot, hslot, hcond⟩ := L... | [
{
"name": "checkPair_sound",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 3,
"n_lines": 53,
"n_chars": 2941,
"n_subproofs": 15,
"n_tactics": 40,
"cyclomatic": 3,
"n_automation": 4,
"n_rewrites": 8,
"n_structural": 12,
"automation_only": false,
"max_ne... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.AddrDiseq
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Unified consecutive-match bus unification (one pass for memory *and* the execution bridge)
The abstract `admissible` spec — *co... | import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
import ApcOptimizer.Implementation.OptimizerPasses.AddrDiseq
import ApcOptimizer.MemoryBus
set_option autoImplicit false
/-! # Unified consecutive-match bus unification (one pass for memory *and* the execution bridge)
The abstract `admissible` spec — *co... | @@ -33,6 +33,44 @@
| _, _ => false)
| _, _ => false)
+theorem addrConstsNeq_sound (shape : MemoryBusShape) (S bi : BusInteraction (Expression p))
+ (h : addrConstsNeq shape S bi = true) (env : Variable → ZMod p) :
+ shape.address (S.eval env) ≠ shape.address (bi.eval env) := by
+ obtain ⟨slot, hsl... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_b1103e3a9ec8_0 | 21b1a9ffc7a95a09 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SeqzCollapse.lean | SeqzCollapse | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 19 | 4 | [
{
"theorem_name": "val_add_one",
"depth": 1,
"n_commands": 0,
"n_lines": 3,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n rw [ZMod.val_add, val_one_eq hp]\n exact Nat.mod_eq_of_lt (by omega)",
"n_chars": 74,
"n_subproofs": 0,
"n_tactics... | [
{
"name": "val_one_eq",
"text": "/-- `(1 : ZMod p).val = 1` when `p` is large. -/\ntheorem val_one_eq [NeZero p] (hp : 1024 ≤ p) : (1 : ZMod p).val = 1 := by\n haveI : Fact (1 < p) := ⟨by omega⟩\n exact ZMod.val_one p\n\n",
"fan_in": 4,
"n_lines": 6,
"n_chars": 191,
"n_subproofs": 0,
"... | [
{
"name": "val_add_one",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 7,
"n_chars": 247,
"n_subproofs": 0,
"n_tactics": 3,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 1,
"n_structural": 1,
"automation_only": false,
"max_nesting": 2... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | @@ -149,13 +149,23 @@
have := Nat.le_of_dvd hk1 hdvd
omega
+/-- `(1 : ZMod p).val = 1` when `p` is large. -/
+theorem val_one_eq [NeZero p] (hp : 1024 ≤ p) : (1 : ZMod p).val = 1 := by
+ haveI : Fact (1 < p) := ⟨by omega⟩
+ exact ZMod.val_one p
+
/-- Adding `1` to a byte value adds `1` to its `.val`. -/
the... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_b1103e3a9ec8_1 | a278f4934c3ba46e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SeqzCollapse.lean | SeqzCollapse | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 19 | 1 | [
{
"theorem_name": "oneHot",
"depth": 1,
"n_commands": 0,
"n_lines": 18,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n haveI : NeZero p := ⟨by omega⟩\n have h1ne : (1 : ZMod p) ≠ 0 := one_ne_zero\n have h2ne : (2 : ZMod p) ≠ 0 := by\n have := sm... | [
{
"name": "small_natCast_ne_zero",
"text": "/-- A small positive natural is nonzero in `ZMod p` when `p` is large. -/\ntheorem small_natCast_ne_zero [NeZero p] (hp : 1024 ≤ p) {k : ℕ} (hk1 : 0 < k) (hk2 : k < 1024) :\n ((k : ℕ) : ZMod p) ≠ 0 := by\n rw [Ne, ZMod.natCast_eq_zero_iff]\n intro hdvd\n hav... | [
{
"name": "oneHot",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 25,
"n_chars": 1426,
"n_subproofs": 5,
"n_tactics": 42,
"cyclomatic": 11,
"n_automation": 23,
"n_rewrites": 0,
"n_structural": 12,
"automation_only": false,
"max_nesting": ... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | @@ -141,6 +141,14 @@
· exact Or.inl h
· exact Or.inr (by linear_combination h)
+/-- A small positive natural is nonzero in `ZMod p` when `p` is large. -/
+theorem small_natCast_ne_zero [NeZero p] (hp : 1024 ≤ p) {k : ℕ} (hk1 : 0 < k) (hk2 : k < 1024) :
+ ((k : ℕ) : ZMod p) ≠ 0 := by
+ rw [Ne, ZMod.natCast_e... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_b1103e3a9ec8_2 | 73d13be3efc367c6 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SeqzCollapse.lean | SeqzCollapse | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 19 | 1 | [
{
"theorem_name": "seqz_forward",
"depth": 1,
"n_commands": 0,
"n_lines": 108,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n haveI hnz : NeZero p := ⟨by omega⟩\n have hv1 : (1 : ZMod p).val = 1 := val_one_eq hp\n have hbm3 := zbool hE1\n have hbm... | [
{
"name": "val_add_one",
"text": "/-- Adding `1` to a byte value adds `1` to its `.val`. -/\ntheorem val_add_one [NeZero p] (hp : 1024 ≤ p) {a : ZMod p} (ha : a.val < 256) :\n (a + 1).val = a.val + 1 := by\n rw [ZMod.val_add, val_one_eq hp]\n exact Nat.mod_eq_of_lt (by omega)\n\n",
"fan_in": 1,
... | [
{
"name": "seqzCollapse_correct",
"fan_in": 0,
"n_deps_direct": 12,
"n_deps_transitive": 19,
"n_lines": 468,
"n_chars": 26963,
"n_subproofs": 112,
"n_tactics": 453,
"cyclomatic": 18,
"n_automation": 127,
"n_rewrites": 68,
"n_structural": 136,
"automation_only": fa... | 19 | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | import ApcOptimizer.Implementation.OptimizerPasses.HintCollapse
set_option autoImplicit false
set_option linter.unusedSimpArgs false
/-! # Collapsing the `sltu x, 1` (seqz) comparison gadget to a two-line is-zero gadget
powdr specialises OpenVM's `LessThanCoreChip` when the second comparand is the constant `1`
(`slt... | @@ -154,6 +154,12 @@
haveI : Fact (1 < p) := ⟨by omega⟩
exact ZMod.val_one p
+/-- Adding `1` to a byte value adds `1` to its `.val`. -/
+theorem val_add_one [NeZero p] (hp : 1024 ≤ p) {a : ZMod p} (ha : a.val < 256) :
+ (a + 1).val = a.val + 1 := by
+ rw [ZMod.val_add, val_one_eq hp]
+ exact Nat.mod_eq_of_... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_086f3c9c128a_0 | d273ee03eb5b98cd | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SubstMap.lean | SubstMap | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "ConstraintSystem.substF_vars_subset",
"depth": 1,
"n_commands": 0,
"n_lines": 21,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro z hz\n rw [ConstraintSystem.mem_vars] at hz\n rcases hz with ⟨c, hc, hzc⟩ | ⟨bi, hbi, hzbi⟩\n ... | [
{
"name": "Expression.substF_vars",
"text": "/-- Simultaneous substitution introduces no variable outside `e` and the mapped solutions. -/\ntheorem Expression.substF_vars (f : Variable → Option (Expression p)) (e : Expression p) :\n ∀ z ∈ (e.substF f).vars, z ∈ e.vars ∨ ∃ y t, f y = some t ∧ z ∈ t.vars :... | [
{
"name": "ConstraintSystem.substF_vars_subset",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 27,
"n_chars": 1384,
"n_subproofs": 3,
"n_tactics": 21,
"cyclomatic": 6,
"n_automation": 7,
"n_rewrites": 1,
"n_structural": 15,
"automation_only":... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Simultaneous substitution: the batch counterpart of `Subst.lean`
`Subst.lean` eliminates one variable per system rewrite; on parsed machines with hundreds of
solvable variables that costs one full-system traversal *per varia... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Simultaneous substitution: the batch counterpart of `Subst.lean`
`Subst.lean` eliminates one variable per system rewrite; on parsed machines with hundreds of
solvable variables that costs one full-system traversal *per varia... | @@ -49,6 +49,29 @@
{ algebraicConstraints := cs.algebraicConstraints.map (·.substF f),
busInteractions := cs.busInteractions.map (·.substF f) }
+/-- Simultaneous substitution introduces no variable outside `e` and the mapped solutions. -/
+theorem Expression.substF_vars (f : Variable → Option (Expression p)) ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_086f3c9c128a_1 | 3590de1ebfc22f23 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/SubstMap.lean | SubstMap | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "ConstraintSystem.substF_correct",
"depth": 1,
"n_commands": 0,
"n_lines": 21,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n refine PassCorrect.ofEnvEq ?_ ?_ (cs.substF_vars_subset f hfv) ?_\n · -- soundness: (cs.substF f) implies... | [
{
"name": "envF_eq_self",
"text": "/-- If every mapped pair is respected by `env`, rebinding changes nothing. -/\ntheorem envF_eq_self (f : Variable → Option (Expression p)) (env : Variable → ZMod p)\n (H : ∀ y t, f y = some t → env y = t.eval env) : envF f env = env := by\n funext y\n unfold envF\n c... | [
{
"name": "ConstraintSystem.substF_correct",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 30,
"n_chars": 1648,
"n_subproofs": 3,
"n_tactics": 24,
"cyclomatic": 1,
"n_automation": 3,
"n_rewrites": 4,
"n_structural": 12,
"automation_only": fal... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Simultaneous substitution: the batch counterpart of `Subst.lean`
`Subst.lean` eliminates one variable per system rewrite; on parsed machines with hundreds of
solvable variables that costs one full-system traversal *per varia... | import ApcOptimizer.Implementation.OptimizerPasses.Basic
set_option autoImplicit false
/-! # Simultaneous substitution: the batch counterpart of `Subst.lean`
`Subst.lean` eliminates one variable per system rewrite; on parsed machines with hundreds of
solvable variables that costs one full-system traversal *per varia... | @@ -47,6 +47,17 @@
| add a b iha ihb => simp only [Expression.substF, Expression.eval, iha, ihb]
| mul a b iha ihb => simp only [Expression.substF, Expression.eval, iha, ihb]
+/-- If every mapped pair is respected by `env`, rebinding changes nothing. -/
+theorem envF_eq_self (f : Variable → Option (Expression p... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_0 | ec3c531d27ac2c87 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "foldRewrite_agree",
"depth": 1,
"n_commands": 0,
"n_lines": 49,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n -- For a wholly-in-`xs` expression, `env` and `envOf s` agree on its variables.\n have hcongr : ∀ e : Expression p, e.v... | [
{
"name": "constOnSurvs_sound",
"text": "/-- If `constOnSurvs` accepts `e` with value `c`, then `e` evaluates to `c` on every survivor. -/\ntheorem constOnSurvs_sound (survs : List (List (Variable × ZMod p))) (e : Expression p)\n (c : ZMod p) (h : constOnSurvs survs e = some c) : ∀ s ∈ survs, e.eval (env... | [
{
"name": "foldRewrite_agree",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 57,
"n_chars": 2855,
"n_subproofs": 7,
"n_tactics": 50,
"cyclomatic": 4,
"n_automation": 6,
"n_rewrites": 20,
"n_structural": 8,
"automation_only": false,
"max_n... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -36,6 +36,24 @@
some (e.eval (envOf s₀))
else none
+/-- If `constOnSurvs` accepts `e` with value `c`, then `e` evaluates to `c` on every survivor. -/
+theorem constOnSurvs_sound (survs : List (List (Variable × ZMod p))) (e : Expression p)
+ (c : ZMod p) (h : constOnSurvs survs e = some c) : ∀ s ∈ su... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_1 | b3276272d1d1caa7 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "foldRewrite_agree_covered",
"depth": 1,
"n_commands": 0,
"n_lines": 25,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have hkeys : doms.map Prod.fst = xs := groupDoms_fst (coveredCsOf cs xs) xs doms hdoms\n have hmemdoms : ∀ yd ∈... | [
{
"name": "foldRewrite_agree",
"text": "/-- On an environment that agrees on `xs` with some survivor `s`, `foldRewrite` is\n evaluation-preserving. The folded constants are exactly the survivor-constant values, and `s`'s\n membership pins them; unfolded nodes recurse. -/\ntheorem foldRewrite_agree (xs... | [
{
"name": "foldRewrite_agree_covered",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 35,
"n_chars": 1807,
"n_subproofs": 8,
"n_tactics": 27,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 6,
"n_structural": 8,
"automation_only": false,
... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -75,6 +75,62 @@
/-! ## Agreement with the identity on any survivor-matching environment -/
+/-- On an environment that agrees on `xs` with some survivor `s`, `foldRewrite` is
+ evaluation-preserving. The folded constants are exactly the survivor-constant values, and `s`'s
+ membership pins them; unfolded ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_2 | 16b7be66ee9e9f26 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 3 | [
{
"theorem_name": "foldOut_sideEffects_eq",
"depth": 1,
"n_commands": 0,
"n_lines": 11,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n show ((cs.busInteractions.map (·.mapExpr (foldRewrite xs survs))).filter\n (fun bi => bs.isStateful bi.busId))... | [
{
"name": "mapExpr_eval_of_agree",
"text": "/-- Bus-interaction-level agreement, from any expression-level agreement `hag`, applied to the\n multiplicity and every payload slot. -/\ntheorem mapExpr_eval_of_agree (g : Expression p → Expression p) (env : Variable → ZMod p)\n (hag : ∀ e : Expression p, (... | [
{
"name": "foldOut_sideEffects_eq",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 17,
"n_chars": 1002,
"n_subproofs": 0,
"n_tactics": 12,
"cyclomatic": 1,
"n_automation": 2,
"n_rewrites": 4,
"n_structural": 1,
"automation_only": false,
"m... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -131,6 +131,19 @@
= a.eval env * b.eval env
rw [iha, ihb]
+/-- Bus-interaction-level agreement, from any expression-level agreement `hag`, applied to the
+ multiplicity and every payload slot. -/
+theorem mapExpr_eval_of_agree (g : Expression p → Expression p) (env : Variable → ZMod p)
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_3 | 7ace42acf4a09081 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "foldOut_vars_subset",
"depth": 1,
"n_commands": 0,
"n_lines": 17,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro v hv\n rcases ConstraintSystem.mem_vars.1 hv with ⟨c, hc, hcv⟩ | ⟨bi, hbi, hbiv⟩\n · simp only [foldOut, List.... | [
{
"name": "foldRewrite_vars",
"text": "/-- Folding never introduces a variable: every variable of `foldRewrite … e` is a variable of `e`. -/\ntheorem foldRewrite_vars (xs : List Variable) (survs : List (List (Variable × ZMod p)))\n (e : Expression p) : ∀ v ∈ (foldRewrite xs survs e).vars, v ∈ e.vars := b... | [
{
"name": "foldOut_vars_subset",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 22,
"n_chars": 1099,
"n_subproofs": 3,
"n_tactics": 17,
"cyclomatic": 4,
"n_automation": 6,
"n_rewrites": 0,
"n_structural": 11,
"automation_only": false,
"max... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -144,6 +144,55 @@
/-! ## Variables of the rewrite -/
+/-- Folding never introduces a variable: every variable of `foldRewrite … e` is a variable of `e`. -/
+theorem foldRewrite_vars (xs : List Variable) (survs : List (List (Variable × ZMod p)))
+ (e : Expression p) : ∀ v ∈ (foldRewrite xs survs e).vars, v ∈ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_4 | 825975b4164c963d | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "foldOut_correct",
"depth": 1,
"n_commands": 0,
"n_lines": 73,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n set survs := groupSurvivors cs xs doms with hsurv_def\n -- covered constraints are satisfied by any assignment of the out... | [
{
"name": "foldRewrite_agree_covered",
"text": "/-- If `env` satisfies every covered constraint, `foldRewrite` (over the survivors of those\n constraints) is evaluation-preserving on `env`. Prime `p` (for `groupDoms_sound`). -/\ntheorem foldRewrite_agree_covered [Fact p.Prime] (cs : ConstraintSystem p) (... | [
{
"name": "foldOut_correct",
"fan_in": 0,
"n_deps_direct": 5,
"n_deps_transitive": 8,
"n_lines": 83,
"n_chars": 4346,
"n_subproofs": 19,
"n_tactics": 77,
"cyclomatic": 2,
"n_automation": 13,
"n_rewrites": 7,
"n_structural": 34,
"automation_only": false,
"max_n... | 8 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -193,6 +193,40 @@
covered constraints, so any environment satisfying **all** the covered constraints pins the group
to one of the survivors — under which `foldRewrite` is the identity. -/
+/-- If `env` satisfies every covered constraint, `foldRewrite` (over the survivors of those
+ constraints) is evaluation-... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_5 | 25d27b6b846a4026 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 5 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "coveredBy_shares_var",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n rw [coveredBy, Bool.and_eq_true] at h\n obtain ⟨hhv, hvin⟩ := h\n obtain ⟨v, hmem⟩ := List.exists_mem_of_ne_nil c.va... | [
{
"name": "hasVar_vars_ne_nil",
"text": "/-- An expression with any variable has a nonempty variable list. -/\ntheorem hasVar_vars_ne_nil (c : Expression p) (h : c.hasVar = true) : c.vars ≠ [] := by\n induction c with\n | const n => simp [Expression.hasVar] at h\n | var y => simp [Expression.vars]\n | a... | [
{
"name": "coveredBy_shares_var",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 10,
"n_chars": 585,
"n_subproofs": 2,
"n_tactics": 5,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 3,
"automation_only": false,
"max_n... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -417,10 +417,34 @@
arr := cs.algebraicConstraints.toArray
harr := rfl
+/-- An expression with any variable has a nonempty variable list. -/
+theorem hasVar_vars_ne_nil (c : Expression p) (h : c.hasVar = true) : c.vars ≠ [] := by
+ induction c with
+ | const n => simp [Expression.hasVar] at h
+ | var y => ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_aec84daf8f67_6 | d6cf745056b25099 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DomainFold.lean | DomainFold | 6 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 10 | 1 | [
{
"theorem_name": "coveredCsIdx_eq",
"depth": 1,
"n_commands": 0,
"n_lines": 4,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n rw [fidx.hidx, fidx.harr, coveredCsOf]\n exact CoveredIndex.coveredIdx_eq_filter Expression.vars cs.algebraicConstraints (... | [
{
"name": "coveredBy_shares_var",
"text": "/-- A `coveredBy`-item shares a variable with the target `xs` (`hasVar` gives one variable;\n `varsInF` puts every one in `xs`) — the completeness hypothesis `coveredIdx_eq_filter` needs. -/\ntheorem coveredBy_shares_var (xs : List Variable) (c : Expression p) (... | [
{
"name": "coveredCsIdx_eq",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 9,
"n_chars": 589,
"n_subproofs": 0,
"n_tactics": 4,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 1,
"n_structural": 1,
"automation_only": false,
"max_nesting... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | import ApcOptimizer.Implementation.OptimizerPasses.Reencode
set_option autoImplicit false
/-! # Domain-constant subexpression folding
A powdr-style simplification, split off from the re-encoder's constant-emission logic (see
`Reencode.interpOf`): if a *wholly-in-group* subexpression takes the **same value on every
s... | @@ -437,10 +437,22 @@
· exact iha h hnil.1
· exact ihb h hnil.2
+/-- A `coveredBy`-item shares a variable with the target `xs` (`hasVar` gives one variable;
+ `varsInF` puts every one in `xs`) — the completeness hypothesis `coveredIdx_eq_filter` needs. -/
+theorem coveredBy_shares_var (xs : List Variable... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_00924a16f868_0 | f34655fe58711bda | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagFold.lean | FlagFold | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 8 | 1 | [
{
"theorem_name": "singleVar_mem_boxTautoReplace",
"depth": 1,
"n_commands": 0,
"n_lines": 10,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have hcf : btCert (singleVarCs cs.algebraicConstraints) c = false := by\n unfold btCert\n have h1 : ¬ ... | [
{
"name": "btKeep_of_cert_false",
"text": "theorem btKeep_of_cert_false {singles : List (Expression p)}\n {domOf : Variable → Option (List (ZMod p))} {c : Expression p}\n (h : btCert singles c = false) : btKeep singles domOf c = false := by\n unfold btKeep\n rw [h, Bool.and_false]\n\n",
"fan_in"... | [
{
"name": "singleVar_mem_boxTautoReplace",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 18,
"n_chars": 830,
"n_subproofs": 3,
"n_tactics": 10,
"cyclomatic": 1,
"n_automation": 3,
"n_rewrites": 2,
"n_structural": 1,
"automation_only": false,
... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | @@ -60,6 +60,12 @@
rw [Bool.and_eq_true] at h
exact h.2
+theorem btKeep_of_cert_false {singles : List (Expression p)}
+ {domOf : Variable → Option (List (ZMod p))} {c : Expression p}
+ (h : btCert singles c = false) : btKeep singles domOf c = false := by
+ unfold btKeep
+ rw [h, Bool.and_false]
+
/-- R... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_00924a16f868_1 | e7af786ac1056a2e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagFold.lean | FlagFold | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 8 | 1 | [
{
"theorem_name": "ConstraintSystem.boxTautoReplace_correct",
"depth": 1,
"n_commands": 0,
"n_lines": 76,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n -- every replaced constraint is zero under any assignment satisfying the output\n have hzero : ∀... | [
{
"name": "singleVar_mem_boxTautoReplace",
"text": "/-- A single-variable constraint is never replaced (it fails the ≥ 2 guard), so it survives\n verbatim into the output — which is what lets the box justification stand on the output's\n own satisfaction. -/\ntheorem singleVar_mem_boxTautoReplace (cs ... | [
{
"name": "ConstraintSystem.boxTautoReplace_correct",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 3,
"n_lines": 81,
"n_chars": 4083,
"n_subproofs": 16,
"n_tactics": 81,
"cyclomatic": 4,
"n_automation": 9,
"n_rewrites": 13,
"n_structural": 35,
"automation... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | @@ -74,6 +74,23 @@
{ cs with algebraicConstraints := cs.algebraicConstraints.map (fun c =>
if btKeep singles domOf c then Expression.const 0 else c) }
+/-- A single-variable constraint is never replaced (it fails the ≥ 2 guard), so it survives
+ verbatim into the output — which is what lets the box justi... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_00924a16f868_2 | 60b199bd710d99ee | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagFold.lean | FlagFold | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 8 | 1 | [
{
"theorem_name": "slotEqCert_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 21,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold slotEqCert at h\n rw [Bool.or_eq_true] at h\n rcases h with heq | hany\n · rw [eq_of_beq heq]\n · obtain ⟨x, _... | [
{
"name": "boxAgree_sound",
"text": "theorem boxAgree_sound [Fact p.Prime] (singles : List (Expression p)) (R R' : Expression p)\n (h : boxAgree singles R R' = true) (env : Variable → ZMod p)\n (hdom : ∀ c ∈ singles, c.eval env = 0) : R.eval env = R'.eval env := by\n unfold boxAgree at h\n simp only... | [
{
"name": "slotEqCert_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 25,
"n_chars": 994,
"n_subproofs": 5,
"n_tactics": 23,
"cyclomatic": 4,
"n_automation": 3,
"n_rewrites": 7,
"n_structural": 8,
"automation_only": false,
"max_nest... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | @@ -283,6 +283,48 @@
bi.payload.length == bi'.payload.length &&
(bi.payload.zip bi'.payload).all (fun ee => slotEqCert singles ee.1 ee.2)
+theorem boxAgree_sound [Fact p.Prime] (singles : List (Expression p)) (R R' : Expression p)
+ (h : boxAgree singles R R' = true) (env : Variable → ZMod p)
+ (hdom : ∀ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_00924a16f868_3 | 858f6f117868862c | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagFold.lean | FlagFold | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 8 | 1 | [
{
"theorem_name": "msgEqCert_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 33,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold msgEqCert at h\n rw [Bool.and_eq_true, Bool.and_eq_true, Bool.and_eq_true] at h\n obtain ⟨⟨⟨hbus, hmult⟩, hlen⟩, ... | [
{
"name": "slotEqCert_sound",
"text": "theorem slotEqCert_sound [Fact p.Prime] (singles : List (Expression p)) (e e' : Expression p)\n (h : slotEqCert singles e e' = true) (env : Variable → ZMod p)\n (hdom : ∀ c ∈ singles, c.eval env = 0) : e.eval env = e'.eval env := by\n unfold slotEqCert at h\n r... | [
{
"name": "msgEqCert_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 38,
"n_chars": 1794,
"n_subproofs": 9,
"n_tactics": 36,
"cyclomatic": 3,
"n_automation": 9,
"n_rewrites": 11,
"n_structural": 6,
"automation_only": false,
"max_nes... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | @@ -325,6 +325,30 @@
hagree v (List.mem_eraseDups.2 (List.mem_append_right _ hv)))
rw [← hRa, ← hRa', hRR]
+theorem slotEqCert_sound [Fact p.Prime] (singles : List (Expression p)) (e e' : Expression p)
+ (h : slotEqCert singles e e' = true) (env : Variable → ZMod p)
+ (hdom : ∀ c ∈ singles, c.eval env... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_00924a16f868_4 | ffee545e75732f03 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/FlagFold.lean | FlagFold | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 8 | 1 | [
{
"theorem_name": "ConstraintSystem.pointwiseDupDrop_correct",
"depth": 1,
"n_commands": 0,
"n_lines": 36,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n cs.filterBusEntailed_correct bs _\n (by\n intro bi _ hkf\n unfold pdKeep at h... | [
{
"name": "pdFirst_keep",
"text": "/-- A first-of-class interaction is always kept — the depth-1 justification for `pdKeep`. -/\ntheorem pdFirst_keep (bs : BusSemantics p) (singles : List (Expression p))\n (bis : List (BusInteraction (Expression p))) (b : BusInteraction (Expression p))\n (h : pdFirst ... | [
{
"name": "ConstraintSystem.pointwiseDupDrop_correct",
"fan_in": 0,
"n_deps_direct": 2,
"n_deps_transitive": 4,
"n_lines": 45,
"n_chars": 2036,
"n_subproofs": 9,
"n_tactics": 36,
"cyclomatic": 2,
"n_automation": 3,
"n_rewrites": 8,
"n_structural": 9,
"automation_o... | 4 | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | import ApcOptimizer.Implementation.OptimizerPasses.FlagUnify
set_option autoImplicit false
/-! # Folding the XOR flag component (composite pass, part B: box tautologies)
Log entry 63: the last flag component of each unified scaled-check pair relates to the
survivors by XOR — degree 2 as a field polynomial — so subst... | @@ -404,6 +404,40 @@
!((bis.take i).any (fun b => !bs.isStateful b.busId && msgEqCert singles b bi
&& pdFirst bs singles bis b)))
+/-- A first-of-class interaction is always kept — the depth-1 justification for `pdKeep`. -/
+theorem pdFirst_keep (bs : BusSemantics p) (singles : List (Expression p))
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_244b3c6fbd3e_0 | 36ad2d4bb7aafd53 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BoxRewrite.lean | BoxRewrite | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "brCert_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 60,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold brCert at h\n rw [Bool.and_eq_true, Bool.and_eq_true, Bool.and_eq_true] at h\n obtain ⟨_h2, ⟨⟨hcover, _hcap⟩, hall⟩⟩... | [
{
"name": "envF_ptFun_self",
"text": "/-- `envF` over a point map is the identity when the point is the environment's own\n restriction. -/\ntheorem envF_ptFun_self (doms : List (Variable × List (ZMod p))) (env : Variable → ZMod p) :\n envF (ptFun (doms.map (fun vd => (vd.1, env vd.1)))) env = env := ... | [
{
"name": "brCert_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 66,
"n_chars": 3276,
"n_subproofs": 14,
"n_tactics": 60,
"cyclomatic": 5,
"n_automation": 7,
"n_rewrites": 16,
"n_structural": 10,
"automation_only": false,
"max_nest... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | @@ -102,6 +102,23 @@
| some l1, some l2 => canonEq l1.norm l2.norm
| _, _ => false))
+/-- `envF` over a point map is the identity when the point is the environment's own
+ restriction. -/
+theorem envF_ptFun_self (doms : List (Variable × List (ZMod p))) (env : Variable → ZMod p) :
+ envF (ptFun (dom... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_244b3c6fbd3e_1 | d3cf17a51d8111eb | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BoxRewrite.lean | BoxRewrite | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "brRw_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 15,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp only [brRw]\n split_ifs with hd\n · rfl\n · cases hr : reduceExpr (e.vars.eraseDups.filter (fun v =>\n match fin... | [
{
"name": "brCert_sound",
"text": "theorem brCert_sound [Fact p.Prime] (singles : List (Expression p)) (e e' : Expression p)\n (h : brCert singles e e' = true) (env : Variable → ZMod p)\n (hdom : ∀ c ∈ singles, c.eval env = 0) : e.eval env = e'.eval env := by\n unfold brCert at h\n rw [Bool.and_eq_t... | [
{
"name": "brRw_sound",
"fan_in": 2,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 20,
"n_chars": 678,
"n_subproofs": 0,
"n_tactics": 15,
"cyclomatic": 3,
"n_automation": 5,
"n_rewrites": 1,
"n_structural": 2,
"automation_only": false,
"max_nesting": ... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | @@ -119,6 +119,71 @@
exact List.mem_map.2 ⟨vd, hvd, rfl⟩
· rw [if_neg hin]
+theorem brCert_sound [Fact p.Prime] (singles : List (Expression p)) (e e' : Expression p)
+ (h : brCert singles e e' = true) (env : Variable → ZMod p)
+ (hdom : ∀ c ∈ singles, c.eval env = 0) : e.eval env = e'.eval env := by
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_244b3c6fbd3e_2 | aab6c7910fe92095 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BoxRewrite.lean | BoxRewrite | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 2 | [
{
"theorem_name": "brBi_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 6,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold brBi BusInteraction.eval\n simp only [BusInteraction.mk.injEq]\n refine ⟨trivial, brRw_sound singles _ _ env hdom, ?_⟩\n... | [
{
"name": "brRw_sound",
"text": "theorem brRw_sound [Fact p.Prime] (singles : List (Expression p)) (bound : Nat)\n (e : Expression p) (env : Variable → ZMod p)\n (hdom : ∀ c ∈ singles, c.eval env = 0) :\n (brRw singles bound e).eval env = e.eval env := by\n simp only [brRw]\n split_ifs with hd\n ... | [
{
"name": "brBi_eval",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 3,
"n_lines": 11,
"n_chars": 482,
"n_subproofs": 0,
"n_tactics": 6,
"cyclomatic": 1,
"n_automation": 2,
"n_rewrites": 2,
"n_structural": 2,
"automation_only": false,
"max_nesting": 2
... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | @@ -199,6 +199,25 @@
then e' else e
| none => e
+theorem brRw_sound [Fact p.Prime] (singles : List (Expression p)) (bound : Nat)
+ (e : Expression p) (env : Variable → ZMod p)
+ (hdom : ∀ c ∈ singles, c.eval env = 0) :
+ (brRw singles bound e).eval env = e.eval env := by
+ simp only [brRw]
+ sp... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_244b3c6fbd3e_3 | 8d76fafeb9bc9c46 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BoxRewrite.lean | BoxRewrite | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 6 | 1 | [
{
"theorem_name": "ConstraintSystem.boxRewrite_correct",
"depth": 1,
"n_commands": 0,
"n_lines": 94,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n -- single-variable domain sources survive verbatim\n have hsingle : ∀ c ∈ singleVarCs cs.algebraicCon... | [
{
"name": "brBi_eval",
"text": "theorem brBi_eval [Fact p.Prime] (singles : List (Expression p)) (db : DegreeBound)\n (bi : BusInteraction (Expression p)) (env : Variable → ZMod p)\n (hdom : ∀ c ∈ singles, c.eval env = 0) :\n (brBi singles db bi).eval env = bi.eval env := by\n unfold brBi BusInter... | [
{
"name": "ConstraintSystem.boxRewrite_correct",
"fan_in": 0,
"n_deps_direct": 4,
"n_deps_transitive": 6,
"n_lines": 98,
"n_chars": 4514,
"n_subproofs": 22,
"n_tactics": 93,
"cyclomatic": 5,
"n_automation": 16,
"n_rewrites": 18,
"n_structural": 39,
"automation_onl... | 6 | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | import ApcOptimizer.Implementation.OptimizerPasses.FlagFold
set_option autoImplicit false
/-! # Box-certified multilinear rewriting
The missing piece of log entry 64: after substituting a degree-2 flag interpolation, the
stateful address payloads and the data-selection constraints hold expressions that exceed the
de... | @@ -273,6 +273,16 @@
(brRw singles bs.degreeBound.identities),
busInteractions := cs.busInteractions.map (brBi singles bs.degreeBound) }
+theorem brBi_eval [Fact p.Prime] (singles : List (Expression p)) (db : DegreeBound)
+ (bi : BusInteraction (Expression p)) (env : Variable → ZMod p)
+ (hdom : ∀ c... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_c82131f93eca_0 | 9ae7178915cceaa7 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DigitFold.lean | DigitFold | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "solutions_complete",
"depth": 1,
"n_commands": 0,
"n_lines": 14,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n set S := g * ladderVal xs with hS\n have hSsplit : tval b + S / p * p = S := by\n rw [← hmod, Nat.mod_add_div' S p]... | [
{
"name": "unpack?_ladderVal",
"text": "/-- Decoding is a retraction of the positional value on bounded digit lists. -/\ntheorem unpack?_ladderVal : ∀ (xs Bs : List ℕ), List.Forall₂ (· < ·) xs Bs →\n (∀ B ∈ Bs, B ≤ 256) → unpack? Bs (ladderVal xs) = some xs := by\n intro xs Bs h\n induction h with\n |... | [
{
"name": "solutions_complete",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 23,
"n_chars": 1147,
"n_subproofs": 4,
"n_tactics": 16,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 4,
"n_structural": 5,
"automation_only": false,
"max_n... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | @@ -49,6 +49,23 @@
| B :: Bs, T =>
if T % 256 < B then (unpack? Bs (T / 256)).map (T % 256 :: ·) else none
+/-- Decoding is a retraction of the positional value on bounded digit lists. -/
+theorem unpack?_ladderVal : ∀ (xs Bs : List ℕ), List.Forall₂ (· < ·) xs Bs →
+ (∀ B ∈ Bs, B ≤ 256) → unpack? Bs (ladde... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_c82131f93eca_1 | 7846eca3e89e263d | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DigitFold.lean | DigitFold | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "env_forced",
"depth": 1,
"n_commands": 0,
"n_lines": 31,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have hp0 : 0 < p := by omega\n have hxB : List.Forall₂ (· < ·) (l.map (fun t => (env t.1).val)) Bs := by\n rw [List.forall₂... | [
{
"name": "ladderVal_le_box",
"text": "/-- Positional value is monotone into the bound box. -/\ntheorem ladderVal_le_box : ∀ (xs Bs : List ℕ), List.Forall₂ (· < ·) xs Bs →\n ladderVal xs ≤ ladderVal (Bs.map (· - 1)) := by\n intro xs Bs h\n induction h with\n | nil => exact le_refl _\n | @cons x B xs ... | [
{
"name": "env_forced",
"fan_in": 1,
"n_deps_direct": 5,
"n_deps_transitive": 7,
"n_lines": 46,
"n_chars": 2056,
"n_subproofs": 7,
"n_tactics": 31,
"cyclomatic": 2,
"n_automation": 4,
"n_rewrites": 8,
"n_structural": 3,
"automation_only": false,
"max_nesting":... | 5 | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | @@ -66,6 +66,19 @@
ih (fun B hBmem => hB B (by simp [hBmem]))]
rfl
+/-- Positional value is monotone into the bound box. -/
+theorem ladderVal_le_box : ∀ (xs Bs : List ℕ), List.Forall₂ (· < ·) xs Bs →
+ ladderVal xs ≤ ladderVal (Bs.map (· - 1)) := by
+ intro xs Bs h
+ induction h with
+ | nil => exa... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_c82131f93eca_2 | 87cb3ea8781dfc5e | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/DigitFold.lean | DigitFold | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "solutions_forced",
"depth": 1,
"n_commands": 0,
"n_lines": 4,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n have := solutions_complete p tval g Bs maxM hp hg xs hxB hB b hb hmod hle\n rw [hsol, List.mem_singleton] at this\n exac... | [
{
"name": "solutions_complete",
"text": "/-- Completeness of the grid: the digit vector of any assignment whose ladder sum `g·ladderVal xs`\n has residue `tval b` (for its byte value `b < 256`) and fits under `maxM` is enumerated. -/\ntheorem solutions_complete (p : ℕ) (tval : ℕ → ℕ) (g : ℕ) (Bs : List ℕ... | [
{
"name": "solveOperand_sound",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 11,
"n_lines": 24,
"n_chars": 886,
"n_subproofs": 1,
"n_tactics": 14,
"cyclomatic": 3,
"n_automation": 2,
"n_rewrites": 3,
"n_structural": 3,
"automation_only": false,
"max_n... | 9 | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | import ApcOptimizer.Implementation.OptimizerPasses.FactPass
import ApcOptimizer.Implementation.OptimizerPasses.Subst
import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.MemoryUnify
set_option autoImplicit false
/-! # Bounded-payload digit fold (constant limb de... | @@ -89,6 +89,28 @@
let M := tval b + m * p
if M % g = 0 ∧ M ≤ maxM then unpack? Bs (M / g) else none
+/-- Completeness of the grid: the digit vector of any assignment whose ladder sum `g·ladderVal xs`
+ has residue `tval b` (for its byte value `b < 256`) and fits under `maxM` is enumerated. -/
+theor... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_319a7a630b0d_0 | efe9f52b02744b32 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusPairCancel.lean | BusPairCancel | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 26 | 1 | [
{
"theorem_name": "deepBoundOk_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 41,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold deepBoundOk at h\n simp only [] at h\n split_ifs at h with hcap\n -- every enumerated variable's value lies in... | [
{
"name": "pointByteOk_sound",
"text": "theorem pointByteOk_sound [Fact p.Prime] (x : Variable) (c : Expression p)\n (byteVars : List Variable)\n (keys : List Variable) (pt : List (Variable × ZMod p))\n (h : pointByteOk x c byteVars keys pt = true) (env : Variable → ZMod p)\n (hpt : ∀ y, keys.co... | [
{
"name": "deepBoundOk_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 50,
"n_chars": 2213,
"n_subproofs": 6,
"n_tactics": 40,
"cyclomatic": 3,
"n_automation": 4,
"n_rewrites": 8,
"n_structural": 12,
"automation_only": false,
"max_n... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | @@ -159,6 +159,105 @@
((all.filter (Expression.containsVar x)).take maxDeepConstraints).any
(fun c => deepBoundOk domCs bs facts rest x c)
+theorem pointByteOk_sound [Fact p.Prime] (x : Variable) (c : Expression p)
+ (byteVars : List Variable)
+ (keys : List Variable) (pt : List (Variable × ZMod p))
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_319a7a630b0d_1 | 71a032cf265e47e0 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusPairCancel.lean | BusPairCancel | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 26 | 1 | [
{
"theorem_name": "sideEffects_dropPair_equiv",
"depth": 1,
"n_commands": 0,
"n_lines": 12,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n intro msg\n have hstructFull : A ++ S :: B ++ R :: C = (A ++ S :: B) ++ (R :: C) := by\n simp only [List.ap... | [
{
"name": "multiplicitySum_append",
"text": "/-- Net multiplicity is additive over concatenation of bus states. -/\ntheorem multiplicitySum_append (msg : BusMessage p) (s t : BusState p) :\n multiplicitySum msg (s ++ t) = multiplicitySum msg s + multiplicitySum msg t := by\n induction s with\n | nil =>... | [
{
"name": "sideEffects_dropPair_equiv",
"fan_in": 1,
"n_deps_direct": 3,
"n_deps_transitive": 3,
"n_lines": 24,
"n_chars": 1445,
"n_subproofs": 3,
"n_tactics": 13,
"cyclomatic": 2,
"n_automation": 4,
"n_rewrites": 3,
"n_structural": 1,
"automation_only": false,
... | 3 | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | @@ -488,6 +488,15 @@
/-! ## Net-multiplicity bookkeeping -/
+/-- Net multiplicity is additive over concatenation of bus states. -/
+theorem multiplicitySum_append (msg : BusMessage p) (s t : BusState p) :
+ multiplicitySum msg (s ++ t) = multiplicitySum msg s + multiplicitySum msg t := by
+ induction s with
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_319a7a630b0d_2 | 104a2d38d1658616 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusPairCancel.lean | BusPairCancel | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 26 | 1 | [
{
"theorem_name": "payloadEntailedEq_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 14,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " h\n have hev : e.eval env = e'.eval env := by\n rcases hslot with (hs | hs) | hs\n · rw [of_decide_eq_true ... | [
{
"name": "test_sound",
"text": "/-- A passing `test d` means `d` evaluates to zero whenever the constraints hold. -/\ntheorem test_sound (M : EqConstraintMap p constraints) (d : Expression p)\n (h : M.test d = true) (env : Variable → ZMod p)\n (hcon : ∀ c ∈ constraints, c.eval env = 0) : d.eval env =... | [
{
"name": "payloadEntailedEq_sound",
"fan_in": 1,
"n_deps_direct": 2,
"n_deps_transitive": 2,
"n_lines": 25,
"n_chars": 1244,
"n_subproofs": 3,
"n_tactics": 14,
"cyclomatic": 2,
"n_automation": 3,
"n_rewrites": 3,
"n_structural": 3,
"automation_only": false,
"... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | @@ -933,6 +933,21 @@
| some ns => ns.any (fun n => decide (n = d))
| none => false
+/-- A passing `test d` means `d` evaluates to zero whenever the constraints hold. -/
+theorem test_sound (M : EqConstraintMap p constraints) (d : Expression p)
+ (h : M.test d = true) (env : Variable → ZMod p)
+ (hcon : ∀ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_319a7a630b0d_3 | a8a37891bb9522aa | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusPairCancel.lean | BusPairCancel | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 26 | 2 | [
{
"theorem_name": "preRefuted_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 12,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n unfold preRefuted at h\n rw [Bool.or_eq_true] at h\n rcases h with h | h\n · exact (midRefuted_sound shape T busId S m... | [
{
"name": "midRefuted_sound",
"text": "theorem midRefuted_sound (shape : MemoryBusShape) {constraints : List (Expression p)}\n (T : Thunk (TwoRootMap p constraints)) (busId : Nat) (S m : BusInteraction (Expression p))\n (h : midRefuted shape T busId S m = true) (env : Variable → ZMod p)\n (hcon : ∀... | [
{
"name": "preRefuted_sound",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 20,
"n_chars": 923,
"n_subproofs": 1,
"n_tactics": 13,
"cyclomatic": 3,
"n_automation": 1,
"n_rewrites": 5,
"n_structural": 5,
"automation_only": false,
"max_nest... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | @@ -1025,6 +1025,20 @@
midRefuted shape T busId S m ||
(match multConst m with | some c => decide (c ≠ 1) | none => false)
+theorem midRefuted_sound (shape : MemoryBusShape) {constraints : List (Expression p)}
+ (T : Thunk (TwoRootMap p constraints)) (busId : Nat) (S m : BusInteraction (Expression p))
+ ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_319a7a630b0d_5 | 934dd1775f30365c | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/BusPairCancel.lean | BusPairCancel | 5 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 26 | 1 | [
{
"theorem_name": "deepByteJustified_sound",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n obtain ⟨c, hc, hck⟩ := List.any_eq_true.1 h\n have hc' : c ∈ all := List.mem_of_mem_filter (List.mem_of_mem_take h... | [
{
"name": "deepBoundOk_sound",
"text": "theorem deepBoundOk_sound [Fact p.Prime] (domCs : List (Expression p))\n (bs : BusSemantics p) (facts : BusFacts p bs)\n (rest : List (BusInteraction (Expression p))) (x : Variable) (c : Expression p)\n (h : deepBoundOk domCs bs facts rest x c = true) (env : ... | [
{
"name": "checkCancel_sound",
"fan_in": 0,
"n_deps_direct": 8,
"n_deps_transitive": 26,
"n_lines": 42,
"n_chars": 2575,
"n_subproofs": 4,
"n_tactics": 25,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 2,
"n_structural": 8,
"automation_only": false,
"max_n... | 26 | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | import ApcOptimizer.Implementation.OptimizerPasses.BusUnify
import ApcOptimizer.Implementation.OptimizerPasses.DomainProp
import ApcOptimizer.Implementation.OptimizerPasses.SubstMap
import ApcOptimizer.Implementation.MemoryBusDrop
set_option autoImplicit false
/-! # Cancelling matched send/receive pairs on a memory b... | @@ -258,6 +258,55 @@
| cons t3 tail3 =>
rw [hterms] at h; simp at h
+theorem deepBoundOk_sound [Fact p.Prime] (domCs : List (Expression p))
+ (bs : BusSemantics p) (facts : BusFacts p bs)
+ (rest : List (BusInteraction (Expression p))) (x : Variable) (c : Expression p)
+ (h : deep... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d1a69a27c851_0 | de42c43b989aa160 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Basic.lean | Basic | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 2 | [
{
"theorem_name": "ConstraintSystem.implies_refl",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n fun env hsat => ⟨env, hsat, BusState.equiv_refl _⟩",
"n_chars": 57,
"n_subproofs": 0,
"n_tactics": 1... | [
{
"name": "BusState.equiv_refl",
"text": "/-- `≈` on `BusState` is reflexive: every message trivially has the same net multiplicity in a\n state as in itself. -/\ntheorem BusState.equiv_refl (s : BusState p) : s ≈ s :=\n fun _ => rfl\n\n",
"fan_in": 2,
"n_lines": 6,
"n_chars": 198,
"n_su... | [
{
"name": "ConstraintSystem.implies_refl",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 7,
"n_chars": 322,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": false,
... | 1 | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | @@ -28,6 +28,11 @@
/-! ## Equivalence is an equivalence relation -/
+/-- `≈` on `BusState` is reflexive: every message trivially has the same net multiplicity in a
+ state as in itself. -/
+theorem BusState.equiv_refl (s : BusState p) : s ≈ s :=
+ fun _ => rfl
+
/-- `≈` on `BusState` is transitive. -/
theore... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d1a69a27c851_1 | 1ef1028d34d6bbe1 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Basic.lean | Basic | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 2 | [
{
"theorem_name": "ConstraintSystem.implies_trans",
"depth": 1,
"n_commands": 0,
"n_lines": 5,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n fun env hsat =>\n let ⟨env', hb, hab⟩ := h1 env hsat\n let ⟨env'', hc, hbc⟩ := h2 env' hb\n ⟨env'', hc... | [
{
"name": "BusState.equiv_trans",
"text": "/-- `≈` on `BusState` is transitive. -/\ntheorem BusState.equiv_trans {s t u : BusState p} (h1 : s ≈ t) (h2 : t ≈ u) : s ≈ u :=\n fun message => (h1 message).trans (h2 message)\n\n",
"fan_in": 2,
"n_lines": 5,
"n_chars": 185,
"n_subproofs": 0,
... | [
{
"name": "ConstraintSystem.implies_trans",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 26,
"n_chars": 1499,
"n_subproofs": 0,
"n_tactics": 4,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": false,... | 1 | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | @@ -33,6 +33,10 @@
theorem BusState.equiv_refl (s : BusState p) : s ≈ s :=
fun _ => rfl
+/-- `≈` on `BusState` is transitive. -/
+theorem BusState.equiv_trans {s t u : BusState p} (h1 : s ≈ t) (h2 : t ≈ u) : s ≈ u :=
+ fun message => (h1 message).trans (h2 message)
+
/-- Soundness half of a replacement (glue, f... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d1a69a27c851_2 | 977f720f7b3969b9 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Basic.lean | Basic | 2 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 3 | [
{
"theorem_name": "ConstraintSystem.mem_vars_of_constraint",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n ConstraintSystem.mem_vars.2 (Or.inl ⟨c, hc, hx⟩)",
"n_chars": 55,
"n_subproofs": 0,
"n_tac... | [
{
"name": "ConstraintSystem.mem_vars",
"text": "/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some\n payload expression. -/\ntheorem ConstraintSystem.mem_vars {cs : ConstraintSystem p} {x : Variable} :\n x ∈ cs.vars ↔\n (∃ c ∈ cs.algebraicConstraints, x ... | [
{
"name": "ConstraintSystem.mem_vars_of_constraint",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 5,
"n_chars": 244,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only":... | 1 | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | @@ -170,8 +170,17 @@
Helpers for discharging the `out.vars ⊆ cs.vars` obligation of `PassCorrect.ofEnvEq`: a variable of
a sub-expression is a variable of the whole system, and vice versa. -/
+/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some
+ payload expression. -/
+... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d1a69a27c851_3 | 72c931f1735bd680 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Basic.lean | Basic | 3 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 3 | [
{
"theorem_name": "ConstraintSystem.mem_vars_of_constraint",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n ConstraintSystem.mem_vars.2 (Or.inl ⟨c, hc, hx⟩)",
"n_chars": 55,
"n_subproofs": 0,
"n_tac... | [
{
"name": "ConstraintSystem.mem_vars",
"text": "/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some\n payload expression. -/\ntheorem ConstraintSystem.mem_vars {cs : ConstraintSystem p} {x : Variable} :\n x ∈ cs.vars ↔\n (∃ c ∈ cs.algebraicConstraints, x ... | [
{
"name": "ConstraintSystem.mem_vars_of_mult",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 6,
"n_chars": 280,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": false... | 1 | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | @@ -170,9 +170,18 @@
Helpers for discharging the `out.vars ⊆ cs.vars` obligation of `PassCorrect.ofEnvEq`: a variable of
a sub-expression is a variable of the whole system, and vice versa. -/
+/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some
+ payload expression. -/
+... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_d1a69a27c851_4 | 645adeb6738f5361 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Basic.lean | Basic | 4 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 5 | 3 | [
{
"theorem_name": "ConstraintSystem.mem_vars_of_constraint",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": "\n ConstraintSystem.mem_vars.2 (Or.inl ⟨c, hc, hx⟩)",
"n_chars": 55,
"n_subproofs": 0,
"n_tac... | [
{
"name": "ConstraintSystem.mem_vars",
"text": "/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some\n payload expression. -/\ntheorem ConstraintSystem.mem_vars {cs : ConstraintSystem p} {x : Variable} :\n x ∈ cs.vars ↔\n (∃ c ∈ cs.algebraicConstraints, x ... | [
{
"name": "ConstraintSystem.mem_vars_of_payload",
"fan_in": 0,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 12,
"n_chars": 616,
"n_subproofs": 0,
"n_tactics": 1,
"cyclomatic": 1,
"n_automation": 0,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": f... | 1 | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | import ApcOptimizer.Spec
import ApcOptimizer.Implementation.Variable
set_option autoImplicit false
variable {p : ℕ}
/-! # Optimizer scaffolding
The reusable framework for building the circuit optimizer out of small, individually-proven
optimization *passes*. Nothing here is specific to a particular optimization; co... | @@ -170,9 +170,18 @@
Helpers for discharging the `out.vars ⊆ cs.vars` obligation of `PassCorrect.ofEnvEq`: a variable of
a sub-expression is a variable of the whole system, and vice versa. -/
+/-- Membership in `cs.vars`: a variable occurs in some constraint, some multiplicity, or some
+ payload expression. -/
+... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_08b6cca5facb_0 | 7a6b9494e9ba8ea8 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Normalize.lean | Normalize | 0 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "foldl_addCoeff_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 6,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n induction ts generalizing acc with\n | nil => simp\n | cons t rest ih =>\n simp only [List.foldl_cons, List.map_... | [
{
"name": "addCoeff_eval",
"text": "theorem addCoeff_eval (v : Variable) (c : ZMod p) (ts : List (Variable × ZMod p))\n (env : Variable → ZMod p) :\n ((addCoeff v c ts).map (fun t => t.2 * env t.1)).sum\n = c * env v + (ts.map (fun t => t.2 * env t.1)).sum := by\n induction ts with\n | nil => sim... | [
{
"name": "foldl_addCoeff_eval",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 1,
"n_lines": 10,
"n_chars": 446,
"n_subproofs": 0,
"n_tactics": 6,
"cyclomatic": 2,
"n_automation": 3,
"n_rewrites": 0,
"n_structural": 1,
"automation_only": false,
"max_ne... | 1 | import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Affine normalization (collect like terms)
An eval-preserving rewrite that replaces every maximal *affine* subexpression by its **merged**
normal form: `linearize`, ... | import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Affine normalization (collect like terms)
An eval-preserving rewrite that replaces every maximal *affine* subexpression by its **merged**
normal form: `linearize`, ... | @@ -25,6 +25,18 @@
| [] => [(v, c)]
| (v', c') :: rest => if v' = v then (v', c' + c) :: rest else (v', c') :: addCoeff v c rest
+theorem addCoeff_eval (v : Variable) (c : ZMod p) (ts : List (Variable × ZMod p))
+ (env : Variable → ZMod p) :
+ ((addCoeff v c ts).map (fun t => t.2 * env t.1)).sum
+ = c ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
ablate_08b6cca5facb_1 | 08e54f9d0a0f21f4 | lean | lean | github.com/powdr-labs/apc-optimizer | bd367dd92ecaabcdc3a308473fbe966da9a1c03c | ApcOptimizer/Implementation/OptimizerPasses/Normalize.lean | Normalize | 1 | lemma_delete | null | null | false | 0.5 | 1 | 1 | false | 0 | inf | 0 | inf | 42 | 9 | 1 | [
{
"theorem_name": "mergeTerms_eval",
"depth": 1,
"n_commands": 0,
"n_lines": 2,
"is_leaf": true,
"centrality": 0,
"method": "deleted-dep",
"proof_text": " by\n simp [mergeTerms, foldl_addCoeff_eval]",
"n_chars": 44,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
... | [
{
"name": "foldl_addCoeff_eval",
"text": "theorem foldl_addCoeff_eval (env : Variable → ZMod p) (ts acc : List (Variable × ZMod p)) :\n ((ts.foldl (fun acc t => addCoeff t.1 t.2 acc) acc).map (fun t => t.2 * env t.1)).sum\n = (acc.map (fun t => t.2 * env t.1)).sum + (ts.map (fun t => t.2 * env t.1)).s... | [
{
"name": "mergeTerms_eval",
"fan_in": 1,
"n_deps_direct": 1,
"n_deps_transitive": 2,
"n_lines": 6,
"n_chars": 234,
"n_subproofs": 0,
"n_tactics": 2,
"cyclomatic": 1,
"n_automation": 1,
"n_rewrites": 0,
"n_structural": 0,
"automation_only": true,
"max_nesting"... | 2 | import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Affine normalization (collect like terms)
An eval-preserving rewrite that replaces every maximal *affine* subexpression by its **merged**
normal form: `linearize`, ... | import ApcOptimizer.Implementation.OptimizerPasses.Affine
import ApcOptimizer.Implementation.OptimizerPasses.Rewrite
set_option autoImplicit false
/-! # Affine normalization (collect like terms)
An eval-preserving rewrite that replaces every maximal *affine* subexpression by its **merged**
normal form: `linearize`, ... | @@ -44,9 +44,19 @@
def mergeTerms (ts : List (Variable × ZMod p)) : List (Variable × ZMod p) :=
ts.foldl (fun acc t => addCoeff t.1 t.2 acc) []
+theorem foldl_addCoeff_eval (env : Variable → ZMod p) (ts acc : List (Variable × ZMod p)) :
+ ((ts.foldl (fun acc t => addCoeff t.1 t.2 acc) acc).map (fun t => t.2 * ... | {
"repo": "apc-optimizer",
"git_repo": "github.com/powdr-labs/apc-optimizer",
"revision": "bd367dd92ecaabcdc3a308473fbe966da9a1c03c",
"lean_toolchain": "leanprover/lean4:v4.30.0-rc1",
"proof_assistant": "lean",
"ablator": "ablators/lean (corollary-delete-lemmas-leaves-all)",
"ablator_flags": [
"--coro... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.