From f0579600d5a160269eb0f6a98d2035c51fb18270 Mon Sep 17 00:00:00 2001 From: Artem Gureev Date: Fri, 3 Nov 2023 18:34:50 +0600 Subject: [PATCH] Fix to-circuit Variable Printing 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 --- src/seqn/trans.lisp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/seqn/trans.lisp b/src/seqn/trans.lisp index 2663dc69b..0d9467f68 100644 --- a/src/seqn/trans.lisp +++ b/src/seqn/trans.lisp @@ -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