aboutsummaryrefslogtreecommitdiff
path: root/Data/Circuit.agda
blob: 46c4e18e01eb8fe35613033f51b7cdb74b997397 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
{-# OPTIONS --without-K --safe #-}

open import Level using (Level)

module Data.Circuit {c  : Level} where

open import Data.Circuit.Gate using (Gates)

import Data.List as List
import Data.Hypergraph {c} {} Gates as Hypergraph

open import Data.Fin using (Fin)
open import Data.Nat using ()
open import Function using (Func; _⟶ₛ_)
open import Data.List.Relation.Binary.Permutation.Propositional.Properties using (map⁺)

open Func
open Hypergraph using (List∘Edgeₛ)
open Hypergraph
  using (_≈_ ; mk≈ ; module Edge)
  renaming
    ( Hypergraph to Circuit
    ; Hypergraphₛ to Circuitₛ
    ; mkHypergraph to mkCircuit
    ; mkHypergraphₛ to mkCircuitₛ
    )
  public
open List using ([])

map : {n m : }  (Fin n  Fin m)  Circuit n  Circuit m
map f (mkCircuit edges) = mkCircuit (List.map (Edge.map f) edges)

discrete : (n : )  Circuit n
discrete n = mkCircuit []

mapₛ : {n m : }  (Fin n  Fin m)  Circuitₛ n ⟶ₛ Circuitₛ m
mapₛ f .to = map f
mapₛ f .cong (mk≈ x≈y) = mk≈ (map⁺ (Edge.map f) x≈y)