(* The C programming language has a special namespace for struct
** and union identifiers, e.g., "struct foo {...}".  Some type-based operators
** in the program logic need access to an interpretation of this namespace,
** i.e., the meaning of each struct-identifier such as "foo".  The next
** line (which looks identical for any program) builds this
** interpretation, called "CompSpecs" *)
Instance CompSpecs : compspecs.Definition Vprog : varspecs.(** The reverse.c program uses the linked list structure [struct list].
 ** This satisfies the linked-list pattern, in that it has one self-reference
 ** field (in this case, called [tail]) and arbitrary other fields.  The [Instance]
 ** explains (and proves) how [struct list] satisfies the [listspec] pattern.
 **)
Instance LS: listspec _list _tail (fun _ _ => emp).(**  An auxiliary definition useful in the specification of [sumlist] *)
Definition sum_int := fold_right Int.add Int.zero.Definition t_struct_list := Tstruct _list noattr.

(* Specifications: *)
Lemma sum_int_app: forall a b, sum_int (a++b) = Int.add (sum_int a) (sum_int b).
Lemma body_sumlist: semax_body Vprog Gprog f_sumlist sumlist_spec.
Lemma body_reverse: semax_body Vprog Gprog f_reverse reverse_spec.
Lemma body_main: semax_body Vprog Gprog f_main main_spec.
Lemma prog_correct: semax_prog prog Vprog Gprog.