### 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

Weakening hypothesis without a cut

Rewriting at the type level

Port a Coq lemma over Z to a similar lemma over nat

Coq fixpoint defintion numerated by natural numbers.(type of (n+1)'s type depends on (n)'s type)

`No more subgoals, but there are non-instantiated existential variables` in Coq proof language?

Simplify assumption

Apply partially instantiated lemma

Using reflexivity in Coq

High-speed calculation of Coq's theorems

Topological Definition of Continuous in Coq

Reference in Coq Lists library not found

Purpose of maximal vs non-maximal implicit arguments

Idris type system properties

How to destruct/generalize over Program's rewritten match statements

Show all axioms Coq

Product Type in Coq