Skip to content

Instantly share code, notes, and snippets.

@codelion
Created June 14, 2017 07:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codelion/eb19f96fe657e288d491b7995d875f12 to your computer and use it in GitHub Desktop.
Save codelion/eb19f96fe657e288d491b7995d875f12 to your computer and use it in GitHub Desktop.
Verifying shape property for modified version
struct node{
int val;
struct node* next;
};
/*@
list<> == self=null or self::node<_,q> * q::list<>;
*/
int length(struct node* p)
/*@
requires p::list<>
ensures p::list<>;
*/
{
if (p!=NULL) return 1 + length(p->next);
else return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment