src/Benchmarks/Quickcheck_Benchmark/Needham_Schroeder_Base.thy
changeset 62290 658276428cfc
parent 62286 705d4c4003ea
child 66453 cc19f7ca2ed6
equal deleted inserted replaced
62289:ffb2743ae0b9 62290:658276428cfc
   106                      (case ev of
   106                      (case ev of
   107                         Says A B X => parts {X} \<union> used evs
   107                         Says A B X => parts {X} \<union> used evs
   108                       | Gets A X   => used evs
   108                       | Gets A X   => used evs
   109                       | Notes A X  => parts {X} \<union> used evs)"
   109                       | Notes A X  => parts {X} \<union> used evs)"
   110 
   110 
   111 subsection {* Preparations for sets *}
   111 subsection \<open>Preparations for sets\<close>
   112 
   112 
   113 fun find_first :: "('a => 'b option) => 'a list => 'b option"
   113 fun find_first :: "('a => 'b option) => 'a list => 'b option"
   114 where
   114 where
   115   "find_first f [] = None"
   115   "find_first f [] = None"
   116 | "find_first f (x # xs) = (case f x of Some y => Some y | None => find_first f xs)"
   116 | "find_first f (x # xs) = (case f x of Some y => Some y | None => find_first f xs)"
   138 
   138 
   139 lemma
   139 lemma
   140   [code]: "neg_cps_of_set (set xs) f i = find_first' f xs"
   140   [code]: "neg_cps_of_set (set xs) f i = find_first' f xs"
   141 sorry
   141 sorry
   142 
   142 
   143 setup {*
   143 setup \<open>
   144 let
   144 let
   145   val Fun = Predicate_Compile_Aux.Fun
   145   val Fun = Predicate_Compile_Aux.Fun
   146   val Input = Predicate_Compile_Aux.Input
   146   val Input = Predicate_Compile_Aux.Input
   147   val Output = Predicate_Compile_Aux.Output
   147   val Output = Predicate_Compile_Aux.Output
   148   val Bool = Predicate_Compile_Aux.Bool
   148   val Bool = Predicate_Compile_Aux.Bool
   160  
   160  
   161 in
   161 in
   162   Core_Data.force_modes_and_compilations @{const_name Set.member}
   162   Core_Data.force_modes_and_compilations @{const_name Set.member}
   163     [(oi, (of_set, false)), (ii, (member, false))]
   163     [(oi, (of_set, false)), (ii, (member, false))]
   164 end
   164 end
   165 *}
   165 \<close>
   166 
   166 
   167 subsection {* Derived equations for analz, parts and synth *}
   167 subsection \<open>Derived equations for analz, parts and synth\<close>
   168 
   168 
   169 lemma [code]:
   169 lemma [code]:
   170   "analz H = (let
   170   "analz H = (let
   171      H' = H \<union> (\<Union>((%m. case m of \<lbrace>X, Y\<rbrace> => {X, Y} | Crypt K X => if Key (invKey K) : H then {X} else {} | _ => {}) ` H))
   171      H' = H \<union> (\<Union>((%m. case m of \<lbrace>X, Y\<rbrace> => {X, Y} | Crypt K X => if Key (invKey K) : H then {X} else {} | _ => {}) ` H))
   172    in if H' = H then H else analz H')"
   172    in if H' = H then H else analz H')"
   184 
   184 
   185 lemmas [code_pred_intro] = synth.intros[folded synth'_def]
   185 lemmas [code_pred_intro] = synth.intros[folded synth'_def]
   186 
   186 
   187 code_pred [generator_cps] synth' unfolding synth'_def by (rule synth.cases) fastforce+
   187 code_pred [generator_cps] synth' unfolding synth'_def by (rule synth.cases) fastforce+
   188 
   188 
   189 setup {* Predicate_Compile_Data.ignore_consts [@{const_name analz}, @{const_name knows}] *}
   189 setup \<open>Predicate_Compile_Data.ignore_consts [@{const_name analz}, @{const_name knows}]\<close>
   190 declare ListMem_iff[symmetric, code_pred_inline]
   190 declare ListMem_iff[symmetric, code_pred_inline]
   191 declare [[quickcheck_timing]]
   191 declare [[quickcheck_timing]]
   192 
   192 
   193 setup Exhaustive_Generators.setup_exhaustive_datatype_interpretation
   193 setup Exhaustive_Generators.setup_exhaustive_datatype_interpretation
   194 declare [[quickcheck_full_support = false]]
   194 declare [[quickcheck_full_support = false]]