### coq

#### forward_call with local variables

VST version 1.7. I'm having an issue where coq won't recognize locally declared variables when I try to use them in a function call. I have the code: void deSignArray(int bits[], int invKey, int size) { int i = 0; while (i < size) { int bit = bits[i]; int ans = deSignInt(bit, invKey); bits[i] = ans; i++; } } with coq types bits : list Z, invKey : Z, size : Z. I successfully stepped through the bit = bits[i] step, but when I then try to step forwards using forward_call((Int.repr bit), (Int.repr invKey)). the step fails with bit not being found in the environment. I tried using forward_call(_bit, (Int.repr invKey)). as _bit appears in the LOCAL clause, but that provides a typing mismatch since _bit is an ident type and not an int or Z type. I'm wondering how I am supposed to use my locally defined values to call other functions as a result, any help would be appreciated.

The argument that you provide to forward_call, in your case (Int.repr bit, Int.repr invKey), must be a Coq value. In your case, if (at the time of forward_call) you have above the line in your Coq proof goal, variables "bit" and "invKey", then this should work. How would you get such variables above the line? If the LOCALS part of your function precondition contains (temp _invKey (Vint (Int.repr invkey))), then you should have invKey above the line. And then, after going forward through the load statement (bit = bits[i]), your current proof goal's precondition should have a LOCALS of the form (temp _bit something-or-other), and it's that something-or-other that you should use instead of "bit".

### Related Links

Construct Sets in Coq

Is this relationship between forall and exists provable in Coq/intuitionistic logic?

Proof automation in Coq how to factorize a proof

How to use matched case and variable equivalence in coq

Proof with false hypothesis in Isabelle/HOL Isar

Is there a convention for the order of applying ssreflect tactic/taticals?

How to systematically normalize inequalities to < (lt) and <= (le) in Coq?

Inductive subset of an inductive set in Coq

How to find the source file for an identifier in Coq

Coq “Unknown interpretation for notation” error

How to switch the current goal in Coq?

Reasoning about lists in Coq

what does the curly braces {} do in ssreflect rewrite

How to define unspecified constants in Coq

How to automatically prove simple equality of real numbers in Coq?

How to simplify real number terms in Coq?