Definition max_inv mf := forall b ofs, Mem.valid_block mf b ->
permission_at mf b ofs Max = Some Freeable.

Lemma setN_inside: forall (vl : list memval) (c : ZMap.t memval) (ofs0 ofs: Z),
Intv.In ofs0 (ofs, (ofs + Z.of_nat (length vl))%Z) ->
ZMap.get ofs0 (Mem.setN vl ofs c) = List.nth (Z.to_nat (ofs0 - ofs)%Z) vl Undef.