421 |
421 |
422 (* We do sint before sbin, before sint is the user version |
422 (* We do sint before sbin, before sint is the user version |
423 and interpretations do not produce thm duplicates. I.e. |
423 and interpretations do not produce thm duplicates. I.e. |
424 we get the name word_sint.Rep_eqD, but not word_sbin.Req_eqD, |
424 we get the name word_sint.Rep_eqD, but not word_sbin.Req_eqD, |
425 because the latter is the same thm as the former *) |
425 because the latter is the same thm as the former *) |
426 interpretation word_sint: |
426 interpretation word_sint!: |
427 td_ext ["sint ::'a::len word => int" |
427 td_ext "sint ::'a::len word => int" |
428 word_of_int |
428 word_of_int |
429 "sints (len_of TYPE('a::len))" |
429 "sints (len_of TYPE('a::len))" |
430 "%w. (w + 2^(len_of TYPE('a::len) - 1)) mod 2^len_of TYPE('a::len) - |
430 "%w. (w + 2^(len_of TYPE('a::len) - 1)) mod 2^len_of TYPE('a::len) - |
431 2 ^ (len_of TYPE('a::len) - 1)"] |
431 2 ^ (len_of TYPE('a::len) - 1)" |
432 by (rule td_ext_sint) |
432 by (rule td_ext_sint) |
433 |
433 |
434 interpretation word_sbin: |
434 interpretation word_sbin!: |
435 td_ext ["sint ::'a::len word => int" |
435 td_ext "sint ::'a::len word => int" |
436 word_of_int |
436 word_of_int |
437 "sints (len_of TYPE('a::len))" |
437 "sints (len_of TYPE('a::len))" |
438 "sbintrunc (len_of TYPE('a::len) - 1)"] |
438 "sbintrunc (len_of TYPE('a::len) - 1)" |
439 by (rule td_ext_sbin) |
439 by (rule td_ext_sbin) |
440 |
440 |
441 lemmas int_word_sint = td_ext_sint [THEN td_ext.eq_norm, standard] |
441 lemmas int_word_sint = td_ext_sint [THEN td_ext.eq_norm, standard] |
442 |
442 |
443 lemmas td_sint = word_sint.td |
443 lemmas td_sint = word_sint.td |
633 apply safe |
633 apply safe |
634 apply (drule sym) |
634 apply (drule sym) |
635 apply simp |
635 apply simp |
636 done |
636 done |
637 |
637 |
638 interpretation word_bl: |
638 interpretation word_bl!: |
639 type_definition ["to_bl :: 'a::len0 word => bool list" |
639 type_definition "to_bl :: 'a::len0 word => bool list" |
640 of_bl |
640 of_bl |
641 "{bl. length bl = len_of TYPE('a::len0)}"] |
641 "{bl. length bl = len_of TYPE('a::len0)}" |
642 by (rule td_bl) |
642 by (rule td_bl) |
643 |
643 |
644 lemma word_size_bl: "size w == size (to_bl w)" |
644 lemma word_size_bl: "size w == size (to_bl w)" |
645 unfolding word_size by auto |
645 unfolding word_size by auto |
646 |
646 |