Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cleanup FSM code to contain real abstractions instead of directly applying low-level functions. #667

Closed
wants to merge 32 commits into from
Closed
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
2d298f6
chore: delete dead code
bollu Sep 29, 2024
6dd5e8a
chore: try to add more abstractions
bollu Sep 29, 2024
f966632
chore: prove eval eq eval'
bollu Sep 29, 2024
2b5ff4e
chore: get main thm through
bollu Sep 29, 2024
24b76a6
WIP: FSM abstractions
alexkeizer Sep 30, 2024
888925b
appendVector'
alexkeizer Sep 30, 2024
2311e78
tmp
luisacicolini Oct 1, 2024
283e21a
WIP: CircuitProd helpers
alexkeizer Oct 3, 2024
5c7c9bd
Merge branch 'fsm-abstractions' of github.com:opencompl/lean-mlir int…
alexkeizer Oct 3, 2024
01f9647
fix: red squigly
alexkeizer Oct 3, 2024
a31f8db
WIP: introduce more `BitVec` abstractions
alexkeizer Oct 3, 2024
8245bea
refactor: move refactored defs to a `New` suffixed copy of FiniteStat…
alexkeizer Oct 3, 2024
78c3b3d
final final attempt
alexkeizer Oct 3, 2024
62e8341
nuke bitvectors
alexkeizer Oct 3, 2024
7c44731
cleaned bitwise op section a bit
luisacicolini Oct 4, 2024
6f4d5c3
name fixes
luisacicolini Oct 5, 2024
4846151
pairing with sid: bitwiseAnd, its eval and support stuff
luisacicolini Oct 6, 2024
adad959
chore: bring back eval and eval'.
bollu Oct 7, 2024
718c323
chore: prove bitwiseAnd
bollu Oct 7, 2024
9fa03c7
chore: make eval_bitwiseAnd not depend on sorry anymore
bollu Oct 7, 2024
40d4863
feat: faff about with subsingleton, hoping for a cleanup, but none wa…
bollu Oct 7, 2024
b65b8ef
bitwise operators
luisacicolini Oct 7, 2024
63931a9
chore: document chris proof
bollu Oct 8, 2024
27a5816
bitwise fsm cleaned
luisacicolini Oct 8, 2024
6943aa5
bitwise fsm cleaned
luisacicolini Oct 8, 2024
43e64bc
either enlightnening or nonsense
luisacicolini Oct 8, 2024
f6c1f38
i am giving up on this predicate
luisacicolini Oct 10, 2024
7516663
peiring with sid, binary predicates
luisacicolini Oct 10, 2024
ca532c6
satisfactory theorem decl but too fried to prove it now
luisacicolini Oct 10, 2024
819fae1
progress with eval_and
luisacicolini Oct 11, 2024
18cc7ab
it was easier than i tought
luisacicolini Oct 13, 2024
0310101
lost again
luisacicolini Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions SSA/Experimental/Bits/Fast/BitStream.lean
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,13 @@ abbrev map₂ (f : Bool → Bool → Bool) : BitStream → BitStream → BitStre
def corec {β} (f : β → β × Bool) (b : β) : BitStream :=
fun i => f ((Prod.fst ∘ f)^[i] b) |>.snd


theorem corec_succ {β} (f : β → β × Bool) (b : β) (i : Nat) :
corec f b (i + 1) = (corec f (f b).1) i := by
induction' i with i ih
· simp [corec]
· simp [corec, ih]

/-- `mapAccum₂` ("binary map accumulate") maps a binary function `f` over two streams,
while accumulating some state -/
def mapAccum₂ {α} (f : α → Bool → Bool → α × Bool) (init : α) (x y : BitStream) : BitStream :=
Expand All @@ -102,8 +109,8 @@ theorem ext {x y : BitStream} (h : ∀ i, x i = y i) : x = y := by
The field projection `.1` distributes over function composition, so we can compute
the first field of the result of the composition by repeatedly composing the first projection.
-/
theorem compose_first {α: Type u₁} (i : Nat) (a : α)
(f : α → α × Bool) :
theorem compose_first {α: Type u₁} (i : Nat) (a : α)
(f : α → α × Bool) :
(f ((Prod.fst ∘ f)^[i] a)).1 = (Prod.fst ∘ f)^[i] (f a).1 :=
match i with
| 0 => by simp
Expand Down Expand Up @@ -354,11 +361,6 @@ thus could have a bit set in the `w+1`th position.
Crucially, our decision procedure works by considering which equalities hold for *all* widths,

-/
-- theorem ofBitVec_add {w} (x y z : ∀ w, BitVec w) :
-- (∀ w, (x w + y w) = z w) ↔ (∀ w, (ofBitVec (x w)) + (ofBitVec (y w)) ) := by
-- have ⟨h₁, h₂⟩ : True ∧ True := sorry
-- sorry

variable {w : Nat} {x y : BitVec w} {a b a' b' : BitStream}

local infix:20 " ≈ʷ " => EqualUpTo w
Expand Down
Loading
Loading