theory Gvf_Example_BW4T imports Gvf_Agent_Specification begin section \Example BW4T single agent specification.\ \ \Proof of concept. Only part of the specification is included so far and proofs are missing. Mainly due to the temporal logic layer still missing.\ \ \Set up agent specification-\ \ \Propositions:\ abbreviation \in_dropzone::\\<^sub>L \ Atom 0\ abbreviation \in_room::\\<^sub>L \ Atom 1\ abbreviation \collect_red::\\<^sub>L \ Atom 2\ \ \Actions:\ abbreviation \goto_dropzone_Bcap \ 0::nat\ abbreviation \goto_dropzone \ basic goto_dropzone_Bcap\ abbreviation \goto_room_Bcap \ 1::nat\ abbreviation \goto_room::cap \ basic goto_room_Bcap\ \ \Specification of the program:\ abbreviation \\\<^sub>x \ { (B in_dropzone) \ do goto_room }\ abbreviation \M\<^sub>0\<^sub>x \ ( { in_dropzone }, { collect_red } )\ abbreviation \S\<^sub>x \ [(goto_room_Bcap, \\<^sub>M, [\<^bold>{ B in_dropzone \<^bold>} goto_room \<^bold>{ B in_room \<^bold>}])]\ \ \Prove that the example is an instance of the single agent program locale.\ \ \We use a trick where \ is simply some function that complies to our definition due to Hilbert's epsilon operator i.e. the axiom of choice.\ interpretation example: single_agent_program \SOME \. complies S\<^sub>x \\ \\<^sub>x M\<^sub>0\<^sub>x S\<^sub>x proof - let ?\ = \SOME \. complies S\<^sub>x \\ (* This could be harder to proof than suggested since S\<^sub>x here has one element *) have satisfiable: \satisfiable S\<^sub>x\ unfolding satisfiable_def proof fix M let ?n = \goto_room_Bcap\ and ?\ = \\\<^sub>M\ and ?hts = \[\<^bold>{ B in_dropzone \<^bold>} goto_room \<^bold>{ B in_room \<^bold>}]\ let ?sat_hts = \{ht \ set ?hts. M \\<^sub>M pre ht }\ have \\M'. M' \\<^sub>M (B in_room) \ \ fst M' \\<^sub>L \\<^sub>L\ proof - have \({in_room}, {}) \\<^sub>M B in_room\ by simp moreover have \\ fst ({in_room}, {}) \\<^sub>L \\<^sub>L\ by auto ultimately show ?thesis by blast qed then have \(M \\<^sub>M ?\ \ (\\'. (\ fst M \\<^sub>L \\<^sub>L \ \ \' \\<^sub>L \\<^sub>L) \ (let \' = snd M - {\ \ snd M. \' \\<^sub>L \} in (\ht \ ?sat_hts. (\', \') \\<^sub>M post ht)))) \ (M \\<^sub>M \<^bold>\ ?\ \ (\ht\?sat_hts. M \\<^sub>M post ht))\ by auto then show \\s\set S\<^sub>x. let (_, \, hts) = s; sat_hts = {ht \ set hts. M \\<^sub>M pre ht} in (M \\<^sub>M \ \ (\M'. (\ fst M \\<^sub>L \\<^sub>L \ \ fst M' \\<^sub>L \\<^sub>L) \ (snd M' = snd M - {\ \ snd M. fst M' \\<^sub>L \}) \ (\ht \ sat_hts. M' \\<^sub>M post ht))) \ (M \\<^sub>M \<^bold>\ \ \ (\ht\sat_hts. M \\<^sub>M post ht))\ by simp qed then have s: \is_ht_specification S\<^sub>x\ unfolding is_ht_specification_def by simp then have c: \complies S\<^sub>x ?\\ using model_exists by (simp add: someI2_ex) show \single_agent_program ?\ \\<^sub>x M\<^sub>0\<^sub>x S\<^sub>x\ proof have \\ M\<^sub>0\<^sub>x\ proof - have \\ {in_dropzone} \\<^sub>L \\<^sub>L\ by auto moreover have \in_dropzone \ collect_red\ by simp with neq_atom_not_entail have \\ {in_dropzone} \\<^sub>L collect_red\ by metis moreover have \\ {} \\<^sub>L \<^bold>\ in_dropzone\ by auto ultimately show ?thesis unfolding is_mental_state_def by auto qed then show \\\<^sub>x \ {} \ \ M\<^sub>0\<^sub>x\ by simp next fix \ \ n show \(\\. (\, basic n) \ \\<^sub>x) \ \ \ \\<^sub>L \\<^sub>L \ ?\ n (\, \) \ None \ \ the (?\ n (\, \)) \\<^sub>L \\<^sub>L\ proof assume \\\. (\, basic n) \ \\<^sub>x\ from c have \\s\set S\<^sub>x. complies_hts s ?\\ unfolding complies_def by simp then have \\s\set S\<^sub>x. \ht\set (snd (snd s)). complies_ht (\, \) ?\ (fst (snd s)) (the (htb_basic_unpack ht))\ unfolding complies_hts_def by blast moreover have \\s\set S\<^sub>x. \ht\set (snd (snd s)). fst s = (fst (snd ((the (htb_basic_unpack ht)))))\ by simp ultimately have \\s\set S\<^sub>x. \ht\set (snd (snd s)). \ \ \\<^sub>L \\<^sub>L \ ?\ (fst s) (\, \) \ None \ \the (?\ (fst s) (\, \)) \\<^sub>L \\<^sub>L\ by simp then have \\s\set S\<^sub>x. \ \ \\<^sub>L \\<^sub>L \ ?\ (fst s) (\, \) \ None \ \the (?\ (fst s) (\, \)) \\<^sub>L \\<^sub>L\ by simp with \\\. (\, basic n) \ \\<^sub>x\ show \\ \ \\<^sub>L \\<^sub>L \ ?\ n (\, \) \ None \ \ the (?\ n (\, \)) \\<^sub>L \\<^sub>L\ by simp qed next fix n M have *: \n \ set (map fst S\<^sub>x) \ (\M. ?\ n M = None)\ using c unfolding complies_def by simp then have \n \ set (map fst S\<^sub>x) \ ?\ n M = None\ by blast show \?\ n M \ None \ (\\. (\, basic n) \ \\<^sub>x)\ proof assume \?\ n M \ None\ then have \n \ set (map fst S\<^sub>x)\ using * by metis then show \\\. (\, basic n) \ \\<^sub>x\ by simp qed next show \is_ht_specification S\<^sub>x\ using s . show \complies S\<^sub>x ?\\ using c . qed qed end