diff -r 02fbb93d5b01 -r c49564b6eb0f src/HOL/Library/Word.thy --- a/src/HOL/Library/Word.thy Sun Apr 20 07:51:06 2025 +0200 +++ b/src/HOL/Library/Word.thy Sun Apr 20 11:42:13 2025 +0200 @@ -511,6 +511,27 @@ by transfer simp +subsection \Elementary case distinctions\ + +lemma word_length_one [case_names zero minus_one length_beyond]: + fixes w :: \'a::len word\ + obtains (zero) \LENGTH('a) = Suc 0\ \w = 0\ + | (minus_one) \LENGTH('a) = Suc 0\ \w = - 1\ + | (length_beyond) \2 \ LENGTH('a)\ +proof (cases \2 \ LENGTH('a)\) + case True + with length_beyond show ?thesis . +next + case False + then have \LENGTH('a) = Suc 0\ + by simp + then have \w = 0 \ w = - 1\ + by transfer auto + with \LENGTH('a) = Suc 0\ zero minus_one show ?thesis + by blast +qed + + subsubsection \Basic ordering\ instantiation word :: (len) linorder