43 lines
900 B
Plaintext
43 lines
900 B
Plaintext
|
(*
|
||
|
* Copyright 2014, NICTA
|
||
|
*
|
||
|
* This software may be distributed and modified according to the terms of
|
||
|
* the BSD 2-Clause license. Note that NO WARRANTY is provided.
|
||
|
* See "LICENSE_BSD2.txt" for details.
|
||
|
*
|
||
|
* @TAG(NICTA_BSD)
|
||
|
*)
|
||
|
|
||
|
theory SignedWords
|
||
|
imports "~~/src/HOL/Word/Word"
|
||
|
begin
|
||
|
|
||
|
subsection {* Type definition *}
|
||
|
|
||
|
typedef ('a::len0) signed = "UNIV :: 'a set" ..
|
||
|
|
||
|
lemma card_signed [simp]: "CARD (('a::len0) signed) = CARD('a)"
|
||
|
unfolding type_definition.card [OF type_definition_signed]
|
||
|
by simp
|
||
|
|
||
|
instantiation signed :: (len0) len0
|
||
|
begin
|
||
|
|
||
|
definition
|
||
|
len_signed [simp]: "len_of (x::'a::len0 signed itself) = len_of TYPE('a)"
|
||
|
|
||
|
instance ..
|
||
|
|
||
|
end
|
||
|
|
||
|
instance signed :: (len) len
|
||
|
by (intro_classes, simp)
|
||
|
|
||
|
type_synonym 'a sword = "('a signed) word"
|
||
|
type_synonym sword8 = "8 sword"
|
||
|
type_synonym sword16 = "16 sword"
|
||
|
type_synonym sword32 = "32 sword"
|
||
|
type_synonym sword64 = "64 sword"
|
||
|
|
||
|
end
|