Last active
July 12, 2025 13:50
-
-
Save qexat/fba2b6c564d9d2bfed75275da0ceab54 to your computer and use it in GitHub Desktop.
small proofs of the "override" properties of max(a, b) on ℕ
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Require Import Arith. | |
Lemma max_override_right : forall (n m p : nat), (n >= m) -> max n (max m p) = max n p. | |
Proof. | |
intros n m p ge_n_m. | |
inversion ge_n_m ; rewrite Nat.max_assoc. | |
- rewrite Nat.max_id. | |
reflexivity. | |
- rewrite H0. | |
rewrite (Nat.max_l n m ge_n_m). | |
reflexivity. | |
Qed. | |
Lemma max_override_left : forall (n m p : nat), (m <= p) -> max (max n m) p = max n p. | |
Proof. | |
intros n m p le_m_p. | |
inversion le_m_p ; rewrite <- Nat.max_assoc. | |
- rewrite Nat.max_id. | |
reflexivity. | |
- rewrite H0. | |
rewrite (Nat.max_r m p le_m_p). | |
reflexivity. | |
Qed. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment