proposition: Lemma refine_grestrict p g : size g = hw * hw -> refine (grestrict p g) g.
proof: Proof. move=> Hs. apply/refineP; split => //. by rewrite grestrict_size. move=> p1 Hp1. case: (leqP (pos2n p) (pos2n p1)) => Lp. by rewrite grestrict_get_default // => HH; case/negP: out_not_in_refl. by rewrite grestrict_get. Qed.
imports: mathcomp(all_ssreflect) mathcomp(zify)