Theory PhiSem_Int_ArbiPrec
theory PhiSem_Int_ArbiPrec
imports PhiSem_Generic_Boolean PhiSem_Common_Int
abbrevs "<aint>" = "๐บ๐๐๐"
begin
chapter โนInteger of Arbitrary Precisionโบ
setup โนContext.theory_map (Generic_Variable_Access.Process_of_Argument.put
(SOME Generic_Variable_Access.store_value_no_clean))โบ
section โนSemanticsโบ
debt_axiomatization ๐บ๐๐๐ :: TY
and sem_mk_aint :: โนint โ VALโบ
and sem_dest_aint :: โนVAL โ intโบ
where sem_mk_dest_aint[simp]: โนsem_dest_aint (sem_mk_aint i) = iโบ
and WT_aint[simp]: โนWell_Type ๐บ๐๐๐ = { sem_mk_aint i |i. True } โบ
and ๐บ๐๐๐_neq_๐๐๐๐๐๐[simp]: โน๐บ๐๐๐ โ ๐๐๐๐๐๐โบ
and can_eqcmp_aint[simp]: "Can_EqCompare res (sem_mk_aint i1) (sem_mk_aint i2)"
and eqcmp_aint[simp]: "EqCompare (sem_mk_aint i1) (sem_mk_aint i2) โท i1 = i2"
and zero_aint[simp]: โนZero ๐บ๐๐๐ = Some (sem_mk_aint 0)โบ
and ฯSem_aint_to_logic_int[simp]: โนฯSem_int_to_logic_int (sem_mk_aint i) = Some iโบ
and ฯSem_aint_to_logic_nat[simp]: โนฯSem_int_to_logic_nat (sem_mk_aint i) = (if 0 โค i then Some (nat i) else None)โบ
lemma sem_mk_aint_inj[simp]:
โนsem_mk_aint i = sem_mk_aint j โก i = jโบ
by (smt (verit, best) sem_mk_dest_aint)
lemma [ฯreason %logical_spec_of_semantics]:
โน ๐๐๐พ๐๐๐๐พ 0 โค n
โน get_logical_nat_from_semantic_int (sem_mk_aint n โฆ Itself) (nat n)โบ
unfolding get_logical_nat_from_semantic_int_def Premise_def
by simp
lemma [ฯreason %logical_spec_of_semantics]:
โน get_logical_int_from_semantic_int (sem_mk_aint n โฆ Itself) nโบ
unfolding get_logical_int_from_semantic_int_def Premise_def
by simp
lemma [ฯreason add]:
โนIs_Type_Literal ๐บ๐๐๐โบ
unfolding Is_Type_Literal_def ..
lemma has_Zero_๐บ๐๐๐[simp]:
โน has_Zero ๐บ๐๐๐ โบ
unfolding has_Zero_def
by simp
section โนฯ-Typesโบ
subsection โนInteger in the normal senseโบ
ฯtype_def ฯAInt :: "(VAL, int) ฯ" ("โค")
where โนx โฆ ฯAInt โก sem_mk_aint x โฆ Itselfโบ
deriving Basic
and Abstract_DomainโฉL
and Semantic_Zero_Val
and โน๐๐๐๐พ๐๐ฟ โค = ๐บ๐๐๐โบ
and Functionality
and Equiv_Class
lemma [ฯreason 1000]:
"ฯEqual โค (ฮปx y. True) (=)"
unfolding ฯEqual_def by (simp add: eq_nat_nat_iff)
lemma [ฯreason %logical_spec_of_semantics]:
โนget_logical_int_from_semantic_int (n โฆ โค) nโบ
unfolding get_logical_int_from_semantic_int_def Ball_def
by clarsimp
lemma [ฯreason %logical_spec_of_semantics]:
โน ๐๐๐พ๐๐๐๐พ 0 โค n
โน get_logical_nat_from_semantic_int (n โฆ โค) (nat n)โบ
unfolding get_logical_nat_from_semantic_int_def Ball_def Premise_def
by clarsimp
subsection โนNatural Nmberโบ
declare [[ฯtrace_reasoning = 0]]
ฯtype_def ฯANat ("โ")
where โนn โฆ โ โก of_nat n โฆ โคโบ
deriving Basic
and Abstract_DomainโฉL
and Semantic_Type
and Semantic_Zero_Val
and Inhabited
and โน๐๐๐๐พ๐๐ฟ โ = ๐บ๐๐๐โบ
and Functionality
and Equiv_Class
declare [[
overloaded_operator_in_synthesis โนInt.intโบ,
overloaded_operator_in_synthesis โนnatโบ
]]
lemma [ฯreason %ToA_num_conv_cut, ฯsynthesis %ฯsynthesis_transformation]:
" Threshold_Cost 4
โน ๐๐๐พ๐๐๐๐พ 0 โค x
โน x โฆ โค ๐๐๐บ๐๐๐ฟ๐๐๐๐ nat x โฆ โ"
โด
โนnat x โฆ MAKE 0 โโบ
โต.
lemma [ฯreason %ToA_num_conv_cut]:
โน ๐๐๐พ๐๐๐๐พ 0 โค x
โน x โฆ โค ๐๐๐บ๐๐๐ฟ๐๐๐๐ y โฆ โ ๐๐๐ป๐ y. y = nat x @tag to โโบ โด โต.
declare ฯANat.elim[condition โน๐๐๐๐พ๐๐๐๐
๐ฝ 2โบ,
ฯreason %ToA_num_conv_cut,
ฯsynthesis %ฯsynthesis_transformation]
lemma [ฯreason %ToA_num_conv_cut]:
" x โฆ โ ๐๐๐บ๐๐๐ฟ๐๐๐๐ y โฆ โค ๐๐๐ป๐ y. y = Int.int x @tag to โค " โด โต.
lemma [ฯreason 1000]: โนฯEqual โ (ฮป_ _. True) (=)โบ โด to โค โต.
lemma [ฯreason %logical_spec_of_semantics]:
โนget_logical_int_from_semantic_int (n โฆ โ) (of_nat n)โบ
unfolding get_logical_int_from_semantic_int_def Ball_def
by clarsimp
lemma [ฯreason %logical_spec_of_semantics]:
โนget_logical_nat_from_semantic_int (n โฆ โ) nโบ
unfolding get_logical_nat_from_semantic_int_def Ball_def
by clarsimp
section โนInstructionsโบ
subsection โนArithmetic Operationsโบ
definition op_aadd :: "(VAL ร VAL, VAL) proc'"
where "op_aadd =
ฯM_caseV (ฮปvb va.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
Return (ฯarg (sem_mk_aint (val_a + val_b)))
)))"
definition op_asub :: "(VAL ร VAL, VAL) proc'"
where "op_asub =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_a - val_b)))
)))"
definition op_aneg :: "(VAL, VAL) proc'"
where "op_aneg rv =
ฯM_getV ๐บ๐๐๐ sem_dest_aint rv (ฮปv.
Return (ฯarg (sem_mk_aint (-v))))"
definition op_amul :: "(VAL ร VAL, VAL) proc'"
where "op_amul =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_b * val_a)))
)))"
definition op_adiv :: "(VAL ร VAL, VAL) proc'"
where "op_adiv =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_a div val_b)))
)))"
definition op_amod :: "(VAL ร VAL, VAL) proc'"
where "op_amod =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_a mod val_b)))
)))"
definition op_alshr :: "(VAL ร VAL, VAL) proc'"
where "op_alshr =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_a div 2 ^ (Int.nat val_b))))
)))"
definition op_alshl :: "(VAL ร VAL, VAL) proc'"
where "op_alshl =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_aint (val_a * 2 ^ (Int.nat val_b))))
)))"
definition op_a_lt :: "(VAL ร VAL, VAL) proc'"
where "op_a_lt =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_bool (val_a < val_b)))
)))"
definition op_a_le :: "(VAL ร VAL, VAL) proc'"
where "op_a_le =
ฯM_caseV (ฮปva vb.
ฯM_getV ๐บ๐๐๐ sem_dest_aint va (ฮปval_a.
ฯM_getV ๐บ๐๐๐ sem_dest_aint vb (ฮปval_b.
Return (ฯarg (sem_mk_bool (val_a โค val_b)))
)))"
section โนAbstraction of Instructionsโบ
subsection โนArithmetic Operationsโบ
subsubsection โนConstant Integerโบ
lemma op_const_aint_ฯapp[ฯreason %ฯsynthesis_literal_number]:
โน Is_Literal x
โน X ๐๐๐บ๐๐๐ฟ๐๐๐๐ x โฆ ๐๐บ๐
[semantic_literal (sem_mk_aint x)] โค ๐๐พ๐๐บ๐๐๐ X @tag synthesisโบ
for X :: assn
โด
semantic_literal โนsem_mk_aint x โจ (x โฆ โค)โบ
โต .
lemma op_const_anat_ฯapp[ฯreason %ฯsynthesis_literal_number]:
โน ๐๐๐๐๐
๐๐ฟ๐[mode_literal] x' : of_nat x
โน X ๐๐๐บ๐๐๐ฟ๐๐๐๐ x โฆ Val (semantic_literal (sem_mk_aint x')) โ ๐๐พ๐๐บ๐๐๐ X @tag synthesisโบ
for X :: assn
โด
semantic_literal โนsem_mk_aint x' โจ (x โฆ โ)โบ
โต .
lemma [ฯreason %ฯsynthesis_parse_number+10
for โนSynthesis_Parse (numeral ?n::nat) (?X :: ?'ret โ assn)โบ
โนSynthesis_Parse (1::nat) (?X :: ?'ret โ assn)โบ
โนSynthesis_Parse (0::nat) (?X :: ?'ret โ assn)โบ
]:
โน Synthesis_Parse (n โฆ โ) X
โน Synthesis_Parse n Xโบ
for X :: โน'ret โ assnโบ
unfolding Synthesis_Parse_def ..
lemma [ฯreason %ฯsynthesis_parse_number
for โนSynthesis_Parse (numeral ?n::int) (?X :: ?'ret โ assn)โบ
โนSynthesis_Parse (1::int) (?X :: ?'ret โ assn)โบ
โนSynthesis_Parse (0::int) (?X :: ?'ret โ assn)โบ
]:
โน Synthesis_Parse (n โฆ โค) X
โน Synthesis_Parse n Xโบ
for X :: โน'ret โ assnโบ
unfolding Synthesis_Parse_def ..
lemma int_literal_2_literal_int[simp]:
โนint (literal x) = literal (int x)โบ
unfolding literal_def
by simp
subsubsection โนInteger Arithmeticโบ
paragraph โนAdditionโบ
lemma op_add_aint_ฯapp
[ฯoverload +,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x + y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_aadd (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โคโ y โฆ ๐๐บ๐
[vy] โค โผ ๐๐บ๐
x + y โฆ โค โฆ โบ
unfolding op_aadd_def Premise_def
by (cases vx; cases vy; simp, rule, rule, simp add: Premise_def, rule,
simp add: Premise_def, rule, simp)
lemma op_add_anat_ฯapp
[ฯoverload +,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x + y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_aadd (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โโ y โฆ ๐๐บ๐
[vy] โ โผ ๐๐บ๐
x + y โฆ โ โฆ โบ
โด op_add_aint โต .
paragraph โนSubtractionโบ
lemma op_sub_aint_ฯapp[ฯoverload -,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x - y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_asub (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โคโ y โฆ ๐๐บ๐
[vy] โค โผ ๐๐บ๐
x - y โฆ โค โฆโบ
unfolding op_asub_def Premise_def
by (cases vx; cases vy; simp, rule, rule, simp add: Premise_def,
rule, simp add: Premise_def, rule, simp)
lemma op_sub_anat_ฯapp[ฯoverload -,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x - y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐พ๐๐๐๐พ y โค x
โน ๐๐๐๐ผ op_asub (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โโ y โฆ ๐๐บ๐
[vy] โ โผ ๐๐บ๐
x - y โฆ โ โฆโบ
โด op_sub_aint โต .
paragraph โนNegationโบ
lemma op_neg_aint_ฯapp
[ฯoverload ~,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโบ โ โนฮปv. - x โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_aneg rv โฆ x โฆ ๐๐บ๐
[rv] โค โผ ๐๐บ๐
-x โฆ โค โฆ โบ
unfolding op_aneg_def Premise_def
by (cases rv; simp, rule, simp add: Premise_def, rule, simp)
paragraph โนTimesโบ
lemma op_mul_aint[ฯoverload *,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x * y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_amul (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โคโ y โฆ ๐๐บ๐
[vy] โค โผ ๐๐บ๐
x * y โฆ โค โฆโบ
unfolding op_amul_def
by (cases vx; cases vy; simp, rule, rule, simp add: Premise_def,
rule, simp add: Premise_def, rule, simp)
lemma op_mul_anat[ฯoverload *,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x * y โฆ _โบ (%synthesis_arith_cut)]:
โน ๐๐๐๐ผ op_amul (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โโ y โฆ ๐๐บ๐
[vy] โ โผ ๐๐บ๐
x * y โฆ โ โฆโบ
โด op_mul_aint โต
certified by (simp add: nat_mult_distrib) .
paragraph โนDivisionโบ
lemma op_udiv_aint_ฯapp[ฯoverload /,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x div y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_adiv (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โคโ y โฆ ๐๐บ๐
[vy] โค โผ ๐๐บ๐
x div y โฆ โค โฆโบ
unfolding op_adiv_def
by (cases vx; cases vy; simp, rule, rule, simp add: Premise_def, rule, simp add: Premise_def,
rule, simp)
lemma op_udiv_anat_ฯapp[ฯoverload /,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x div y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_adiv (ฯV_pair vx vy) โฆ x โฆ ๐๐บ๐
[vx] โโ y โฆ ๐๐บ๐
[vy] โ โผ ๐๐บ๐
x div y โฆ โ โฆโบ
โด op_udiv_aint โต
certified by (simp add: div_int_pos_iff nat_div_distrib) .
paragraph โนModuloโบ
lemma op_mod_aint_ฯapp[ฯoverload %,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x mod y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_amod (vxโ, vy) โฆ x โฆ ๐๐บ๐
[vx] โคโ y โฆ ๐๐บ๐
[vy] โค โผ ๐๐บ๐
x mod y โฆ โค โฆโบ
unfolding op_amod_def
by (cases vx; cases vy; simp, rule, rule, simp add: Premise_def, rule, simp add: Premise_def,
rule, simp)
lemma op_mod_anat_ฯapp[ฯoverload %,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x mod y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_amod (vxโ, vy) โฆ x โฆ ๐๐บ๐
[vx] โโ y โฆ ๐๐บ๐
[vy] โ โผ ๐๐บ๐
x mod y โฆ โ โฆโบ
โด op_mod_aint โต
certified by (metis nat_int of_nat_0_le_iff zmod_int) .
paragraph โนRight Shiftโบ
lemma op_lshr_aint_pre_ฯapp:
โน ๐๐๐๐ผ op_alshr (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โค โผ ๐๐บ๐
drop_bit (nat y) x โฆ โค โฆโบ
unfolding op_alshr_def Premise_def
by (cases raw1; cases raw2; simp; rule, rule, simp, rule, simp, simp,
rule, simp, insert drop_bit_int_def, presburger)
lemma op_push_bit_right_aint_ฯapp[ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โค โ y โฆ ๐๐บ๐
โโบ โ โนฮปv. drop_bit y x โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_alshr (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
drop_bit y x โฆ โค โฆโบ
โด op_lshr_aint_pre โต.
lemma op_lshr_aint_ฯapp[ฯoverload >>]:
โน๐๐๐๐ผ op_alshr (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
x div 2 ^ y โฆ โค โฆโบ
โด op_lshr_aint_pre โต
certified using drop_bit_int_def by blast .
lemma op_push_bit_right_anat_ฯapp[ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โ โ y โฆ ๐๐บ๐
โโบ โ โนฮปret. drop_bit y x โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_alshr (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โ โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
drop_bit y x โฆ โ โฆโบ
โด op_push_bit_right_aint โต
certified by (simp add: drop_bit_of_nat) .
lemma op_lshr_anat_ฯapp[ฯoverload >>]:
โน๐๐๐๐ผ op_alshr (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โ โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
x div 2 ^ y โฆ โ โฆโบ
โด op_lshr_aint โต
certified by (metis nat_int of_nat_0_le_iff of_nat_numeral of_nat_power zdiv_int) .
paragraph โนLeft Shiftโบ
lemma op_lshl_aint_pre_ฯapp:
โน ๐๐๐๐ผ op_alshl (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โค โผ ๐๐บ๐
push_bit (nat y) x โฆ โค โฆโบ
unfolding op_alshl_def Premise_def
by (cases raw1; cases raw2; simp; rule, rule, simp, rule, simp, rule, simp add: push_bit_int_def)
lemma op_push_bit_left_aint_ฯapp[ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โค โ y โฆ ๐๐บ๐
โโบ โ โนฮปv. push_bit y x โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_alshl (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
push_bit y x โฆ โค โฆโบ
โด op_lshl_aint_pre โต.
lemma op_lshl_aint_ฯapp[ฯoverload <<]:
โน๐๐๐๐ผ op_alshl (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โค โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
x * 2 ^ y โฆ โค โฆโบ
โด op_lshl_aint_pre โต certified by (simp add: push_bit_eq_mult) .
lemma op_push_bit_left_anat_ฯapp[ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โ โ y โฆ ๐๐บ๐
โโบ โ โนฮปv. push_bit y x โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_alshl (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โ โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
push_bit y x โฆ โ โฆโบ
โด op_push_bit_left_aint โต
certified by (simp add: push_bit_of_nat) .
lemma op_lshl_anat_ฯapp[ฯoverload <<]:
โน๐๐๐๐ผ op_alshl (raw1โ, raw2) โฆ x โฆ ๐๐บ๐
[raw1] โ โ y โฆ ๐๐บ๐
[raw2] โ โผ ๐๐บ๐
x * 2 ^ y โฆ โ โฆโบ
โด op_lshl_aint โต
certified by (simp add: nat_mult_distrib) .
paragraph โนLess Thanโบ
lemma op_lt_aint[ฯoverload <,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x < y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_a_lt (rawxโ, rawy) โฆ x โฆ ๐๐บ๐
[rawx] โคโ y โฆ ๐๐บ๐
[rawy] โค โผ ๐๐บ๐
x < y โฆ ๐น โฆโบ
unfolding op_a_lt_def
by (cases rawx; cases rawy; simp, rule, rule, simp, rule, simp, rule, simp)
lemma op_lt_anat[ฯoverload <,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x < y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_a_lt (rawxโ, rawy) โฆ x โฆ ๐๐บ๐
[rawx] โโ y โฆ ๐๐บ๐
[rawy] โ โผ ๐๐บ๐
x < y โฆ ๐น โฆโบ
โด op_lt_aint โต.
setup โนContext.theory_map (Generic_Variable_Access.Process_of_Argument.put NONE)โบ
thm "<_ฯapp"
proc (nodef) op_gt_aint[ฯoverload >]:
input โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ
output โน๐๐บ๐
x > y โฆ ๐นโบ
โด
$y < $x
โต.
proc (nodef) op_gt_anat[ฯoverload >]:
input โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ
output โน๐๐บ๐
x > y โฆ ๐นโบ
โด
$y < $x
โต.
setup โนContext.theory_map (Generic_Variable_Access.Process_of_Argument.put
(SOME Generic_Variable_Access.store_value_no_clean))โบ
paragraph โนLess Equalโบ
lemma op_le_aint_ฯapp[ฯoverload โค,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ โ โนฮปv. x โค y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_a_le (rawxโ, rawy) โฆ x โฆ ๐๐บ๐
[rawx] โคโ y โฆ ๐๐บ๐
[rawy] โค โผ ๐๐บ๐
x โค y โฆ ๐น โฆโบ
unfolding op_a_le_def
by (cases rawx; cases rawy; simp, rule, rule, simp add: Premise_def,
rule, simp add: Premise_def, rule, simp)
lemma op_le_anat_ฯapp[ฯoverload โค,
ฯsynthesis for _ (%synthesis_arith)
and โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ โ โนฮปv. x โค y โฆ _โบ (%synthesis_arith_cut)]:
โน๐๐๐๐ผ op_a_le (rawxโ, rawy) โฆ x โฆ ๐๐บ๐
[rawx] โโ y โฆ ๐๐บ๐
[rawy] โ โผ ๐๐บ๐
x โค y โฆ ๐น โฆโบ
โด op_le_aint โต.
setup โนContext.theory_map (Generic_Variable_Access.Process_of_Argument.put NONE)โบ
proc (nodef) op_ge_aint[ฯoverload โฅ]:
input โนx โฆ ๐๐บ๐
โคโ y โฆ ๐๐บ๐
โคโบ
output โน๐๐บ๐
x โฅ y โฆ ๐นโบ
โด
$y โค $x
โต.
proc (nodef) op_ge_anat[ฯoverload โฅ]:
input โนx โฆ ๐๐บ๐
โโ y โฆ ๐๐บ๐
โโบ
output โน๐๐บ๐
x โฅ y โฆ ๐นโบ
โด
$y โค $x
โต.
end