Skip to content

Instantly share code, notes, and snippets.

@bond15
Last active January 26, 2022 23:43
Show Gist options
  • Save bond15/422c5eb62326e6e4ccf1a9aca9a577ad to your computer and use it in GitHub Desktop.
Save bond15/422c5eb62326e6e4ccf1a9aca9a577ad to your computer and use it in GitHub Desktop.
PolyWiringDiagrams
{-# OPTIONS --guardedness #-}
module tutorial where
open import Poly
open import Data.Product
open import Dynamics
open Systems
postulate A B C D S T : Set
box₁ : Poly
box₁ = B ▹ λ _ → A × C
box₂ : Poly
box₂ = (C × D) ▹ λ _ → B
box₃ : Poly
box₃ = D ▹ (λ _ → A)
composeBoxes : Poly[ box₁ ⊗ₚ box₂ , box₃ ]
composeBoxes =
(λ{ (b , c , d) → d}) -- map outputs to outputs
⇒ₚ
λ{(b , c , _) a → (a , c) , b} -- map inputs to inputs
postulate impl₁ : Sys S box₁
postulate impl₂ : Sys T box₂
impl₃ : Sys (S × T) (box₃)
impl₃ = (impl₁ ⊗ₛ impl₂) ∘ₛ composeBoxes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment