Skip to content
Snippets Groups Projects
Commit c57fe844 authored by Ralf Jung's avatar Ralf Jung
Browse files

simplify proofs (by Robbert)

parent c111795c
No related branches found
No related tags found
1 merge request!211upstream some list_numbers lemmas from Perennial
...@@ -152,30 +152,21 @@ Section seqZ. ...@@ -152,30 +152,21 @@ Section seqZ.
Lemma seqZ_S m i : seqZ m (S i) = seqZ m i ++ [m + i]. Lemma seqZ_S m i : seqZ m (S i) = seqZ m i ++ [m + i].
Proof. Proof.
intros. unfold seqZ. rewrite !Nat2Z.id, seq_S, fmap_app.
replace (Z.of_nat (S i)) with (Z.of_nat i + 1)%Z by lia. simpl. by rewrite Z.add_comm.
rewrite seqZ_app; [|lia..].
unfold seqZ; simpl.
replace (0%nat + (m+i))%Z with (m + i)%Z by lia. done.
Qed. Qed.
Lemma elem_of_seqZ m n k : Lemma elem_of_seqZ m n k :
k seqZ m n m k < m + n. k seqZ m n m k < m + n.
Proof. Proof.
rewrite elem_of_list_lookup. rewrite elem_of_list_lookup.
setoid_rewrite lookup_seqZ. split; intros. setoid_rewrite lookup_seqZ. split; [naive_solver lia|].
- destruct H as [??]. lia. exists (Z.to_nat (k - m)). lia.
- exists (Z.to_nat (k - m)). lia.
Qed. Qed.
Lemma Forall_seqZ (P : Z Prop) m n : Lemma Forall_seqZ (P : Z Prop) m n :
Forall P (seqZ m n) m', m m' < m + n P m'. Forall P (seqZ m n) m', m m' < m + n P m'.
Proof. Proof. rewrite Forall_forall. setoid_rewrite elem_of_seqZ. auto with lia. Qed.
rewrite Forall_lookup. split.
- intros H j [??]. apply (H (Z.to_nat (j - m))), lookup_seqZ.
rewrite !Z2Nat.id by lia. lia.
- intros H j x [-> ?]%lookup_seqZ. auto with lia.
Qed.
End seqZ. End seqZ.
(** ** Properties of the [sum_list] and [max_list] functions *) (** ** Properties of the [sum_list] and [max_list] functions *)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment