proposition: Theorem cross_correct: forall p, In p cross <-> exists x, exists y, x < h /\ y < w /\ p = Pos x y.
proof: Proof. intros p; case (in_fold_map _ (fun x y => Pos x y) p (progression w 0) (progression h 0)). intros H1 H2; split; intros H3. case H1; auto. intros x (y, (U1, (U2, U3))). exists x; exists y; repeat split; auto. case (in_progression h 0 x); auto with arith. rewrite Nat.add_0_r; intros H _; case H; auto. case (in_progression w 0 y); auto with arith. rewrite Nat.add_0_r; intros H _; case H; auto. case H3; intros x (y, (U1, (U2, U3))); apply H2; clear H2 H3. exists x; exists y; repeat split; auto with arith. case (in_progression h 0 x); auto with arith. case (in_progression w 0 y); auto with arith. Qed.
imports: List UList Permutation Div OrderedList ListOp Lia