Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Geb generates incorrect function for the identity lambda-abstraction #93

@lukaszcz

Description

@lukaszcz

I compile the following

(defpackage #:gg
  (:shadowing-import-from :geb.lambda.spec #:func #:pair)
  (:shadowing-import-from :geb.spec #:case)
  (:use #:common-lisp #:geb.lambda.spec #:geb))

(in-package :gg)

(defparameter *entry*
  (typed
    (lamb
      (coprod
        so1
        so1)
      (coprod
        so1
        so1)
      (index 0))
    (!->
      (coprod
        so1
        so1)
      (coprod
        so1
        so1))))

with

geb.image -i gg.lisp -e "gg::*entry*" -l -v -o gg.pir

The output is:

(...)
def entry x = {
  2 * (((1 * ((mod32 (2 * ((pwless32 (1 * (x + 0)) 1 ((1 * (x + 0)) / 1) (((1 * (x + 0)) - 1) / 1)) + (pwless32 (1 * (x + 0)) 1 (mod32 (1 * (x + 0)) 1) (1 + (mod32 ((1 * (x + 0)) - 1) 1))))) 2) + ((2 * ((pwless32 (1 * (x + 0)) 1 ((1 * (x + 0)) / 1) (((1 * (x + 0)) - 1) / 1)) + (pwless32 (1 * (x + 0)) 1 (mod32 (1 * (x + 0)) 1) (1 + (mod32 ((1 * (x + 0)) - 1) 1))))) / 1))) / 2) + ((1 * ((mod32 (2 * ((pwless32 (1 + (1 * (x + 0))) 1 ((1 + (1 * (x + 0))) / 1) (((1 + (1 * (x + 0))) - 1) / 1)) + (pwless32 (1 + (1 * (x + 0))) 1 (mod32 (1 + (1 * (x + 0))) 1) (1 + (mod32 ((1 + (1 * (x + 0))) - 1) 1))))) 2) + ((2 * ((pwless32 (1 + (1 * (x + 0))) 1 ((1 + (1 * (x + 0))) / 1) (((1 + (1 * (x + 0))) - 1) / 1)) + (pwless32 (1 + (1 * (x + 0))) 1 (mod32 (1 + (1 * (x + 0))) 1) (1 + (mod32 ((1 + (1 * (x + 0))) - 1) 1))))) / 1))) / 2))
};

At the end I add a constraint to test this:

entry x = x;

I run:

% vamp-ir plonk setup -m 14 -o params.pp
% vamp-ir plonk compile -u params.pp -s gg.pir -o circuit.plonk
% vamp-ir plonk prove -u params.pp -c circuit.plonk -o proof.plonk
> [input 0 for x here]
% vamp-ir plonk verify -u params.pp -c circuit.plonk -p proof.plonk

I get:

* Result from verifier: Err(ProofVerificationError)

By the way, the encoding of the identity function needs 2^14 parameters which seems a bit too much.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions