Skip to content

Commit

Permalink
Add fixed size join component
Browse files Browse the repository at this point in the history
  • Loading branch information
ymherklotz committed Nov 13, 2024
1 parent 17935e5 commit 21bc481
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions DataflowRewriter/Component.lean
Original file line number Diff line number Diff line change
Expand Up @@ -269,6 +269,23 @@ Essentially tagger + join without internal rule
internals := []
}

namespace FixedSize

def BoundedList T n := { ls : List T // ls.length <= n }

@[drunfold] def join T T' n : NatModule (BoundedList T n × BoundedList T' n) :=
{ inputs := [ (0, ⟨ T, λ (oldListL, oldListR) newElement (newListL, newListR) =>
newListL.val = newElement :: oldListL.val ∧ newListR = oldListR ⟩)
, (1, ⟨ T', λ (oldListL, oldListR) newElement (newListL, newListR) =>
newListR.val = newElement :: oldListR.val ∧ newListL = oldListL⟩)].toAssocList,
outputs := [(0, ⟨ T × T', λ (oldListL, oldListR) (oldElementL, oldElementR) (newListL, newListR) =>
oldListL.val = newListL.val.concat oldElementL
∧ oldListR.val = newListR.val.concat oldElementR ⟩)].toAssocList,
internals := []
}

end FixedSize

end DataflowRewriter.NatModule

namespace DataflowRewriter.StringModule
Expand Down

0 comments on commit 21bc481

Please sign in to comment.