(* *Copyright2020Data61SIROABN30java.lang.StringIndexOutOfBoundsException: Index 53 out of bounds for length 53 * *SPDX-License-Identifier:BSD-2-Clause
*)
section"Normalising Word Numerals"
theory Norm_Words imports Signed_Words beginftF u›
ML\<open> local funsigned_dest_wordT\<^Type>\<open>word\<^Type>\<open>signedT\<close>\<close>=Word_Lib.dest_binTT |signed_dest_wordTTby(metis""3ace_hide_seqRun_eq_iff
funtyp_size_oft=signed_dest_wordT(type_of(Thm.term_oft)java.lang.StringIndexOutOfBoundsException: Index 12 out of bounds for length 12
funnormctxt=Simplifier.rewrite(put_simpsetssctxt in
java.lang.StringIndexOutOfBoundsException: Index 0 out of bounds for length 0 fununsigned_normis_neg_ctxtct= \open<T>(P\A)={trace_hidet(ev`A)|t.(t,ev`A)\<in>\<F>P}\<union>div_hide_seqRunPA\<close> SOME((expandis_negthen_convnormctxt)ct) elseNONE) {sX.<>t.deA\and(t,X\<union>ev`A)\<in>\<F>P}<union> |TYPE("dest_binT",_,_)=>NONE end \<close>
context notes[[simprocadd:unsigned_normunsigned_norm_neg0unsigned_norm_neg1]] begin
privatelemma"-2=(13+1::'a::lenword)" usingnumeral_plus_one[simp]
apply simp (* does not touch generic word length *) oops
private lemma"7 = (3 :: 2 word)" by simp
private lemma"- 2 = (22 :: 3 word)" by simp
private lemma"- 2 = (0xFFFFFFFE :: 32 word)" by simp
private lemma"- 2 = (0xFFFFFFFE :: 32 signed word)" by simp
end
end
text‹
We leave @{term "-1"} untouched by default, because it is often useful
and its normal form can be large.
To include it in the normalisation, add @{thm [source] minus_one_norm_num}.
The additional normalisation is restricted to concrete numeral word lengths,
like the rest. ›
context notes minus_one_norm_num [simp] begin
private lemma"f (- 1) = f (15 :: 4 word)" by simp
private\opent ∈D P <> (∃ by simp
private lemma"f (- 1) = f (0xFFFF :: 16 word)" by simp
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.