theory Word_EqI imports
More_Word
Aligned "HOL-Eisbach.Eisbach_Tools" begin
text‹
Some word equalities can be solved by considering the problem bitwise for all
@{prop "n < LENGTH('a::len)"}. This is similar to the existing method @{text word_bitwise}
and expanding into an explicit list of bits. The @{text word_bitwise} only works on
concrete word lengths, but can treat a wider number of operators (in particular a mix of
arithmetic, order, and bit operations). The @{text word_eqI} method below works on words of
abstract size (@{typ "'a word"}) and produces smaller, more abstract goals, but does not deal
with arithmetic operations. ›
(* bit_eqI subsumes the first rule; kept for backwards compatibility *) lemmas word_eqI_rules = word_eqI [rule_format, unfolded word_size] bit_eqI
lemma test_bit_lenD: "bit x n ==> n < LENGTH('a) ∧ bit x n"for x :: "'a :: len word" by (fastforce dest: test_bit_size simp: word_size)
― ‹Method to reduce goals of the form @{prop "P ==> x = y"} for words of abstract length to
reasoning on bits of the words. Leaves open goal if unsolved.› method word_eqI uses simp simp_del split split_del cong flip =
((* reduce conclusion to test_bit: *)
rule word_eqI_rules, (* fold common patterns into bit form *)
(simp only: word_eqI_folds)?, (* make sure we're in clarsimp normal form: *)
(clarsimp simp: simp simp del: simp_del simp flip: flip split: split split del: split_del cong: cong)?, (* turn x < 2^n assumptions into mask equations: *)
((drule less_mask_eq)+)?, (* expand and distribute test_bit everywhere: *)
(simp only: bit_simps word_eqI_simps)?, (* clarsimp normal form again, also resolve negated < and \<le> *)
(clarsimp simp: simp not_less not_le simp del: simp_del simp flip: flip
split: split split del: split_del cong: cong)?, (* add any additional word size constraints to new indices: *)
((drule test_bit_lenD)+)?, (* try to make progress (can't use +, would loop): *)
(simp only: bit_simps word_eqI_simps)?,
(clarsimp simp: simp simp del: simp_del simp flip: flip
split: split split del: split_del cong: cong)?, (* helps sometimes, rarely: *)
(simp add: simp test_bit_conj_lt del: simp_del flip: flip split: split split del: split_del cong: cong)?)
― ‹Method to reduce goals of the form @{prop "P ==> x = y"} for words of abstract length to
reasoning on bits of the words. Fails if goal unsolved, but tries harder than @{method word_eqI}.› method word_eqI_solve uses simp simp_del split split_del cong flip dest =
solves ‹word_eqI simp: simp simp_del: simp_del split: split split_del: split_del
cong: cong simp flip: flip;
(fastforce dest: dest simp: simp flip: flip
simp: simp simp del: simp_del split: split split del: split_del cong: cong)?›
end
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.9 Sekunden
(vorverarbeitet am 2026-06-10)
¤
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.