src/HOL/Word/Misc_Auxiliary.thy
author haftmann
Tue, 04 Aug 2020 09:33:05 +0000
changeset 72082 41393ecb57ac
parent 71997 4a013c92a091
permissions -rw-r--r--
uniform mask operation

(*  Title:      HOL/Word/Misc_Auxiliary.thy
    Author:     Jeremy Dawson, NICTA
*)

section \<open>Generic auxiliary\<close>

theory Misc_Auxiliary
  imports Main
begin

subsection \<open>Lemmas on list operations\<close>

lemma butlast_power: "(butlast ^^ n) bl = take (length bl - n) bl"
  by (induct n) (auto simp: butlast_take)

lemma nth_rev: "n < length xs \<Longrightarrow> rev xs ! n = xs ! (length xs - 1 - n)"
  using rev_nth by simp

lemma nth_rev_alt: "n < length ys \<Longrightarrow> ys ! n = rev ys ! (length ys - Suc n)"
  by (simp add: nth_rev)

lemma hd_butlast: "length xs > 1 \<Longrightarrow> hd (butlast xs) = hd xs"
  by (cases xs) auto

end