423 |
423 |
424 subsection{*Specialized Methods for Possibility Theorems*} |
424 subsection{*Specialized Methods for Possibility Theorems*} |
425 |
425 |
426 ML |
426 ML |
427 {* |
427 {* |
428 val Nonce_supply = thm "Nonce_supply"; |
428 (*Tactic for possibility theorems*) |
429 |
429 fun possibility_tac ctxt = |
430 (*Tactic for possibility theorems (Isar interface)*) |
|
431 fun gen_possibility_tac ss state = state |> |
|
432 REPEAT (*omit used_Says so that Nonces start from different traces!*) |
430 REPEAT (*omit used_Says so that Nonces start from different traces!*) |
433 (ALLGOALS (simp_tac (ss delsimps [used_Says])) |
431 (ALLGOALS (simp_tac (local_simpset_of ctxt delsimps [used_Says])) |
434 THEN |
432 THEN |
435 REPEAT_FIRST (eq_assume_tac ORELSE' |
433 REPEAT_FIRST (eq_assume_tac ORELSE' |
436 resolve_tac [refl, conjI, Nonce_supply])) |
434 resolve_tac [refl, conjI, @{thm Nonce_supply}])) |
437 |
|
438 (*Tactic for possibility theorems (ML script version)*) |
|
439 fun possibility_tac state = gen_possibility_tac (simpset()) state |
|
440 |
435 |
441 (*For harder protocols (such as Recur) where we have to set up some |
436 (*For harder protocols (such as Recur) where we have to set up some |
442 nonces and keys initially*) |
437 nonces and keys initially*) |
443 fun basic_possibility_tac st = st |> |
438 fun basic_possibility_tac ctxt = |
444 REPEAT |
439 REPEAT |
445 (ALLGOALS (asm_simp_tac (simpset() setSolver safe_solver)) |
440 (ALLGOALS (asm_simp_tac (local_simpset_of ctxt setSolver safe_solver)) |
446 THEN |
441 THEN |
447 REPEAT_FIRST (resolve_tac [refl, conjI])) |
442 REPEAT_FIRST (resolve_tac [refl, conjI])) |
448 *} |
443 *} |
449 |
444 |
450 method_setup possibility = {* |
445 method_setup possibility = {* |
451 Method.ctxt_args (fn ctxt => |
446 Method.ctxt_args (fn ctxt => |
452 Method.SIMPLE_METHOD (gen_possibility_tac (local_simpset_of ctxt))) *} |
447 Method.SIMPLE_METHOD (possibility_tac ctxt)) *} |
453 "for proving possibility theorems" |
448 "for proving possibility theorems" |
454 |
449 |
|
450 method_setup basic_possibility = {* |
|
451 Method.ctxt_args (fn ctxt => |
|
452 Method.SIMPLE_METHOD (basic_possibility_tac ctxt)) *} |
|
453 "for proving possibility theorems" |
|
454 |
455 end |
455 end |