Skip to content

Commit

Permalink
Fix to-circuit Variable Printing
Browse files Browse the repository at this point in the history
Previously a Lambda function taking natural number arguments `A1` to
`An` would be compiled to a circuit with arguments `x1` to `x(n+1)`
where argument `xi` in the circuit for i<(n+1) stands for argument
`A(n-i)` and `x(n+1)` stands as an unused variable.

Current channge omits the final variable and renames the rest, so
that the compiled circuit will have appropriate argument order and
type corresponding to the relevant STLC term.

Note that this changes how to input coproduct type circuit variables.

A
  • Loading branch information
agureev committed Nov 3, 2023
1 parent 4eb67b8 commit f057960
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/seqn/trans.lisp
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,14 @@ Note that what is happening is that we look at the domain of the morphism
and skip 0es, making non-zero entries into wires"
(let* ((wire-count (length (dom morphism)))
(wires (loop for i from 1 to wire-count
collect (vamp:make-wire :var (intern (format nil "X~a" i)
:keyword)))))
collect (vamp:make-wire
:var (intern
(format nil "X~a" (- wire-count i))
:keyword)))))
(list
(vamp:make-alias
:name name
:inputs wires
:inputs (cdr (reverse wires))
:body
(list
(vamp:make-tuples
Expand Down

0 comments on commit f057960

Please sign in to comment.