Theory Lem_num
chapter ‹Generated by Lem from ‹num.lem›.›
theory "Lem_num"
imports
Main
"Lem_bool"
"Lem_basic_classes"
"HOL-Library.Word"
"Complex_Main"
begin
record 'a NumNegate_class=
numNegate_method ::" 'a ⇒ 'a "
record 'a NumAbs_class=
abs_method ::" 'a ⇒ 'a "
record 'a NumAdd_class=
numAdd_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumMinus_class=
numMinus_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumMult_class=
numMult_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumPow_class=
numPow_method ::" 'a ⇒ nat ⇒ 'a "
record 'a NumDivision_class=
numDivision_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumIntegerDivision_class=
div_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumRemainder_class=
mod_method ::" 'a ⇒ 'a ⇒ 'a "
record 'a NumSucc_class=
succ_method ::" 'a ⇒ 'a "
record 'a NumPred_class=
pred_method ::" 'a ⇒ 'a "
definition instance_Basic_classes_Ord_nat_dict :: "(nat)Ord_class " where
" instance_Basic_classes_Ord_nat_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumAdd_nat_dict :: "(nat)NumAdd_class " where
" instance_Num_NumAdd_nat_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_nat_dict :: "(nat)NumMinus_class " where
" instance_Num_NumMinus_nat_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_nat_dict :: "(nat)NumSucc_class " where
" instance_Num_NumSucc_nat_dict = ((|
succ_method = Suc |) )"
definition instance_Num_NumPred_nat_dict :: "(nat)NumPred_class " where
" instance_Num_NumPred_nat_dict = ((|
pred_method = (λ n. n -( 1 :: nat))|) )"
definition instance_Num_NumMult_nat_dict :: "(nat)NumMult_class " where
" instance_Num_NumMult_nat_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumIntegerDivision_nat_dict :: "(nat)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_nat_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_nat_dict :: "(nat)NumDivision_class " where
" instance_Num_NumDivision_nat_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_nat_dict :: "(nat)NumRemainder_class " where
" instance_Num_NumRemainder_nat_dict = ((|
mod_method = (mod)|) )"
fun gen_pow_aux :: "('a ⇒ 'a ⇒ 'a)⇒ 'a ⇒ 'a ⇒ nat ⇒ 'a " where
" gen_pow_aux (mul :: 'a ⇒ 'a ⇒ 'a) (a :: 'a) (b :: 'a) (e :: nat) = (
(case e of
0 => a
| (Suc 0) => mul a b
| ( (Suc(Suc e'))) => (let e'' = (e div( 2 :: nat)) in
(let a' = (if (e mod( 2 :: nat)) =( 0 :: nat) then a else mul a b) in
gen_pow_aux mul a' (mul b b) e''))
))"
definition gen_pow :: " 'a ⇒('a ⇒ 'a ⇒ 'a)⇒ 'a ⇒ nat ⇒ 'a " where
" gen_pow (one :: 'a) (mul :: 'a ⇒ 'a ⇒ 'a) (b :: 'a) (e :: nat) = (
if e <( 0 :: nat) then one else
if (e =( 0 :: nat)) then one else gen_pow_aux mul one b e )"
definition instance_Num_NumPow_nat_dict :: "(nat)NumPow_class " where
" instance_Num_NumPow_nat_dict = ((|
numPow_method = (^)|) )"
definition instance_Basic_classes_OrdMaxMin_nat_dict :: "(nat)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_nat_dict = ((|
max_method = max,
min_method = min |) )"
definition instance_Basic_classes_Ord_Num_natural_dict :: "(nat)Ord_class " where
" instance_Basic_classes_Ord_Num_natural_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumAdd_Num_natural_dict :: "(nat)NumAdd_class " where
" instance_Num_NumAdd_Num_natural_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_natural_dict :: "(nat)NumMinus_class " where
" instance_Num_NumMinus_Num_natural_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_Num_natural_dict :: "(nat)NumSucc_class " where
" instance_Num_NumSucc_Num_natural_dict = ((|
succ_method = Suc |) )"
definition instance_Num_NumPred_Num_natural_dict :: "(nat)NumPred_class " where
" instance_Num_NumPred_Num_natural_dict = ((|
pred_method = (λ n. n -( 1 :: nat))|) )"
definition instance_Num_NumMult_Num_natural_dict :: "(nat)NumMult_class " where
" instance_Num_NumMult_Num_natural_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumPow_Num_natural_dict :: "(nat)NumPow_class " where
" instance_Num_NumPow_Num_natural_dict = ((|
numPow_method = (^)|) )"
definition instance_Num_NumIntegerDivision_Num_natural_dict :: "(nat)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_Num_natural_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_Num_natural_dict :: "(nat)NumDivision_class " where
" instance_Num_NumDivision_Num_natural_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_Num_natural_dict :: "(nat)NumRemainder_class " where
" instance_Num_NumRemainder_Num_natural_dict = ((|
mod_method = (mod)|) )"
definition instance_Basic_classes_OrdMaxMin_Num_natural_dict :: "(nat)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_natural_dict = ((|
max_method = max,
min_method = min |) )"
definition instance_Basic_classes_Ord_Num_int_dict :: "(int)Ord_class " where
" instance_Basic_classes_Ord_Num_int_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumNegate_Num_int_dict :: "(int)NumNegate_class " where
" instance_Num_NumNegate_Num_int_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition instance_Num_NumAbs_Num_int_dict :: "(int)NumAbs_class " where
" instance_Num_NumAbs_Num_int_dict = ((|
abs_method = abs |) )"
definition instance_Num_NumAdd_Num_int_dict :: "(int)NumAdd_class " where
" instance_Num_NumAdd_Num_int_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_int_dict :: "(int)NumMinus_class " where
" instance_Num_NumMinus_Num_int_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_Num_int_dict :: "(int)NumSucc_class " where
" instance_Num_NumSucc_Num_int_dict = ((|
succ_method = (λ n. n +( 1 :: int))|) )"
definition instance_Num_NumPred_Num_int_dict :: "(int)NumPred_class " where
" instance_Num_NumPred_Num_int_dict = ((|
pred_method = (λ n. n -( 1 :: int))|) )"
definition instance_Num_NumMult_Num_int_dict :: "(int)NumMult_class " where
" instance_Num_NumMult_Num_int_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumPow_Num_int_dict :: "(int)NumPow_class " where
" instance_Num_NumPow_Num_int_dict = ((|
numPow_method = (^)|) )"
definition instance_Num_NumIntegerDivision_Num_int_dict :: "(int)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_Num_int_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_Num_int_dict :: "(int)NumDivision_class " where
" instance_Num_NumDivision_Num_int_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_Num_int_dict :: "(int)NumRemainder_class " where
" instance_Num_NumRemainder_Num_int_dict = ((|
mod_method = (mod)|) )"
definition instance_Basic_classes_OrdMaxMin_Num_int_dict :: "(int)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_int_dict = ((|
max_method = max,
min_method = min |) )"
definition instance_Basic_classes_Ord_Num_int32_dict :: "( 32 word)Ord_class " where
" instance_Basic_classes_Ord_Num_int32_dict = ((|
compare_method = (genericCompare word_sless (=)),
isLess_method = word_sless,
isLessEqual_method = word_sle,
isGreater_method = (λ x y. word_sless y x),
isGreaterEqual_method = (λ x y. word_sle y x)|) )"
definition instance_Num_NumNegate_Num_int32_dict :: "( 32 word)NumNegate_class " where
" instance_Num_NumNegate_Num_int32_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition int32Abs :: " 32 word ⇒ 32 word " where
" int32Abs i = ( (if word_sle(((word_of_int 0) :: 32 word)) i then i else - i))"
definition instance_Num_NumAbs_Num_int32_dict :: "( 32 word)NumAbs_class " where
" instance_Num_NumAbs_Num_int32_dict = ((|
abs_method = int32Abs |) )"
definition instance_Num_NumAdd_Num_int32_dict :: "( 32 word)NumAdd_class " where
" instance_Num_NumAdd_Num_int32_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_int32_dict :: "( 32 word)NumMinus_class " where
" instance_Num_NumMinus_Num_int32_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_Num_int32_dict :: "( 32 word)NumSucc_class " where
" instance_Num_NumSucc_Num_int32_dict = ((|
succ_method = (λ n. n +((word_of_int 1) :: 32 word))|) )"
definition instance_Num_NumPred_Num_int32_dict :: "( 32 word)NumPred_class " where
" instance_Num_NumPred_Num_int32_dict = ((|
pred_method = (λ n. n -((word_of_int 1) :: 32 word))|) )"
definition instance_Num_NumMult_Num_int32_dict :: "( 32 word)NumMult_class " where
" instance_Num_NumMult_Num_int32_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumPow_Num_int32_dict :: "( 32 word)NumPow_class " where
" instance_Num_NumPow_Num_int32_dict = ((|
numPow_method = (^)|) )"
definition instance_Num_NumIntegerDivision_Num_int32_dict :: "( 32 word)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_Num_int32_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_Num_int32_dict :: "( 32 word)NumDivision_class " where
" instance_Num_NumDivision_Num_int32_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_Num_int32_dict :: "( 32 word)NumRemainder_class " where
" instance_Num_NumRemainder_Num_int32_dict = ((|
mod_method = (mod)|) )"
definition instance_Basic_classes_OrdMaxMin_Num_int32_dict :: "( 32 word)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_int32_dict = ((|
max_method = ((λ x y. if (word_sle y x) then x else y)),
min_method = ((λ x y. if (word_sle x y) then x else y))|) )"
definition instance_Basic_classes_Ord_Num_int64_dict :: "( 64 word)Ord_class " where
" instance_Basic_classes_Ord_Num_int64_dict = ((|
compare_method = (genericCompare word_sless (=)),
isLess_method = word_sless,
isLessEqual_method = word_sle,
isGreater_method = (λ x y. word_sless y x),
isGreaterEqual_method = (λ x y. word_sle y x)|) )"
definition instance_Num_NumNegate_Num_int64_dict :: "( 64 word)NumNegate_class " where
" instance_Num_NumNegate_Num_int64_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition int64Abs :: " 64 word ⇒ 64 word " where
" int64Abs i = ( (if word_sle(((word_of_int 0) :: 64 word)) i then i else - i))"
definition instance_Num_NumAbs_Num_int64_dict :: "( 64 word)NumAbs_class " where
" instance_Num_NumAbs_Num_int64_dict = ((|
abs_method = int64Abs |) )"
definition instance_Num_NumAdd_Num_int64_dict :: "( 64 word)NumAdd_class " where
" instance_Num_NumAdd_Num_int64_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_int64_dict :: "( 64 word)NumMinus_class " where
" instance_Num_NumMinus_Num_int64_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_Num_int64_dict :: "( 64 word)NumSucc_class " where
" instance_Num_NumSucc_Num_int64_dict = ((|
succ_method = (λ n. n +((word_of_int 1) :: 64 word))|) )"
definition instance_Num_NumPred_Num_int64_dict :: "( 64 word)NumPred_class " where
" instance_Num_NumPred_Num_int64_dict = ((|
pred_method = (λ n. n -((word_of_int 1) :: 64 word))|) )"
definition instance_Num_NumMult_Num_int64_dict :: "( 64 word)NumMult_class " where
" instance_Num_NumMult_Num_int64_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumPow_Num_int64_dict :: "( 64 word)NumPow_class " where
" instance_Num_NumPow_Num_int64_dict = ((|
numPow_method = (^)|) )"
definition instance_Num_NumIntegerDivision_Num_int64_dict :: "( 64 word)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_Num_int64_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_Num_int64_dict :: "( 64 word)NumDivision_class " where
" instance_Num_NumDivision_Num_int64_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_Num_int64_dict :: "( 64 word)NumRemainder_class " where
" instance_Num_NumRemainder_Num_int64_dict = ((|
mod_method = (mod)|) )"
definition instance_Basic_classes_OrdMaxMin_Num_int64_dict :: "( 64 word)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_int64_dict = ((|
max_method = ((λ x y. if (word_sle y x) then x else y)),
min_method = ((λ x y. if (word_sle x y) then x else y))|) )"
definition instance_Basic_classes_Ord_Num_integer_dict :: "(int)Ord_class " where
" instance_Basic_classes_Ord_Num_integer_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumNegate_Num_integer_dict :: "(int)NumNegate_class " where
" instance_Num_NumNegate_Num_integer_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition instance_Num_NumAbs_Num_integer_dict :: "(int)NumAbs_class " where
" instance_Num_NumAbs_Num_integer_dict = ((|
abs_method = abs |) )"
definition instance_Num_NumAdd_Num_integer_dict :: "(int)NumAdd_class " where
" instance_Num_NumAdd_Num_integer_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_integer_dict :: "(int)NumMinus_class " where
" instance_Num_NumMinus_Num_integer_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumSucc_Num_integer_dict :: "(int)NumSucc_class " where
" instance_Num_NumSucc_Num_integer_dict = ((|
succ_method = (λ n. n +( 1 :: int))|) )"
definition instance_Num_NumPred_Num_integer_dict :: "(int)NumPred_class " where
" instance_Num_NumPred_Num_integer_dict = ((|
pred_method = (λ n. n -( 1 :: int))|) )"
definition instance_Num_NumMult_Num_integer_dict :: "(int)NumMult_class " where
" instance_Num_NumMult_Num_integer_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumPow_Num_integer_dict :: "(int)NumPow_class " where
" instance_Num_NumPow_Num_integer_dict = ((|
numPow_method = (^)|) )"
definition instance_Num_NumIntegerDivision_Num_integer_dict :: "(int)NumIntegerDivision_class " where
" instance_Num_NumIntegerDivision_Num_integer_dict = ((|
div_method = (div)|) )"
definition instance_Num_NumDivision_Num_integer_dict :: "(int)NumDivision_class " where
" instance_Num_NumDivision_Num_integer_dict = ((|
numDivision_method = (div)|) )"
definition instance_Num_NumRemainder_Num_integer_dict :: "(int)NumRemainder_class " where
" instance_Num_NumRemainder_Num_integer_dict = ((|
mod_method = (mod)|) )"
definition instance_Basic_classes_OrdMaxMin_Num_integer_dict :: "(int)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_integer_dict = ((|
max_method = max,
min_method = min |) )"
definition instance_Basic_classes_Ord_Num_rational_dict :: "(rat)Ord_class " where
" instance_Basic_classes_Ord_Num_rational_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumAdd_Num_rational_dict :: "(rat)NumAdd_class " where
" instance_Num_NumAdd_Num_rational_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_rational_dict :: "(rat)NumMinus_class " where
" instance_Num_NumMinus_Num_rational_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumNegate_Num_rational_dict :: "(rat)NumNegate_class " where
" instance_Num_NumNegate_Num_rational_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition instance_Num_NumAbs_Num_rational_dict :: "(rat)NumAbs_class " where
" instance_Num_NumAbs_Num_rational_dict = ((|
abs_method = abs |) )"
definition instance_Num_NumSucc_Num_rational_dict :: "(rat)NumSucc_class " where
" instance_Num_NumSucc_Num_rational_dict = ((|
succ_method = (λ n. n +(Fract ( 1 :: int) (1 :: int)))|) )"
definition instance_Num_NumPred_Num_rational_dict :: "(rat)NumPred_class " where
" instance_Num_NumPred_Num_rational_dict = ((|
pred_method = (λ n. n -(Fract ( 1 :: int) (1 :: int)))|) )"
definition instance_Num_NumMult_Num_rational_dict :: "(rat)NumMult_class " where
" instance_Num_NumMult_Num_rational_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumDivision_Num_rational_dict :: "(rat)NumDivision_class " where
" instance_Num_NumDivision_Num_rational_dict = ((|
numDivision_method = (div)|) )"
fun rationalPowInteger :: " rat ⇒ int ⇒ rat " where
" rationalPowInteger b e = (
if e =( 0 :: int) then(Fract ( 1 :: int) (1 :: int)) else
if e >( 0 :: int) then rationalPowInteger b (e -( 1 :: int)) * b else
rationalPowInteger b (e +( 1 :: int)) div b )"
definition instance_Num_NumPow_Num_rational_dict :: "(rat)NumPow_class " where
" instance_Num_NumPow_Num_rational_dict = ((|
numPow_method = power |) )"
definition instance_Basic_classes_OrdMaxMin_Num_rational_dict :: "(rat)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_rational_dict = ((|
max_method = max,
min_method = min |) )"
definition instance_Basic_classes_Ord_Num_real_dict :: "(real)Ord_class " where
" instance_Basic_classes_Ord_Num_real_dict = ((|
compare_method = (genericCompare (<) (=)),
isLess_method = (<),
isLessEqual_method = (≤),
isGreater_method = (>),
isGreaterEqual_method = (≥)|) )"
definition instance_Num_NumAdd_Num_real_dict :: "(real)NumAdd_class " where
" instance_Num_NumAdd_Num_real_dict = ((|
numAdd_method = (+)|) )"
definition instance_Num_NumMinus_Num_real_dict :: "(real)NumMinus_class " where
" instance_Num_NumMinus_Num_real_dict = ((|
numMinus_method = (-)|) )"
definition instance_Num_NumNegate_Num_real_dict :: "(real)NumNegate_class " where
" instance_Num_NumNegate_Num_real_dict = ((|
numNegate_method = (λ i. - i)|) )"
definition instance_Num_NumAbs_Num_real_dict :: "(real)NumAbs_class " where
" instance_Num_NumAbs_Num_real_dict = ((|
abs_method = abs |) )"
definition instance_Num_NumSucc_Num_real_dict :: "(real)NumSucc_class " where
" instance_Num_NumSucc_Num_real_dict = ((|
succ_method = (λ n. n +( 1 :: real))|) )"
definition instance_Num_NumPred_Num_real_dict :: "(real)NumPred_class " where
" instance_Num_NumPred_Num_real_dict = ((|
pred_method = (λ n. n -( 1 :: real))|) )"
definition instance_Num_NumMult_Num_real_dict :: "(real)NumMult_class " where
" instance_Num_NumMult_Num_real_dict = ((|
numMult_method = (*)|) )"
definition instance_Num_NumDivision_Num_real_dict :: "(real)NumDivision_class " where
" instance_Num_NumDivision_Num_real_dict = ((|
numDivision_method = (div)|) )"
definition realFromFrac :: " int ⇒ int ⇒ real " where
" realFromFrac n d = ( ((real_of_int n)) div ((real_of_int d)))"
fun realPowInteger :: " real ⇒ int ⇒ real " where
" realPowInteger b e = (
if e =( 0 :: int) then( 1 :: real) else
if e >( 0 :: int) then realPowInteger b (e -( 1 :: int)) * b else
realPowInteger b (e +( 1 :: int)) div b )"
definition instance_Num_NumPow_Num_real_dict :: "(real)NumPow_class " where
" instance_Num_NumPow_Num_real_dict = ((|
numPow_method = power |) )"
definition instance_Basic_classes_OrdMaxMin_Num_real_dict :: "(real)OrdMaxMin_class " where
" instance_Basic_classes_OrdMaxMin_Num_real_dict = ((|
max_method = max,
min_method = min |) )"
definition integerSqrt :: " int ⇒ int " where
" integerSqrt i = ( floor (sqrt ((real_of_int i))))"
end