LAProof.C.verif_densemat: VST proofs of functions on dense matrices.

Corresponds to C program densemat.c

Prologue.

For explanation see the prologue of LAProof.C.spec_densemat
From VST.floyd Require Import proofauto VSU.
From LAProof.C Require Import densemat spec_alloc spec_densemat floatlib matrix_model.
From vcfloat Require Import FPStdCompCert FPStdLib.
Require Import VSTlib.spec_math VSTlib.spec_malloc.
Require Import Coq.Classes.RelationClasses.

From mathcomp Require ssreflect ssrbool ssrfun eqtype ssrnat seq choice.
From mathcomp Require fintype finfun bigop finset fingroup perm order.
From mathcomp Require div ssralg countalg finalg zmodp matrix.
From mathcomp.zify Require Import ssrZ zify.
Import fintype matrix.

Require Import LAProof.C.densemat_lemmas.

Unset Implicit Arguments.

Open Scope logic.

densemat_malloc verification

densemat_free verification

Unpacking dependently typed WITH components

When a funspec has a dependently typed package such as WITH X: {mn & 'M[option (ftype the_type)]_(fst mn, snd mn)}, the funspec may destruct it by a let-definition immediately after PRE or POST, such as let '(existT _ (m,n) M) := X in. Standard VST 2.15's start_function tactic cannot process such funspects. Here we add a new feature to start_function. See also: https://github.com/PrincetonUniversity/VST/issues/839

densemat_clear verification

This proof demonstrates a good way to prove a function call to a function whose funspec contains a dependently typed package. Before doing the forward_call, build the package using existT. There will be no use for X after the forward_call, so it can be cleared immediately.
Proof.
start_function.
rename X into M.
unfold densemat in POSTCONDITION|-*.
Intros.
forward.
forward.
pose (X := existT _ (m,n) M : {mn & 'M[option (ftype the_type)]_(fst mn, snd mn)}).
forward_call (X, offset_val densemat_data_offset p, sh); clear X.
entailer!.
Qed.

densemat_get verification

densemat_set verification

densemat_addto verification

data_norm and densemat_norm verification