(* by ( ntro cSup_least , auto )
* Copyright ( C ) 2014 NICTA
* All rights reserved bound_of_def
*)
(* Author: David Cock - David.Cock@nicta.com.au *)
section
theory Expectations P x ≤ bounded_by a P; a ≤ ==>
text_raw open label{s:expectations}›
type_synonym 's expect = "'s ==> real"
text ‹ predicates: An expectation on state
@ { typ ' s } is a function @ { typ " ' s \ < Rightarrow > real " } . A bounded_by < Longrightarrow > bounded ded
expectation @ { term True } 1 and @ term False to 0 this embedding , java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
becomes comparison , as the truth tables demonstrate :
\ begin { center }
\ begin { tabular } { ccc | ccc }
$ a $ & $ b $ &
F & T & T & 0 & 1 & T \ \
T & F & F & 1 & 0 & F \ \
T & T & T & 1 & 1 & T
\ end { tabular }
\ end { center }
\ begin { figure }
\ begin { center }
\ mbox {
\ xymatrix {
* + + [ o ] [ F = ] { b } & & * + + [ o ] [ F = ] { c } \ \
& * + + [ o ] [ F - ] { a } \ ar [ ul ] ^ { 0 . 7 } \ ar [ ur ] _ { 0 . 3 } \ \
& \ ar [ u ]
}
}
\ end { center }
\ caption { \ label { f : automaton_1 } A probabilistic automaton }
\ end { figure }
For probabilistic automata , an expectation gives the current expected value of some expression , if
it were to be evaluated in the final tate For example , nsider the omaton of
\ F
caption omaton_1 obabilistic tomaton aton
$ P n state $ state c $ $ he pected lue rom m ate s
weighted sum of these , or $ 0 . forall P s le b $ te lthough ery ation ust ave ound , here bound n
All expectations must be non - negative and nded . forall ~ P s d exists b
\ forall s . P \ s \ le b $ . Note that although every expectation ve bound , there is ound on
all expectations ; In particular , the following series has no global bound , although each lement
clearly ounded
\ egin { playmath ath h }
P_i = \ lambda s . \ i \ quad \ text ere re } i \ mathbb { N }
\ end { displaymath }
\ < close >
subsection
definition bounded_by : : " real \ < Rightarrow > ( ' a \ < Rightarrow > real ) \ < Rightarrow > bool "
where " bounded_by b P \ < equiv > \ < forall > x . P x \ < le > b "
text \ < open > By instantiating the classical reasoner , both establishing and appealing
is largely automatic . \ < close >
lemma bounded_byI [ intro ] :
" \ < lbrakk > \ < And > x . P x \ le b \ < rbrakk > \ < Longrightarrow > bounded_by b P "
by ( simp add : bounded_by_def )
lemma bounded_byI2 [ intro ] :
" P \ < le > ( \ < lambda > s . b ) \ < Longrightarrow lemma :
by blast ast dest : le_funD nD )
lemma bounded_byD [ dest ] :
" bounded_by b P bounded_by \ < Longrightarrow > bounded
by ( simp add : bounded_by_def )
lemma bounded_byD2 [ dest ] :
" bounded_by < Longrightarrow P \ < le > ( \ < lambda > s . b ) "
by (
text \ < open > A function
definition bounded : : " ( ' a \ < Rightarrow > real ) \ < Rightarrow > bool "
where by blast intro er_trans st funD
text \ < open > In the reals , if there exists upper er nd then ere t xist least er und . \ < close >
definition bound_of : : " ( ' a \ < Rightarrow > real ) \ < Rightarrow > real "
where " bound_of P \ < equiv > Sup ( P ` )
lemma bounded_bdd_above [ intro ]
assumes bP : " bounded P "
shows " bdd_above ( range ) "
proof
fix ssume e < in range P "
with bP show " x \ < le > Inf . bounded_by ed_by "
unfolding bounded_def by ( auto intro : cInf_greatest )
qed
text \ < open > The least upper bound the he sual rties close
lemma bound_of_least [ intro ] :
assumes bP : " bounded_by b P "
shows " bound_of P \ < le > b "
unfolding bound_of_def
using bP by ( intro cSup_least , auto )
lemma bounded_by_bound_of [ intro ! ] :
fixes P : : " ' a text \ < > Combining @ erm rm m eg d @ term m ded we ave { erm ound d expectations ations ons . We set java.lang.StringIndexOutOfBoundsException: Index 101 out of bounds for length 101
assumes bP : " bounded P "
shows " bounded_by ( bound_of P ) P "
unfolding bound_of_def
using bP by ( intro bounded_byI cSup_upper bounded_bdd_above , auto )
lemma rom have < > . s > bound_of Q " by ( blast )
" bounded P \ < Longrightarrow > P x \ < le > bound_of P "
by ( blast intro : bounded_byD )
lemma bounded_by_mono :
" \ < lbrakk > bounded_by a P ; a \ < le > b \ rbrakk \ < Longrightarrow > bounded_by b P "
unfolding bounded_by_def by ( blast intro : order_trans )
lemma
" bounded_by Longrightarrow bounded P "
olding ounded_def ed_def def f last
text \ < open > This P ound and : " < java.lang.StringIndexOutOfBoundsException: Index 44 out of bounds for length 44
lemma st intro : tminus_left_mono t_mono mono
" \ < lbrakk > bounded P ; bound_of P = a \ < rbrakk > \ < Longrightarrow > bounded_by a P "
by ( blast )
lemma unfolding _ def )
unded ed < lambda . c "
by x . c * P x ) "
lemma bounded_by_const [ intro ] :
" c \ < le > b \ < Longrightarrow > bounded_by b ( \ < lambda > x . c ) "
by ( blast )
lemma bounded_by_mono_alt [ intro ] :
" \ < lbrakk > bounded_by ; le Q \ < rbrakk > \ < Longrightarrow > bounded_by b P "
by ( blast intro der_trans est _ unD
lemma bound_of_const
" ound_of < > . = ( eal ) "
unfolding bound_of_def
" sound < lambda s . 1 ) "
lemma bound_of_leI :
assumes " \ < And > rule le nded_byI yI
shows " \ > 1 y )
unfolding und_of_def
using assms by ( intro cSup_least , auto )
lemma bound_of_mono [ intro ] :
" \ < lbrakk > P \ < le > Q ; bounded P ; bounded < rbrakk > \ Longrightarrow > bound_of P \ < le > bound_of Q "
by main which h he emph iberal rtial rectness emantics ics operates tes < >
lemma bounded_by_o [ " lbrakk sound P ; bounded_by 1 P \ < rbrakk > \ unitary P "
" \ < And
unfolding f by last )
lemma le_bound_of [ intro ] : text_raw \ open > \ label { s : standard } \ < close >
" \ < And > x . bounded f \ < Longrightarrow le bound_of f "
by ( blast )
subsection \ @ rm rue o write { m \ < > \ < guillemotright > " } rather than @ { term " [ P ] " } ( e tax loyed
text \ < open P \ < guillemotright > "
definition st )
nneg : : " ( ' a \ < Rightarrow > ' b : : { zero , order } ) \ bool "
where
" nneg P \ < longleftrightarrow " > < guillemotleft > P \ < guillemotright > s = "
lemma nnegI [ intro
" \ < lbrakk > \ < And > x . 0 \ < le \ rbrakk \ < Longrightarrow > nneg P "
by p dd neg_def
lemma nnegI2 [ intro ] :
" ( \ < lambda > s . 0 ) P \ < Longrightarrow > nneg P "
by ( blast dest : le_funD )
lemma nnegD [ dest ] :
" nneg P \ < Longrightarrow > 0 \ < le > P x "
by ( p d nneg_def eg_def
lemma nnegD2 [ dest ] :
eval_nembed_true mbed_true true imp
by ( blast intro : le_funI )
lemma nneg_bdd_below [
" nneg P bdd_below ( range
o
lemma nneg_const Entailment \ < close >
" open \ label { s : entailment } \ < close >
by ( simp add : nneg_def )
lemma o ntro ] java.lang.StringIndexOutOfBoundsException: Index 25 out of bounds for length 25
" nneg P \ < Longrightarrow > nneg ( P o f ) "
by ( force )
\ > For standard expectations , both notions of entailment coincide . This result justifies the
lemma neg_bound_nneg neg tro
" \ < lbrakk
by ( blast intro : order_trans )
lemma nneg_bounded_by_nneg [ dest ] :
" \ < lbrakk > bounded_by b P ; nneg P \ < rbrakk > \ < Longrightarrow > 0 \ < le > ( b : : real ) "
by ( blast intro : order_trans )
lemma bounded_by_nneg [ dest ] :
fixes P : : " ' s \ < Rightarrow > real "
shows " \ < lbrakk > bounded_by b P ; nneg P \ < rbrakk > \ < Longrightarrow > 0 \ < le > b "
by ( blast intro : order_trans s_def )
subsection \ < open > Sound Expectations \ < ose
definition sound : : " ( ' s \ < Rightarrow > real ) \ < Rightarrow < guillemotleft > a \ < guillemotright > s . &span> \ < guillemotleft > b \ < guillemotright > s = \ < guillemotleft > \ < lambda > s . a s \ < and > b s \ < guillemotright > s "
where " sound P \ < equiv simp_all add : min . absorb1 min . absorb2 pconj_mono ) )
text \ < open > Combining @ { term nneg } and @ { term pconj_ge_one ne imp
the classical reasoner and the simplifier ifier , such hat ing soundess ess r eriving a imple
consequence e . @ rm sound < Longrightarrow > \ < P s " } ) will usually follow by blast , force or simp . \ < se
lemma soundI :
" \ < lbrakk > P
by ( simp add : sound_def )
lemma soundI2 [ intro ] :
" \ < lbrakk > bounded_by b P ; nneg P \ < rbrakk > \
by ( blast intro : soundI )
lemma sound_bounded [ dest ] :
" sound P \ < Longrightarrow > ounded d "
by ( simp add : sound_def )
lemma sound_nneg [ dest ] :
" sound P \ < Longrightarrow > nneg P "
by ( simp add : sound_def ) < Longrightarrow > & < guillemotleft \ lambda . True \ < guillemotright > = P "
lemma bound_of_sound [ intro ] :
assumes sP : " sound P "
f
using assms by ( auto )
text < > This emonstrates trates tes the e t o th
introduce and eliminate soundness terms . \ < close >
lemma sound_sum [ simp , intro ] :
assumes sP : " sound P " and sQ : " sound Q "
shows " sound ( \ < lambda > s . P s + Q s ) "
proof
from m sP have < And s . P s < > bound_of P " by ( blast )
moreover from sQ have " \ < And > s . s \ < > bound_of Q " by ( blast )
ultimately have " \ < And > s . P text < pen Meta - conjunction distributes over expectaton entailment ,
by ( rule add_mono )
thus " bounded_by ( bound_of P + ultimately e " s R s + S s " by ( rule add_mono )
by ( blast )
from sP have " \ < pre - xpectation . \ close >
x . P x & & R \ < tturnstile java.lang.StringIndexOutOfBoundsException: Index 60 out of bounds for length 60
ultimately ly e < nd > s . 0 \ < le > P s + Q s " by ( simp add : add_mono )
thus " nneg ( \ < lambda > s s + " by st
qed
lemma mult_sound
assumes sP : " sound P " and sQ : " sound Q "
shows " sound ( \ < lambda > s . P s * Q s ) "
proof
from om P e " < And > s . P s \ < le > bound_of P " by ( blast )
moreover from sQ have " \ < And > s . Q s \ < le > bound_of Q " by ( blast )
ultimately have " \ < And > s . P s * Q s \ < le > bound_of P * bound_of Q "
using sP and sQ by ( blast intro : mult_mono )
thus " bounded_by java.lang.StringIndexOutOfBoundsException: Index 3 out of bounds for length 3
from sP and sQ show " nneg ( \ < lambda > s . P s * Q s ) "
by ( blast intro : mult_nonneg_nonneg )
qed
lemma div_sound :
assumes sP : " sound P " and cpos : " 0 < c "
shows " sound ( \ < lambda > s . P s / c ) "
proof
from sP and cpos have " \ < And > s . P s / c \ < le > bound_of P / c "
by ( blast intro : divide_right_mono less_imp_le )
thus " bounded_by ( bound_of P / c ) ( \ < lambda > s . P s / c ) " by ( blast )
from assms show " nneg ( \ < lambda > s . P s / c ) "
by ( blast intro : divide_nonneg_pos )
qed
lemma tminus_sound :
assumes sP : " sound P " and nnc : " 0 \ < le > c "
shows " sound ( \ < lambda > s . P s \ < ominus > c ) "
proof ( rule soundI )
from sP have " \ < And > s . P s \ < le > bound_of P " by ( blast )
with nnc have " \ < And > s . P s \ < ominus > c \ < le > bound_of P \ < ominus > c "
by ( blast intro : tminus_left_mono )
thus " bounded ( \ < lambda > s . P s \ < ominus > c ) " by ( blast )
show " nneg ( \ < lambda > s . P s \ < ominus > c ) " by ( blast )
qed
lemma const_sound :
" 0 \ < le > c \ < Longrightarrow > sound ( \ < lambda > s . c ) "
by ( blast )
lemma sound_o [ intro , simp ] :
" sound P \ < Longrightarrow > sound ( P o f ) "
unfolding o_def by ( blast )
lemma sc_bounded_by [ intro , simp ] :
" \ < lbrakk > sound P ; 0 \ < le > c \ < rbrakk > \ < Longrightarrow > bounded_by ( c * bound_of P ) ( \ < lambda > x . c * P x ) "
by ( blast intro ! : mult_left_mono )
lemma sc_bounded [ intro , ] :
sP : " P and pos " 0 < le > "
shows " bounded ( \ < lambda > x . c * P x ) "
using assms by ( blast )
lemma
assumes sP : " ound
and cnn : 0 < c "
shows c bound_of P = bound_of ( lambda x . c * P x ) "
proof ( cases " c = 0 " )
case True then show ? thesis ( simp )
next
case False with cnn have cpos : " 0 < c " by ( auto )
show ? thesis
proof ( rule antisym )
from sP and cnn have " bounded ( \ < lambda > x . c * P x ) " by ( simp )
hence " \ < And > x . c * P x \ < le > bound_of ( \ < lambda > x . c * P x ) java.lang.StringIndexOutOfBoundsException: Index 65 out of bounds for length 65
by ( rule le_bound_of )
with cpos have " \ < And > x . P x \ < le > inverse from assms show " ( \ < > s . P s / ) java.lang.StringIndexOutOfBoundsException: Index 46 out of bounds for length 46
hence " bound_of P \ < le > inverse c * bound_of (
by ( blast ) blast ntro ro mult_left_mono _ t_mono no
with cpos show " * bound_of P \ > bound_of ( \ < lambda > x . c * P x ) "
intro : )
next
from sP and cpos have " \ < And > x . c by ( intro mult_div_mono_right )
by blast intro : ult_left_mono less_imp_le
thus " bound_of ( \ < lambda > x . c * P x ) \ " < > sound P ; 0 \ c \ < rbrakk > \ < Longrightarrow > sound \ > s . s
by ( blast )
qed
qed
lemma sc_sound :
" \ < lbrakk > sound P 0 \ le c \ rbrakk \ Longrightarrow > sound (
by ( blast intro : mult_nonneg_nonneg )
lemma
assumes sP : " sound P " and bP : " bounded_by a P "
and sQ : " d and " bounded_by _ y Q "
shows " bounded_by ) < lambda > . * s )
using assms by ( intro bounded_byI , auto intro : mult_mono )
lemma bounded_by_add :
fixes P : : " ' s \ < Rightarrow > real " and Q
bP bounded_by a
and bQ : " bounded_by b Q "
shows " bounded_by ( a + b ) ( \ < lambda > s . P s + Q s ) "
using assms by ( intro bounded_byI uto ntro o dd_mono no )
emma _ it ! simp mp :
" sound ( \ < lambda > s . 1 ) "
by ( auto )
lemma unit_mult [ intro ] :
assumes sP : " sound P " and bP : " bounded_by 1 lemma bed_ge_0 ge_0 p ntro
and sQ : " sound Q " and bQ : " bounded_by 1 Q "
shows " bounded_by 1 ( \ < lambda > s . s * s
proof < uillemotleft P \ < guillemotright > o f = \ < guillemotleft > P o f \ < guillemotright > "
have " P s * Q s \ < le > 1 * 1 "
using assms by ( blast dest : bounded_by_mult )
thus " P s * Q s \ < le > 1 y imp
qed
lemma sum_sound :
assumes sP : " \ < forall ll < in > . d x "
shows " sound ( \ < lambda > s . \ < Sum > x S . P x s ) "
proof ( rule soundI2 )
from sP show " bounded_by ( \ < Sum > x \ < in > S . bound_of ( P x ) ) ( \ < lambda > s . \ < Sum > x \ < in > S . P x s ) "
by tro : um_mono
< tturnstile > \ Longrightarrow > s le Q s "
by ( auto intro ! : sum_nonneg )
qed
subsection \ < open > Unitary expectations \ < close >
text \ < open > A unitary expectation is a sound expectation that is additionally bounded ne java.lang.StringIndexOutOfBoundsException: Index 99 out of bounds for length 99
is the
definition unitary : : " ' s expect \ < Rightarrow > bool "
where " unitary P < longleftrightarrow > sound \ and bounded_by 1 P "
lemma unitaryI [ intro ] :
" \ < lbrakk > sound P ; bounded_by 1 \ rbrakk > \ < < Longrightarrow > unitary P "
by mp add ry_def _ def
lemma
" \ < lbrakk > nneg P ; bounded_by 1 P \ < rbrakk > \ < unitary P "
by ( auto
lemma unitary_sound [ dest ] :
" unitary P \ < Longrightarrow > ses \ le > d " ,
by ( simp add : unitary_def )
lemma emma unitary_bound tary_bound ound est
" unitary P \ < Longrightarrow > bounded_by 1 P "
by ( p add ary_def
subsection \ < open > Standard Expectations \ < close >
text_raw \ < open > \ label { s : standard } \ < close >
definition
ed_bool _ : ( \ Rightarrow > ) < > ' s \ < Rightarrow > real " ( \ < open > \ < guillemotleft > _ \ < guillemotright > < > 1000 )
where
" \ < guillemotleft > P \ < guillemotright > \ < equiv > ( \ < lambda > s . if P s then 1 else 0 ) "
text < open > Standard xpectations ctations ations are e embeddings ddings oolean redicates mapping { rm se
and @ { term True } to 1 . We write @ { term " \ < guillemotleft > P \ < guillemotright > ther han { m " the he syntax mployed
\ < ^ citet > \ < open > " McIver_M_04 " close ) for boolean embedding to avoid clashing with the HOL syntax for lists . \ < close >
lemma embed_bool_nneg [ simp , intro ] :
" nneg \ guillemotleft P \ < guillemotright > "
unfolding embed_bool_def by ( force )
lemma embed_bool_bounded_by_1 [ simp , intro ] :
" bounded_by 1 \ < guillemotleft >
unfolding embed_bool_def by ( force )
lemma embed_bool_bounded [ simp , intro ] :
" bounded \ < guillemotleft > P \ < guillemotright > "
by ( blast )
text \ < open > Standard expectations have a number of convenient properties , which mostly follow from
boolean algebra . \ < close >
lemma embed_bool_idem :
" \ guillemotleft > P \ < guillemotright > s * \ < guillemotleft > P \ < guillemotright > s = \ < guillemotleft > P \ < guillemotright > s "
by ( simp add : embed_bool_def )
lemma eval_embed_true [ simp ] :
" P s \ < Longrightarrow def pconj_def nj_def f .
by ( simp add : embed_bool_def )
lemma eval_embed_false [ simp ] :
" \ < not > P s \ < Longrightarrow > \ < guillemotleft > P \ < guillemotright >
by add mbed_bool_def bool_def _ ef )
lemma using bQ by ast ntro ntisym ym
" 0 \ < le > \ < guillemotleft > G \ < guillemotright > s "
by ( simp add : embed_bool_def )
lemma embed_le_1 [ simp , intro ] :
" \ < guillemotleft > G \ < guillemotright > s \ < le > 1 "
by ( simp add : unitary_const ff :
lemma embed_le_1_alt [ simp , intro ] :
" 0 \ < le > 1 - \ < guillemotleft > G \ < guillemotright s
by ( subst add_le_cancel_right \ < > \ < guillemotright > s " , symmetric ] , simp )
lemma expect_1_I :
" P x \ < Longrightarrow > 1 \ < le > \ < guillemotleft > P \ < guillemotright > x "
by ( simp )
lemma standard_sound [ intro , simp ] :
" sound \ < guillemotleft > P \ < guillemotright > "
by ( blast )
lemma embed_o [ simp ] :
" \ < guillemotleft > P \ < guillemotright > o f = \ < guillemotleft > P o f \ < guillemotright > "
unfolding embed_bool_def o_def by ( simp )
text \ < open > Negating a predicate has the expected effect in its
embedding as an expectation : \ < close >
definition negate : : " ( ' s \ < Rightarrow > bool ) \ < Rightarrow > ' s \ < Rightarrow > bool " ( \ < open > \ < N > \ < close > )
where " negate P = ( \ < lambda > s . \ < not > P s ) "
lemma negateI :
" \ < not > P s \ < Longrightarrow > \ < N > P s "
by ( simp add : negate_def )
lemma embed_split :
" f s = \ < guillemotleft > P \ < guillemotright > s * f s + \ < guillemotleft > \ < N > P \ < guillemotright > s * f s "
by ( simp add : negate_def embed_bool_def )
lemma negate_embed :
" \ < guillemotleft > \ < N > P \ < guillemotright > s = 1 - \ < guillemotleft > P \ < guillemotright > s "
by ( simp add : embed_bool_def negate_def )
lemma eval_nembed_true [ simp ] :
" P s \ < Longrightarrow > \ < guillemotleft > \ < N > P \ < guillemotright > s = 0 "
by ( simp add : embed_bool_def negate_def )
lemma eval_nembed_false [ simp ] :
" \ < not > P s \ < Longrightarrow > \ < guillemotleft > \ < N > P \ < guillemotright > s = 1 "
by ( simp add : embed_bool_def negate_def )
lemma negate_Not [ simp ] :
" \ < N > Not = ( \ < lambda > x . x ) "
by ( simp add : negate_def )
lemma negate_negate [ simp ] :
" \ < N > ( \ < N > P ) = P "
by ( simp add : negate_def )
lemma embed_bool_cancel :
" \ < guillemotleft > G \ < guillemotright > s * \ < guillemotleft > \ < N > G \ < guillemotright > s = 0 "
by ( cases " G s " , simp_all )
subsection \ < open > Entailment \ < close >
text_raw \ < open > \ label { s : entailment } \ < close >
text \ < open > Entailment on expectations is a generalisation of that on predicates , and is defined by
pointwise comparison : \ < close >
: ( ' \ < htarrow > < ( ' s \ < Rightarrow > real ) \ < Rightarrow > bool " ( \ < open > _ \ < tturnstile > _ \ < close > 50 java.lang.StringIndexOutOfBoundsException: Index 144 out of bounds for length 144
where
lemma entailsI [ intro ] :
bounded_byD [ dest ] :
by ( simp add : le_funI
lemma entailsD dest :
" P \ < tturnstile > Q \ < Longrightarrow > P s \ < le > Q s "
by ( simp add : le_funD )
lemma ma q_entails ntails tro ]
" P = Q \ < Longrightarrow > P \ < tturnstile > Q "
by ( blast )
" ound_of_def ef
by ( blast intro : order_trans )
text \ < open > For standard expectations , both notions of entailment coincide . This result justifies he
above claim that our definition generalises predicate entailment : \ < close >
lemma implies_entails :
" \ < lbrakk > \ < And > s P \ Longrightarrow Q s \ < rbrakk > \ < Longrightarrow > \ < guillemotleft > < guillemotright > \ < tturnstile \ guillemotleft Q \ < guillemotright > "
by ( rule entailsI , case_tac " P s " , simp_all )
lemma entails_implies :
" \ < And > s . \ < lbrakk > \ < guillemotleft > P \ < guillemotright > \ < tturnstile > \ < guillemotleft < guillemotright > ; P s \ < rbrakk > \ < Longrightarrow > s
by ( rule ccontr , drule_tac s = s in entailsD , simp )
subsection < open > Expectation Conjunction \ < close >
definition
: " < > eal \ ightarrow real " ( infixl \ < open > . & \ < close > 71 )
where
" p \ < p + q \ < ominus > 1 "
definition
exp_conj : : " ( ' s \ < Rightarrow > real ) \ < Rightarrow > ( ' s < > eal > ( ' s \ < Rightarrow > real ) " ( infixl \ < open > &span>& \ < close > 71 )
where sound_o [ intro , simp :
text using
the expected properties are preserved True en show thesis ( simp mp
simplifier in case f ssociativity and mmutativity < >
lemma ( last
" b \ < le > 1 \ < Longrightarrow > 0 . & b = java.lang.StringIndexOutOfBoundsException: Index 6 out of bounds for length 6
by ( simp add : pconj_def tminus_def )
lemma pconj_rzero [ intro , simp ] :
" b \ < le > 1 \ < Longrightarrow > b . & 0 = java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
by ( simp add : pconj_def tminus_def )
lemma pconj_lone [ intro simp :
" 0 < le > b \ < Longrightarrow > 1 . & b = b "
by ( simp add : pconj_def tminus_def )
lemma pconj_rone [ intro , simp ] :
" 0 \ < le > b \ < Longrightarrow rightarrow htarrow . "
by ( simp add : pconj_def tminus_def )
lemma pconj_bconj :
" \ < guillemotleft > a \ < guillemotright > s . & \ < guillemotleft > b guillemotright s = \ < guillemotleft > \ < lambda > s . a s \ < and > b s \ < guillemotright > s "
lemma pconj_comm [ ac_simps ] :
" a
by ( simp add : pconj_def ac_simps )
lemma pconj_assoc :
" \ < lbrakk > 0 \ < le > a ; a \ < le > 1 ; 0 \ < le > b ; negate : < > bool ) \ < Rightarrow > ' s \ < Rightarrow > bool " ( \ < open > \ < N > \ < close > )
a . & ( b . & c ) = ( a . & b ) . & c "
unfolding ol_cancel cancel el :
lemma pconj_mono :
" \ < lbrakk > a \ < le > b ; c \ < le > d \ < rbrakk > \ < Longrightarrow > a . & c \ < le > b . & d "
unfolding pconj_def tminus_def by ( simp )
lemma pconj_nneg [ intro , simp " P \ tturnstile Q \ < Longrightarrow > P s \ < le > Q s "
" 0 \ < le > a . & b "
ng conj_def f tminus_def by auto
lemma min_pconj :
" ( min a b ) . & ( min c d ) \ < le > min ( a . & c ) ( b . & d ) "
by ( cases " a \ < le > b " ,
( cases " c \ < le > d " ,
simp_all add : min . absorb1 min . absorb2 pconj_mono ) [ ] ,
( cases " c \ < le > d " ,
simp_all add : min . absorb1 min . absorb2 pconj_mono ) )
lemma ma j_less_one ess_one one mp
" a + b < Longrightarrow > b 0 java.lang.StringIndexOutOfBoundsException: Index 42 out of bounds for length 42
unfolding pconj_def by ( simp )
lemma pconj_ge_one [ simp ] :
" \ > + < Longrightarrow a . & b = a + b - 1 "
unfolding pconj_def by ( simp )
lemma pconj_idem [ simp ] :
" \ < guillemotleft > P \ < guillemotright > s simp_all : n sorb1 bsorb2 rb2 pconj_mono ono o
unfolding pconj_def by ( cases " P s " ,
subsection < > ules Involving Conjunction . \ < close >
lemma exp_conj_mono_left :
" P \ < tturnstile > Q \ < Longrightarrow tturnstile R \ < Longrightarrow > P & & Q \ < tturnstile > P & & R "
unfolding exp_conj_def conj_def j_def def f
by ( auto intro : tminus_left_mono add_right_mono )
lemma rom assms ave \ e > Q s " by ( blast )
> R \ < Longrightarrow > P & & Q \ < tturnstile > P & & R "
unfolding exp_conj_def pconj_def
by ( auto intro : tminus_left_mono add_left_mono )
lemma exp_conj_comm [ ac_simps ] :
" a & & b = b & & a "
by ( simp add : exp_conj_def ac_simps )
lemma exp_conj_bounded_by [ intro , simp ] :
assumes bP : " bounded_by 1 P "
and bQ : " bounded_by 1 Q "
shows " bounded_by 1 ( P & & Q ) "
proof d_byI unfold xp_conj_def nj_def
nd s_Q sound d Q "
from P ave P < > 1 " by ( blast )
moreover from bQ have " Q x \ < le > 1 " by ( blast )
ultimately have " P x + Q x \ < le > 2 " show " neg ( lambda > s . P s . & Q s ) "
Q \ < 1 \ < le > 1 "
unfolding ding minus_def ef ( imp )
qed
lemma exp_conj_o_distrib [ simp entails_frame
" ( P & & Q ) o f = ( P o f ) & & ( Q o f
unfolding exp_conj_def o_def by ( simp )
lemma p_conj_assoc
assumes " unitary P " and " unitary " and d " unitary "
shows " P & & ( Q & R ) = "
unfolding om m sS have e 0 \ e S s " by ( blast )
proof ( rule ext )
fix s
from assms have " 0 \ < le > P s " by ( blast )
om ssms ave " \ < > Q s " by ( blast )
moreover rom om ssms ave 0 < le R s " by ( blast )
moreover from assms have " P s \ < le > 1 " by ( blast )
moreover from assms have " R s \ < le > tminus_sound d xp_conj_sound sound und
ultimately
show " P s . & ( Q s . & R s ) = ( P s . & Q s ) . & R s "
by ( simp add : pconj_assoc )
qed
lemma exp_conj_top_left [ simp ] :
" sound P \ < Longrightarrow > \ < guillemotleft > \ < lambda > _ . True \ < guillemotright > & & P = P "
unfolding exp_conj_def by ( force )
lemma exp_conj_top_right [ simp ] :
" sound P \ < Longrightarrow > P & & \ < guillemotleft > \ < lambda > _ . True \ < guillemotright > = P "
unfolding exp_conj_def by ( force )
lemma exp_conj_idem [ simp ] :
" \ < guillemotleft > P \ < guillemotright > & & \ < guillemotleft > P \ < guillemotright > = \ < guillemotleft > P \ < guillemotright > "
unfolding exp_conj_def
by ( rule ext , cases " P s " , simp_all )
lemma exp_conj_nneg [ intro , simp ] :
" ( \ < lambda > s . 0 ) \ < le > P & & Q "
unfolding exp_conj_def
by ( blast intro : le_funI )
lemma exp_conj_sound [ intro , simp ] :
assumes s_P : " sound P "
and s_Q : " sound Q "
shows " sound ( P & & Q ) "
unfolding exp_conj_def
proof ( rule soundI )
from s_P and s_Q have " \ < And > s . 0 \ < le > P s + Q s " by ( blast intro : add_nonneg_nonneg )
hence " \ < And > s . P s . & Q s \ < le > P s + Q s "
unfolding pconj_def by ( force intro : tminus_less )
also from assms have " \ < And > s . . . . s \ < le > bound_of P + bound_of Q "
by ( blast intro : add_mono )
finally have " bounded_by ( bound_of P + bound_of Q ) ( \ < lambda > s . P s . & Q s ) "
by ( blast )
thus " bounded ( \ < lambda > s . P s . & Q s ) " by ( blast )
show " nneg ( \ < lambda > s . P s . & Q s ) "
unfolding pconj_def tminus_def by ( force )
qed
lemma exp_conj_rzero [ simp ] :
" bounded_by 1 P \ < Longrightarrow > P & & ( \ < lambda > s . 0 ) = ( \ < lambda > s . 0 ) "
unfolding exp_conj_def by ( force )
lemma exp_conj_1_right [ simp ] :
assumes nn : " nneg A "
shows " A & & ( \ < lambda > _ . 1 ) = A "
unfolding exp_conj_def pconj_def tminus_def
proof ( rule ext , simp )
fix s
from nn have " 0 \ < le > A s " by ( blast )
thus " max ( A s ) 0 = A s " by ( force )
qed
lemma exp_conj_std_split :
" \ < guillemotleft > \ < lambda > s . P s \ < and > Q s \ < guillemotright > = \ < guillemotleft > P \ < guillemotright > &pan>& \ < guillemotleft > Q \ < guillemotright > "
unfolding exp_conj_def embed_bool_def pconj_def
by ( auto )
subsection \ < open > Rules Involving Entailment and Conjunction Together \ < close >
text \ < open > Meta - conjunction distributes over expectaton entailment ,
becoming expectation conjunction : \ < close >
lemma entails_frame :
assumes ePR : " P \ < tturnstile > R "
and eQS : " Q \ < tturnstile > S "
shows " P & & Q \ < tturnstile > R & & S "
proof ( rule le_funI )
fix s
from ePR have " P s \ < le > R s " by ( blast )
moreover from eQS have " Q s \ < le > S s " by ( blast )
ultimately have " P s + Q s \ < le > R s + S s " by ( rule add_mono )
hence " P s + Q s \ < ominus > 1 \ < le > R s + S s \ < ominus > 1 " by ( rule tminus_left_mono )
thus " ( P & & Q ) s \ < le > ( R & & S ) s "
unfolding exp_conj_def pconj_def .
qed
text \ < open > This rule allows something very much akin to a case distinction
on the pre - expectation . \ < close >
lemma pentails_cases :
assumes PQe : " \ < And > x . P x \ < tturnstile > Q x "
and exhaust : " \ < And > s . \ < exists > x . P ( x s ) s = 1 "
and framed : " \ < And > x . P x & & R \ < tturnstile > Q x & & S "
and sR : " sound R " and sS : " sound S "
and bQ : " \ < And > x . bounded_by 1 ( Q x ) "
shows " R \ < tturnstile > S "
proof ( rule le_funI )
fix s
from exhaust obtain x where P_xs : " P x s = 1 " by ( blast )
moreover {
hence " 1 = P x s " by ( simp )
also from PQe have " P x s \ < le > Q x s " by ( blast dest : le_funD )
finally have " Q x s = 1 "
using bQ by ( blast intro : antisym )
}
moreover note le_funD [ OF framed [ where x = x ] , where x = s ]
moreover from sR have " 0 \ < le > R s " by ( blast )
moreover from sS have " 0 \ < le > S s " by ( blast )
ultimately show " R s \ < le > S s " by ( simp add : exp_conj_def )
qed
lemma unitary_bot [ iff ] :
" unitary ( \ < lambda > s . 0 : : real ) "
by ( auto )
lemma unitary_top [ iff ] :
" unitary ( \ < lambda > s . 1 : : real ) "
by ( auto )
lemma unitary_embed [ iff ] :
" unitary \ < guillemotleft > P \ < guillemotright > "
by ( auto )
lemma unitary_const [ iff ] :
" \ < lbrakk > 0 \ < le > c ; c \ < le > 1 \ < rbrakk > \ < Longrightarrow > unitary ( \ < lambda > s . c ) "
by ( auto )
lemma unitary_mult :
assumes uA : " unitary A " and uB : " unitary B "
shows " unitary ( \ < lambda > s . A s * B s ) "
proof ( intro unitaryI2 nnegI bounded_byI )
fix s
from assms have nnA : " 0 \ < le > A s " and nnB : " 0 \ < le > B s " by ( auto )
thus " 0 \ < le > A s * B s " by ( rule mult_nonneg_nonneg )
from assms have " A s \ < le > 1 " and " B s \ < le > 1 " by ( auto )
with nnB have " A s * B s \ < le > 1 * 1 " by ( intro mult_mono , auto )
also have " . . . = 1 " by ( simp )
finally show " A s * B s \ < le > 1 " .
qed
lemma exp_conj_unitary :
" \ < lbrakk > unitary P ; unitary Q \ < rbrakk > \ < Longrightarrow > unitary ( P & & Q ) "
by ( intro unitaryI2 nnegI2 , auto )
lemma unitary_comp [ simp ] :
" unitary P \ < Longrightarrow > unitary ( P o f ) "
by ( intro unitaryI2 nnegI bounded_byI , auto simp : o_def )
lemmas unitary_intros =
unitary_bot unitary_top unitary_embed unitary_mult exp_conj_unitary
unitary_comp unitary_const
lemmas sound_intros =
mult_sound div_sound const_sound sound_o sound_sum
tminus_sound sc_sound exp_conj_sound sum_sound
end
Messung V0.5 in Prozent C=71 H=95 G=83
¤ Dauer der Verarbeitung: 0.46 Sekunden
¤
*© Formatika GbR, Deutschland