Hi Mohit,
You can try modelling a mechanism similar to pointer
allocation/deallocation in high-level programming languages. The
intuitive idea is that for your "global variable" you create
persistent facts that have two parameters: (1) the memory address
(the "pointer address") of the variable and (2) the value of the
variable. Then, whenever you want to "update" your variable, you
actually free the old memory and allocate new memory. You just
have to make sure that your pointers cannot be accessed after
their memory has been freed and that memory cannot be freed more
than once (which you can do with restrictions).
The following example illustrates how this could be formalized in
Tamarin:
================================
restriction FreedMemoryCannotBeAccessed:
"All pointer #i #j. Read(pointer) @ i & Free(pointer) @ j
==> i < j"
restriction MemoryCanBeFreedOnlyOnce:
"All pointer #i #j. Free(pointer) @ i & Free(pointer) @ j
==> #i = #j"
rule rule_create:
[ Fr(~pointer), ... ]
--[]->
[ !GlobalVariable(~pointer, value) ]
rule rule_use:
[ !GlobalVariable(~pointer, value), ... ]
--[ Read(~pointer) ]->
[ ... ]
rule rule_update:
[ !GlobalVariable(~oldPointer, oldValue), Fr(~newPointer),
... ]
--[ Free(~oldPointer) ]->
[ !GlobalVariable(~newPointer, newValue) ]
================================
Note that the rule "rule_use" is not recursive, as the persistent
fact !GlobalVariable occurs only on the left-hand side. Also, in
the rule "rule_update", both ~oldPointer and ~newPointer are
fresh, meaning that they are not E-unifiable (and thus the rule is
not recursive in a strict sense).
Cheers,
Benjamin
--
You received this message because you are subscribed to the Google Groups "tamarin-prover" group.
To unsubscribe from this group and stop receiving emails from it, send an email to tamarin-prove...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/tamarin-prover/051790a7-9631-4bdd-b744-4b520efba781o%40googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to tamarin...@googlegroups.com.