472 AccessViolation) |
472 AccessViolation) |
473 s" |
473 s" |
474 |
474 |
475 section "evaluation judgments" |
475 section "evaluation judgments" |
476 |
476 |
477 consts |
477 inductive2 |
478 eval :: "prog \<Rightarrow> (state \<times> term \<times> vals \<times> state) set" |
478 halloc :: "[prog,state,obj_tag,loc,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>halloc _\<succ>_\<rightarrow> _"[61,61,61,61,61]60) for G::prog |
479 halloc:: "prog \<Rightarrow> (state \<times> obj_tag \<times> loc \<times> state) set" |
479 where --{* allocating objects on the heap, cf. 12.5 *} |
480 sxalloc:: "prog \<Rightarrow> (state \<times> state) set" |
|
481 |
|
482 |
|
483 syntax |
|
484 eval ::"[prog,state,term,vals*state]=>bool"("_|-_ -_>-> _" [61,61,80, 61]60) |
|
485 exec ::"[prog,state,stmt ,state]=>bool"("_|-_ -_-> _" [61,61,65, 61]60) |
|
486 evar ::"[prog,state,var ,vvar,state]=>bool"("_|-_ -_=>_-> _"[61,61,90,61,61]60) |
|
487 eval_::"[prog,state,expr ,val, state]=>bool"("_|-_ -_->_-> _"[61,61,80,61,61]60) |
|
488 evals::"[prog,state,expr list , |
|
489 val list ,state]=>bool"("_|-_ -_#>_-> _"[61,61,61,61,61]60) |
|
490 hallo::"[prog,state,obj_tag, |
|
491 loc,state]=>bool"("_|-_ -halloc _>_-> _"[61,61,61,61,61]60) |
|
492 sallo::"[prog,state ,state]=>bool"("_|-_ -sxalloc-> _"[61,61, 61]60) |
|
493 |
|
494 syntax (xsymbols) |
|
495 eval ::"[prog,state,term,vals\<times>state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>_\<succ>\<rightarrow> _" [61,61,80, 61]60) |
|
496 exec ::"[prog,state,stmt ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<rightarrow> _" [61,61,65, 61]60) |
|
497 evar ::"[prog,state,var ,vvar,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_=\<succ>_\<rightarrow> _"[61,61,90,61,61]60) |
|
498 eval_::"[prog,state,expr ,val ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_-\<succ>_\<rightarrow> _"[61,61,80,61,61]60) |
|
499 evals::"[prog,state,expr list , |
|
500 val list ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<rightarrow> _"[61,61,61,61,61]60) |
|
501 hallo::"[prog,state,obj_tag, |
|
502 loc,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>halloc _\<succ>_\<rightarrow> _"[61,61,61,61,61]60) |
|
503 sallo::"[prog,state, state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>sxalloc\<rightarrow> _"[61,61, 61]60) |
|
504 |
|
505 translations |
|
506 "G\<turnstile>s \<midarrow>t \<succ>\<rightarrow> w___s' " == "(s,t,w___s') \<in> eval G" |
|
507 "G\<turnstile>s \<midarrow>t \<succ>\<rightarrow> (w, s')" <= "(s,t,w, s') \<in> eval G" |
|
508 "G\<turnstile>s \<midarrow>t \<succ>\<rightarrow> (w,x,s')" <= "(s,t,w,x,s') \<in> eval G" |
|
509 "G\<turnstile>s \<midarrow>c \<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit>,x,s')" |
|
510 "G\<turnstile>s \<midarrow>c \<rightarrow> s' " == "G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit> , s')" |
|
511 "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v ,x,s')" |
|
512 "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow> s' " == "G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v , s')" |
|
513 "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In2 e\<succ>\<rightarrow> (In2 vf,x,s')" |
|
514 "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow> s' " == "G\<turnstile>s \<midarrow>In2 e\<succ>\<rightarrow> (In2 vf, s')" |
|
515 "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow> (x,s')" <= "G\<turnstile>s \<midarrow>In3 e\<succ>\<rightarrow> (In3 v ,x,s')" |
|
516 "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow> s' " == "G\<turnstile>s \<midarrow>In3 e\<succ>\<rightarrow> (In3 v , s')" |
|
517 "G\<turnstile>s \<midarrow>halloc oi\<succ>a\<rightarrow> (x,s')" <= "(s,oi,a,x,s') \<in> halloc G" |
|
518 "G\<turnstile>s \<midarrow>halloc oi\<succ>a\<rightarrow> s' " == "(s,oi,a, s') \<in> halloc G" |
|
519 "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> (x,s')" <= "(s ,x,s') \<in> sxalloc G" |
|
520 "G\<turnstile>s \<midarrow>sxalloc\<rightarrow> s' " == "(s , s') \<in> sxalloc G" |
|
521 |
|
522 inductive "halloc G" intros --{* allocating objects on the heap, cf. 12.5 *} |
|
523 |
480 |
524 Abrupt: |
481 Abrupt: |
525 "G\<turnstile>(Some x,s) \<midarrow>halloc oi\<succ>arbitrary\<rightarrow> (Some x,s)" |
482 "G\<turnstile>(Some x,s) \<midarrow>halloc oi\<succ>arbitrary\<rightarrow> (Some x,s)" |
526 |
483 |
527 New: "\<lbrakk>new_Addr (heap s) = Some a; |
484 | New: "\<lbrakk>new_Addr (heap s) = Some a; |
528 (x,oi') = (if atleast_free (heap s) (Suc (Suc 0)) then (None,oi) |
485 (x,oi') = (if atleast_free (heap s) (Suc (Suc 0)) then (None,oi) |
529 else (Some (Xcpt (Loc a)),CInst (SXcpt OutOfMemory)))\<rbrakk> |
486 else (Some (Xcpt (Loc a)),CInst (SXcpt OutOfMemory)))\<rbrakk> |
530 \<Longrightarrow> |
487 \<Longrightarrow> |
531 G\<turnstile>Norm s \<midarrow>halloc oi\<succ>a\<rightarrow> (x,init_obj G oi' (Heap a) s)" |
488 G\<turnstile>Norm s \<midarrow>halloc oi\<succ>a\<rightarrow> (x,init_obj G oi' (Heap a) s)" |
532 |
489 |
533 inductive "sxalloc G" intros --{* allocating exception objects for |
490 inductive2 sxalloc :: "[prog,state,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>sxalloc\<rightarrow> _"[61,61,61]60) for G::prog |
534 standard exceptions (other than OutOfMemory) *} |
491 where --{* allocating exception objects for |
|
492 standard exceptions (other than OutOfMemory) *} |
535 |
493 |
536 Norm: "G\<turnstile> Norm s \<midarrow>sxalloc\<rightarrow> Norm s" |
494 Norm: "G\<turnstile> Norm s \<midarrow>sxalloc\<rightarrow> Norm s" |
537 |
495 |
538 Jmp: "G\<turnstile>(Some (Jump j), s) \<midarrow>sxalloc\<rightarrow> (Some (Jump j), s)" |
496 | Jmp: "G\<turnstile>(Some (Jump j), s) \<midarrow>sxalloc\<rightarrow> (Some (Jump j), s)" |
539 |
497 |
540 Error: "G\<turnstile>(Some (Error e), s) \<midarrow>sxalloc\<rightarrow> (Some (Error e), s)" |
498 | Error: "G\<turnstile>(Some (Error e), s) \<midarrow>sxalloc\<rightarrow> (Some (Error e), s)" |
541 |
499 |
542 XcptL: "G\<turnstile>(Some (Xcpt (Loc a) ),s) \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s)" |
500 | XcptL: "G\<turnstile>(Some (Xcpt (Loc a) ),s) \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s)" |
543 |
501 |
544 SXcpt: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>halloc (CInst (SXcpt xn))\<succ>a\<rightarrow> (x,s1)\<rbrakk> \<Longrightarrow> |
502 | SXcpt: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>halloc (CInst (SXcpt xn))\<succ>a\<rightarrow> (x,s1)\<rbrakk> \<Longrightarrow> |
545 G\<turnstile>(Some (Xcpt (Std xn)),s0) \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s1)" |
503 G\<turnstile>(Some (Xcpt (Std xn)),s0) \<midarrow>sxalloc\<rightarrow> (Some (Xcpt (Loc a)),s1)" |
546 |
504 |
547 |
505 |
548 inductive "eval G" intros |
506 inductive2 |
|
507 eval :: "[prog,state,term,vals,state]\<Rightarrow>bool" ("_\<turnstile>_ \<midarrow>_\<succ>\<rightarrow> '(_, _')" [61,61,80,0,0]60) |
|
508 and exec ::"[prog,state,stmt ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<rightarrow> _" [61,61,65, 61]60) |
|
509 and evar ::"[prog,state,var ,vvar,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_=\<succ>_\<rightarrow> _"[61,61,90,61,61]60) |
|
510 and eval'::"[prog,state,expr ,val ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_-\<succ>_\<rightarrow> _"[61,61,80,61,61]60) |
|
511 and evals::"[prog,state,expr list , |
|
512 val list ,state]\<Rightarrow>bool"("_\<turnstile>_ \<midarrow>_\<doteq>\<succ>_\<rightarrow> _"[61,61,61,61,61]60) |
|
513 for G::prog |
|
514 where |
|
515 |
|
516 "G\<turnstile>s \<midarrow>c \<rightarrow> s' \<equiv> G\<turnstile>s \<midarrow>In1r c\<succ>\<rightarrow> (\<diamondsuit>, s')" |
|
517 | "G\<turnstile>s \<midarrow>e-\<succ>v \<rightarrow> s' \<equiv> G\<turnstile>s \<midarrow>In1l e\<succ>\<rightarrow> (In1 v, s')" |
|
518 | "G\<turnstile>s \<midarrow>e=\<succ>vf\<rightarrow> s' \<equiv> G\<turnstile>s \<midarrow>In2 e\<succ>\<rightarrow> (In2 vf, s')" |
|
519 | "G\<turnstile>s \<midarrow>e\<doteq>\<succ>v \<rightarrow> s' \<equiv> G\<turnstile>s \<midarrow>In3 e\<succ>\<rightarrow> (In3 v, s')" |
549 |
520 |
550 --{* propagation of abrupt completion *} |
521 --{* propagation of abrupt completion *} |
551 |
522 |
552 --{* cf. 14.1, 15.5 *} |
523 --{* cf. 14.1, 15.5 *} |
553 Abrupt: |
524 | Abrupt: |
554 "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<rightarrow> (arbitrary3 t,(Some xc,s))" |
525 "G\<turnstile>(Some xc,s) \<midarrow>t\<succ>\<rightarrow> (arbitrary3 t, (Some xc, s))" |
555 |
526 |
556 |
527 |
557 --{* execution of statements *} |
528 --{* execution of statements *} |
558 |
529 |
559 --{* cf. 14.5 *} |
530 --{* cf. 14.5 *} |
560 Skip: "G\<turnstile>Norm s \<midarrow>Skip\<rightarrow> Norm s" |
531 | Skip: "G\<turnstile>Norm s \<midarrow>Skip\<rightarrow> Norm s" |
561 |
532 |
562 --{* cf. 14.7 *} |
533 --{* cf. 14.7 *} |
563 Expr: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
534 | Expr: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
564 G\<turnstile>Norm s0 \<midarrow>Expr e\<rightarrow> s1" |
535 G\<turnstile>Norm s0 \<midarrow>Expr e\<rightarrow> s1" |
565 |
536 |
566 Lab: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<rightarrow> s1\<rbrakk> \<Longrightarrow> |
537 | Lab: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c \<rightarrow> s1\<rbrakk> \<Longrightarrow> |
567 G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<rightarrow> abupd (absorb l) s1" |
538 G\<turnstile>Norm s0 \<midarrow>l\<bullet> c\<rightarrow> abupd (absorb l) s1" |
568 --{* cf. 14.2 *} |
539 --{* cf. 14.2 *} |
569 Comp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<rightarrow> s1; |
540 | Comp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1 \<rightarrow> s1; |
570 G\<turnstile> s1 \<midarrow>c2 \<rightarrow> s2\<rbrakk> \<Longrightarrow> |
541 G\<turnstile> s1 \<midarrow>c2 \<rightarrow> s2\<rbrakk> \<Longrightarrow> |
571 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<rightarrow> s2" |
542 G\<turnstile>Norm s0 \<midarrow>c1;; c2\<rightarrow> s2" |
572 |
543 |
573 --{* cf. 14.8.2 *} |
544 --{* cf. 14.8.2 *} |
574 If: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1; |
545 | If: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1; |
575 G\<turnstile> s1\<midarrow>(if the_Bool b then c1 else c2)\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
546 G\<turnstile> s1\<midarrow>(if the_Bool b then c1 else c2)\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
576 G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<rightarrow> s2" |
547 G\<turnstile>Norm s0 \<midarrow>If(e) c1 Else c2 \<rightarrow> s2" |
577 |
548 |
578 --{* cf. 14.10, 14.10.1 *} |
549 --{* cf. 14.10, 14.10.1 *} |
579 |
550 |
581 this rule. If a continue jump with the proper label was invoked inside |
552 this rule. If a continue jump with the proper label was invoked inside |
582 @{term c} this label (Cont l) is deleted out of the abrupt component of |
553 @{term c} this label (Cont l) is deleted out of the abrupt component of |
583 the state before the iterative evaluation of the while statement. |
554 the state before the iterative evaluation of the while statement. |
584 A break jump is handled by the Lab Statement @{text "Lab l (while\<dots>)"}. |
555 A break jump is handled by the Lab Statement @{text "Lab l (while\<dots>)"}. |
585 *} |
556 *} |
586 Loop: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1; |
557 | Loop: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>b\<rightarrow> s1; |
587 if the_Bool b |
558 if the_Bool b |
588 then (G\<turnstile>s1 \<midarrow>c\<rightarrow> s2 \<and> |
559 then (G\<turnstile>s1 \<midarrow>c\<rightarrow> s2 \<and> |
589 G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<rightarrow> s3) |
560 G\<turnstile>(abupd (absorb (Cont l)) s2) \<midarrow>l\<bullet> While(e) c\<rightarrow> s3) |
590 else s3 = s1\<rbrakk> \<Longrightarrow> |
561 else s3 = s1\<rbrakk> \<Longrightarrow> |
591 G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<rightarrow> s3" |
562 G\<turnstile>Norm s0 \<midarrow>l\<bullet> While(e) c\<rightarrow> s3" |
592 |
563 |
593 Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<rightarrow> (Some (Jump j), s)" |
564 | Jmp: "G\<turnstile>Norm s \<midarrow>Jmp j\<rightarrow> (Some (Jump j), s)" |
594 |
565 |
595 --{* cf. 14.16 *} |
566 --{* cf. 14.16 *} |
596 Throw: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
567 | Throw: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>a'\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
597 G\<turnstile>Norm s0 \<midarrow>Throw e\<rightarrow> abupd (throw a') s1" |
568 G\<turnstile>Norm s0 \<midarrow>Throw e\<rightarrow> abupd (throw a') s1" |
598 |
569 |
599 --{* cf. 14.18.1 *} |
570 --{* cf. 14.18.1 *} |
600 Try: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2; |
571 | Try: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> s1; G\<turnstile>s1 \<midarrow>sxalloc\<rightarrow> s2; |
601 if G,s2\<turnstile>catch C then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<rightarrow> s3 else s3 = s2\<rbrakk> \<Longrightarrow> |
572 if G,s2\<turnstile>catch C then G\<turnstile>new_xcpt_var vn s2 \<midarrow>c2\<rightarrow> s3 else s3 = s2\<rbrakk> \<Longrightarrow> |
602 G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(C vn) c2\<rightarrow> s3" |
573 G\<turnstile>Norm s0 \<midarrow>Try c1 Catch(C vn) c2\<rightarrow> s3" |
603 |
574 |
604 --{* cf. 14.18.2 *} |
575 --{* cf. 14.18.2 *} |
605 Fin: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1,s1); |
576 | Fin: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>c1\<rightarrow> (x1,s1); |
606 G\<turnstile>Norm s1 \<midarrow>c2\<rightarrow> s2; |
577 G\<turnstile>Norm s1 \<midarrow>c2\<rightarrow> s2; |
607 s3=(if (\<exists> err. x1=Some (Error err)) |
578 s3=(if (\<exists> err. x1=Some (Error err)) |
608 then (x1,s1) |
579 then (x1,s1) |
609 else abupd (abrupt_if (x1\<noteq>None) x1) s2) \<rbrakk> |
580 else abupd (abrupt_if (x1\<noteq>None) x1) s2) \<rbrakk> |
610 \<Longrightarrow> |
581 \<Longrightarrow> |
611 G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<rightarrow> s3" |
582 G\<turnstile>Norm s0 \<midarrow>c1 Finally c2\<rightarrow> s3" |
612 --{* cf. 12.4.2, 8.5 *} |
583 --{* cf. 12.4.2, 8.5 *} |
613 Init: "\<lbrakk>the (class G C) = c; |
584 | Init: "\<lbrakk>the (class G C) = c; |
614 if inited C (globs s0) then s3 = Norm s0 |
585 if inited C (globs s0) then s3 = Norm s0 |
615 else (G\<turnstile>Norm (init_class_obj G C s0) |
586 else (G\<turnstile>Norm (init_class_obj G C s0) |
616 \<midarrow>(if C = Object then Skip else Init (super c))\<rightarrow> s1 \<and> |
587 \<midarrow>(if C = Object then Skip else Init (super c))\<rightarrow> s1 \<and> |
617 G\<turnstile>set_lvars empty s1 \<midarrow>init c\<rightarrow> s2 \<and> s3 = restore_lvars s1 s2)\<rbrakk> |
588 G\<turnstile>set_lvars empty s1 \<midarrow>init c\<rightarrow> s2 \<and> s3 = restore_lvars s1 s2)\<rbrakk> |
618 \<Longrightarrow> |
589 \<Longrightarrow> |
640 convenience. |
611 convenience. |
641 *} |
612 *} |
642 --{* evaluation of expressions *} |
613 --{* evaluation of expressions *} |
643 |
614 |
644 --{* cf. 15.8.1, 12.4.1 *} |
615 --{* cf. 15.8.1, 12.4.1 *} |
645 NewC: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<rightarrow> s1; |
616 | NewC: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init C\<rightarrow> s1; |
646 G\<turnstile> s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
617 G\<turnstile> s1 \<midarrow>halloc (CInst C)\<succ>a\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
647 G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<rightarrow> s2" |
618 G\<turnstile>Norm s0 \<midarrow>NewC C-\<succ>Addr a\<rightarrow> s2" |
648 |
619 |
649 --{* cf. 15.9.1, 12.4.1 *} |
620 --{* cf. 15.9.1, 12.4.1 *} |
650 NewA: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<rightarrow> s2; |
621 | NewA: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>init_comp_ty T\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>i'\<rightarrow> s2; |
651 G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow> |
622 G\<turnstile>abupd (check_neg i') s2 \<midarrow>halloc (Arr T (the_Intg i'))\<succ>a\<rightarrow> s3\<rbrakk> \<Longrightarrow> |
652 G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<rightarrow> s3" |
623 G\<turnstile>Norm s0 \<midarrow>New T[e]-\<succ>Addr a\<rightarrow> s3" |
653 |
624 |
654 --{* cf. 15.15 *} |
625 --{* cf. 15.15 *} |
655 Cast: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1; |
626 | Cast: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1; |
656 s2 = abupd (raise_if (\<not>G,store s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow> |
627 s2 = abupd (raise_if (\<not>G,store s1\<turnstile>v fits T) ClassCast) s1\<rbrakk> \<Longrightarrow> |
657 G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<rightarrow> s2" |
628 G\<turnstile>Norm s0 \<midarrow>Cast T e-\<succ>v\<rightarrow> s2" |
658 |
629 |
659 --{* cf. 15.19.2 *} |
630 --{* cf. 15.19.2 *} |
660 Inst: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1; |
631 | Inst: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1; |
661 b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow> |
632 b = (v\<noteq>Null \<and> G,store s1\<turnstile>v fits RefT T)\<rbrakk> \<Longrightarrow> |
662 G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<rightarrow> s1" |
633 G\<turnstile>Norm s0 \<midarrow>e InstOf T-\<succ>Bool b\<rightarrow> s1" |
663 |
634 |
664 --{* cf. 15.7.1 *} |
635 --{* cf. 15.7.1 *} |
665 Lit: "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<rightarrow> Norm s" |
636 | Lit: "G\<turnstile>Norm s \<midarrow>Lit v-\<succ>v\<rightarrow> Norm s" |
666 |
637 |
667 UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> |
638 | UnOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e-\<succ>v\<rightarrow> s1\<rbrakk> |
668 \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<rightarrow> s1" |
639 \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>UnOp unop e-\<succ>(eval_unop unop v)\<rightarrow> s1" |
669 |
640 |
670 BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<rightarrow> s1; |
641 | BinOp: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e1-\<succ>v1\<rightarrow> s1; |
671 G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip)) |
642 G\<turnstile>s1 \<midarrow>(if need_second_arg binop v1 then (In1l e2) else (In1r Skip)) |
672 \<succ>\<rightarrow> (In1 v2,s2) |
643 \<succ>\<rightarrow> (In1 v2, s2) |
673 \<rbrakk> |
644 \<rbrakk> |
674 \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<rightarrow> s2" |
645 \<Longrightarrow> G\<turnstile>Norm s0 \<midarrow>BinOp binop e1 e2-\<succ>(eval_binop binop v1 v2)\<rightarrow> s2" |
675 |
646 |
676 --{* cf. 15.10.2 *} |
647 --{* cf. 15.10.2 *} |
677 Super: "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<rightarrow> Norm s" |
648 | Super: "G\<turnstile>Norm s \<midarrow>Super-\<succ>val_this s\<rightarrow> Norm s" |
678 |
649 |
679 --{* cf. 15.2 *} |
650 --{* cf. 15.2 *} |
680 Acc: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
651 | Acc: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(v,f)\<rightarrow> s1\<rbrakk> \<Longrightarrow> |
681 G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<rightarrow> s1" |
652 G\<turnstile>Norm s0 \<midarrow>Acc va-\<succ>v\<rightarrow> s1" |
682 |
653 |
683 --{* cf. 15.25.1 *} |
654 --{* cf. 15.25.1 *} |
684 Ass: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<rightarrow> s1; |
655 | Ass: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>va=\<succ>(w,f)\<rightarrow> s1; |
685 G\<turnstile> s1 \<midarrow>e-\<succ>v \<rightarrow> s2\<rbrakk> \<Longrightarrow> |
656 G\<turnstile> s1 \<midarrow>e-\<succ>v \<rightarrow> s2\<rbrakk> \<Longrightarrow> |
686 G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<rightarrow> assign f v s2" |
657 G\<turnstile>Norm s0 \<midarrow>va:=e-\<succ>v\<rightarrow> assign f v s2" |
687 |
658 |
688 --{* cf. 15.24 *} |
659 --{* cf. 15.24 *} |
689 Cond: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<rightarrow> s1; |
660 | Cond: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e0-\<succ>b\<rightarrow> s1; |
690 G\<turnstile> s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
661 G\<turnstile> s1 \<midarrow>(if the_Bool b then e1 else e2)-\<succ>v\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
691 G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<rightarrow> s2" |
662 G\<turnstile>Norm s0 \<midarrow>e0 ? e1 : e2-\<succ>v\<rightarrow> s2" |
692 |
663 |
693 |
664 |
694 -- {* The interplay of @{term Call}, @{term Methd} and @{term Body}: |
665 -- {* The interplay of @{term Call}, @{term Methd} and @{term Body}: |
740 different parts of the typesafety proof can be disentangled a little. *} |
711 different parts of the typesafety proof can be disentangled a little. *} |
741 |
712 |
742 --{* evaluation of variables *} |
713 --{* evaluation of variables *} |
743 |
714 |
744 --{* cf. 15.13.1, 15.7.2 *} |
715 --{* cf. 15.13.1, 15.7.2 *} |
745 LVar: "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<rightarrow> Norm s" |
716 | LVar: "G\<turnstile>Norm s \<midarrow>LVar vn=\<succ>lvar vn s\<rightarrow> Norm s" |
746 |
717 |
747 --{* cf. 15.10.1, 12.4.1 *} |
718 --{* cf. 15.10.1, 12.4.1 *} |
748 FVar: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<rightarrow> s2; |
719 | FVar: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>Init statDeclC\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e-\<succ>a\<rightarrow> s2; |
749 (v,s2') = fvar statDeclC stat fn a s2; |
720 (v,s2') = fvar statDeclC stat fn a s2; |
750 s3 = check_field_access G accC statDeclC fn stat a s2' \<rbrakk> \<Longrightarrow> |
721 s3 = check_field_access G accC statDeclC fn stat a s2' \<rbrakk> \<Longrightarrow> |
751 G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<rightarrow> s3" |
722 G\<turnstile>Norm s0 \<midarrow>{accC,statDeclC,stat}e..fn=\<succ>v\<rightarrow> s3" |
752 --{* The accessibility check is after @{term fvar}, to keep it simple. |
723 --{* The accessibility check is after @{term fvar}, to keep it simple. |
753 @{term fvar} already tests for the absence of a null-pointer reference |
724 @{term fvar} already tests for the absence of a null-pointer reference |
754 in case of an instance field |
725 in case of an instance field |
755 *} |
726 *} |
756 |
727 |
757 --{* cf. 15.12.1, 15.25.1 *} |
728 --{* cf. 15.12.1, 15.25.1 *} |
758 AVar: "\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<rightarrow> s2; |
729 | AVar: "\<lbrakk>G\<turnstile> Norm s0 \<midarrow>e1-\<succ>a\<rightarrow> s1; G\<turnstile>s1 \<midarrow>e2-\<succ>i\<rightarrow> s2; |
759 (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow> |
730 (v,s2') = avar G i a s2\<rbrakk> \<Longrightarrow> |
760 G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<rightarrow> s2'" |
731 G\<turnstile>Norm s0 \<midarrow>e1.[e2]=\<succ>v\<rightarrow> s2'" |
761 |
732 |
762 |
733 |
763 --{* evaluation of expression lists *} |
734 --{* evaluation of expression lists *} |
764 |
735 |
765 --{* cf. 15.11.4.2 *} |
736 --{* cf. 15.11.4.2 *} |
766 Nil: |
737 | Nil: |
767 "G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<rightarrow> Norm s0" |
738 "G\<turnstile>Norm s0 \<midarrow>[]\<doteq>\<succ>[]\<rightarrow> Norm s0" |
768 |
739 |
769 --{* cf. 15.6.4 *} |
740 --{* cf. 15.6.4 *} |
770 Cons: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<rightarrow> s1; |
741 | Cons: "\<lbrakk>G\<turnstile>Norm s0 \<midarrow>e -\<succ> v \<rightarrow> s1; |
771 G\<turnstile> s1 \<midarrow>es\<doteq>\<succ>vs\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
742 G\<turnstile> s1 \<midarrow>es\<doteq>\<succ>vs\<rightarrow> s2\<rbrakk> \<Longrightarrow> |
772 G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<rightarrow> s2" |
743 G\<turnstile>Norm s0 \<midarrow>e#es\<doteq>\<succ>v#vs\<rightarrow> s2" |
773 |
744 |
774 (* Rearrangement of premisses: |
745 (* Rearrangement of premisses: |
775 [0,1(Abrupt),2(Skip),8(Jmp),4(Lab),30(Nil),31(Cons),27(LVar),17(Cast),18(Inst), |
746 [0,1(Abrupt),2(Skip),8(Jmp),4(Lab),30(Nil),31(Cons),27(LVar),17(Cast),18(Inst), |
820 declare not_None_eq [simp del] (* IntDef.Zero_def [simp del] *) |
791 declare not_None_eq [simp del] (* IntDef.Zero_def [simp del] *) |
821 declare split_paired_All [simp del] split_paired_Ex [simp del] |
792 declare split_paired_All [simp del] split_paired_Ex [simp del] |
822 ML_setup {* |
793 ML_setup {* |
823 change_simpset (fn ss => ss delloop "split_all_tac"); |
794 change_simpset (fn ss => ss delloop "split_all_tac"); |
824 *} |
795 *} |
825 inductive_cases eval_cases: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> vs'" |
796 inductive_cases2 eval_cases: "G\<turnstile>s \<midarrow>t\<succ>\<rightarrow> (v, s')" |
826 |
797 |
827 inductive_cases eval_elim_cases [cases set]: |
798 inductive_cases2 eval_elim_cases [cases set]: |
828 "G\<turnstile>(Some xc,s) \<midarrow>t \<succ>\<rightarrow> vs'" |
799 "G\<turnstile>(Some xc,s) \<midarrow>t \<succ>\<rightarrow> (v, s')" |
829 "G\<turnstile>Norm s \<midarrow>In1r Skip \<succ>\<rightarrow> xs'" |
800 "G\<turnstile>Norm s \<midarrow>In1r Skip \<succ>\<rightarrow> (x, s')" |
830 "G\<turnstile>Norm s \<midarrow>In1r (Jmp j) \<succ>\<rightarrow> xs'" |
801 "G\<turnstile>Norm s \<midarrow>In1r (Jmp j) \<succ>\<rightarrow> (x, s')" |
831 "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c) \<succ>\<rightarrow> xs'" |
802 "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> c) \<succ>\<rightarrow> (x, s')" |
832 "G\<turnstile>Norm s \<midarrow>In3 ([]) \<succ>\<rightarrow> vs'" |
803 "G\<turnstile>Norm s \<midarrow>In3 ([]) \<succ>\<rightarrow> (v, s')" |
833 "G\<turnstile>Norm s \<midarrow>In3 (e#es) \<succ>\<rightarrow> vs'" |
804 "G\<turnstile>Norm s \<midarrow>In3 (e#es) \<succ>\<rightarrow> (v, s')" |
834 "G\<turnstile>Norm s \<midarrow>In1l (Lit w) \<succ>\<rightarrow> vs'" |
805 "G\<turnstile>Norm s \<midarrow>In1l (Lit w) \<succ>\<rightarrow> (v, s')" |
835 "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e) \<succ>\<rightarrow> vs'" |
806 "G\<turnstile>Norm s \<midarrow>In1l (UnOp unop e) \<succ>\<rightarrow> (v, s')" |
836 "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2) \<succ>\<rightarrow> vs'" |
807 "G\<turnstile>Norm s \<midarrow>In1l (BinOp binop e1 e2) \<succ>\<rightarrow> (v, s')" |
837 "G\<turnstile>Norm s \<midarrow>In2 (LVar vn) \<succ>\<rightarrow> vs'" |
808 "G\<turnstile>Norm s \<midarrow>In2 (LVar vn) \<succ>\<rightarrow> (v, s')" |
838 "G\<turnstile>Norm s \<midarrow>In1l (Cast T e) \<succ>\<rightarrow> vs'" |
809 "G\<turnstile>Norm s \<midarrow>In1l (Cast T e) \<succ>\<rightarrow> (v, s')" |
839 "G\<turnstile>Norm s \<midarrow>In1l (e InstOf T) \<succ>\<rightarrow> vs'" |
810 "G\<turnstile>Norm s \<midarrow>In1l (e InstOf T) \<succ>\<rightarrow> (v, s')" |
840 "G\<turnstile>Norm s \<midarrow>In1l (Super) \<succ>\<rightarrow> vs'" |
811 "G\<turnstile>Norm s \<midarrow>In1l (Super) \<succ>\<rightarrow> (v, s')" |
841 "G\<turnstile>Norm s \<midarrow>In1l (Acc va) \<succ>\<rightarrow> vs'" |
812 "G\<turnstile>Norm s \<midarrow>In1l (Acc va) \<succ>\<rightarrow> (v, s')" |
842 "G\<turnstile>Norm s \<midarrow>In1r (Expr e) \<succ>\<rightarrow> xs'" |
813 "G\<turnstile>Norm s \<midarrow>In1r (Expr e) \<succ>\<rightarrow> (x, s')" |
843 "G\<turnstile>Norm s \<midarrow>In1r (c1;; c2) \<succ>\<rightarrow> xs'" |
814 "G\<turnstile>Norm s \<midarrow>In1r (c1;; c2) \<succ>\<rightarrow> (x, s')" |
844 "G\<turnstile>Norm s \<midarrow>In1l (Methd C sig) \<succ>\<rightarrow> xs'" |
815 "G\<turnstile>Norm s \<midarrow>In1l (Methd C sig) \<succ>\<rightarrow> (x, s')" |
845 "G\<turnstile>Norm s \<midarrow>In1l (Body D c) \<succ>\<rightarrow> xs'" |
816 "G\<turnstile>Norm s \<midarrow>In1l (Body D c) \<succ>\<rightarrow> (x, s')" |
846 "G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2) \<succ>\<rightarrow> vs'" |
817 "G\<turnstile>Norm s \<midarrow>In1l (e0 ? e1 : e2) \<succ>\<rightarrow> (v, s')" |
847 "G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2) \<succ>\<rightarrow> xs'" |
818 "G\<turnstile>Norm s \<midarrow>In1r (If(e) c1 Else c2) \<succ>\<rightarrow> (x, s')" |
848 "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c) \<succ>\<rightarrow> xs'" |
819 "G\<turnstile>Norm s \<midarrow>In1r (l\<bullet> While(e) c) \<succ>\<rightarrow> (x, s')" |
849 "G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2) \<succ>\<rightarrow> xs'" |
820 "G\<turnstile>Norm s \<midarrow>In1r (c1 Finally c2) \<succ>\<rightarrow> (x, s')" |
850 "G\<turnstile>Norm s \<midarrow>In1r (Throw e) \<succ>\<rightarrow> xs'" |
821 "G\<turnstile>Norm s \<midarrow>In1r (Throw e) \<succ>\<rightarrow> (x, s')" |
851 "G\<turnstile>Norm s \<midarrow>In1l (NewC C) \<succ>\<rightarrow> vs'" |
822 "G\<turnstile>Norm s \<midarrow>In1l (NewC C) \<succ>\<rightarrow> (v, s')" |
852 "G\<turnstile>Norm s \<midarrow>In1l (New T[e]) \<succ>\<rightarrow> vs'" |
823 "G\<turnstile>Norm s \<midarrow>In1l (New T[e]) \<succ>\<rightarrow> (v, s')" |
853 "G\<turnstile>Norm s \<midarrow>In1l (Ass va e) \<succ>\<rightarrow> vs'" |
824 "G\<turnstile>Norm s \<midarrow>In1l (Ass va e) \<succ>\<rightarrow> (v, s')" |
854 "G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2) \<succ>\<rightarrow> xs'" |
825 "G\<turnstile>Norm s \<midarrow>In1r (Try c1 Catch(tn vn) c2) \<succ>\<rightarrow> (x, s')" |
855 "G\<turnstile>Norm s \<midarrow>In2 ({accC,statDeclC,stat}e..fn) \<succ>\<rightarrow> vs'" |
826 "G\<turnstile>Norm s \<midarrow>In2 ({accC,statDeclC,stat}e..fn) \<succ>\<rightarrow> (v, s')" |
856 "G\<turnstile>Norm s \<midarrow>In2 (e1.[e2]) \<succ>\<rightarrow> vs'" |
827 "G\<turnstile>Norm s \<midarrow>In2 (e1.[e2]) \<succ>\<rightarrow> (v, s')" |
857 "G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> vs'" |
828 "G\<turnstile>Norm s \<midarrow>In1l ({accC,statT,mode}e\<cdot>mn({pT}p)) \<succ>\<rightarrow> (v, s')" |
858 "G\<turnstile>Norm s \<midarrow>In1r (Init C) \<succ>\<rightarrow> xs'" |
829 "G\<turnstile>Norm s \<midarrow>In1r (Init C) \<succ>\<rightarrow> (x, s')" |
859 declare not_None_eq [simp] (* IntDef.Zero_def [simp] *) |
830 declare not_None_eq [simp] (* IntDef.Zero_def [simp] *) |
860 declare split_paired_All [simp] split_paired_Ex [simp] |
831 declare split_paired_All [simp] split_paired_Ex [simp] |
861 ML_setup {* |
832 ML_setup {* |
862 change_simpset (fn ss => ss addloop ("split_all_tac", split_all_tac)); |
833 change_simpset (fn ss => ss addloop ("split_all_tac", split_all_tac)); |
863 *} |
834 *} |
883 terms and their corresponding values in the evaluation relation: |
854 terms and their corresponding values in the evaluation relation: |
884 E.g. an expression |
855 E.g. an expression |
885 (injection @{term In1l} into terms) always evaluates to ordinary values |
856 (injection @{term In1l} into terms) always evaluates to ordinary values |
886 (injection @{term In1} into generalised values @{term vals}). |
857 (injection @{term In1} into generalised values @{term vals}). |
887 *} |
858 *} |
|
859 |
|
860 lemma eval_expr_eq: "G\<turnstile>s \<midarrow>In1l t\<succ>\<rightarrow> (w, s') = (\<exists>v. w=In1 v \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<rightarrow> s')" |
|
861 by (auto, frule eval_Inj_elim, auto) |
|
862 |
|
863 lemma eval_var_eq: "G\<turnstile>s \<midarrow>In2 t\<succ>\<rightarrow> (w, s') = (\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<rightarrow> s')" |
|
864 by (auto, frule eval_Inj_elim, auto) |
|
865 |
|
866 lemma eval_exprs_eq: "G\<turnstile>s \<midarrow>In3 t\<succ>\<rightarrow> (w, s') = (\<exists>vs. w=In3 vs \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<rightarrow> s')" |
|
867 by (auto, frule eval_Inj_elim, auto) |
|
868 |
|
869 lemma eval_stmt_eq: "G\<turnstile>s \<midarrow>In1r t\<succ>\<rightarrow> (w, s') = (w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<rightarrow> s')" |
|
870 by (auto, frule eval_Inj_elim, auto, frule eval_Inj_elim, auto) |
|
871 |
888 ML_setup {* |
872 ML_setup {* |
889 fun eval_fun nam inj rhs = |
873 fun eval_fun name lhs = |
890 let |
874 let |
891 val name = "eval_" ^ nam ^ "_eq" |
|
892 val lhs = "G\<turnstile>s \<midarrow>" ^ inj ^ " t\<succ>\<rightarrow> (w, s')" |
|
893 val () = qed_goal name (the_context()) (lhs ^ " = (" ^ rhs ^ ")") |
|
894 (K [Auto_tac, ALLGOALS (ftac (thm "eval_Inj_elim")) THEN Auto_tac]) |
|
895 fun is_Inj (Const (inj,_) $ _) = true |
875 fun is_Inj (Const (inj,_) $ _) = true |
896 | is_Inj _ = false |
876 | is_Inj _ = false |
897 fun pred (_ $ (Const ("Pair",_) $ _ $ |
877 fun pred (_ $ _ $ _ $ _ $ x $ _) = is_Inj x |
898 (Const ("Pair", _) $ _ $ (Const ("Pair", _) $ x $ _ ))) $ _ ) = is_Inj x |
|
899 in |
878 in |
900 cond_simproc name lhs pred (thm name) |
879 cond_simproc name lhs pred (thm name) |
901 end |
880 end |
902 |
881 |
903 val eval_expr_proc =eval_fun "expr" "In1l" "\<exists>v. w=In1 v \<and> G\<turnstile>s \<midarrow>t-\<succ>v \<rightarrow> s'" |
882 val eval_expr_proc = eval_fun "eval_expr_eq" "G\<turnstile>s \<midarrow>In1l t\<succ>\<rightarrow> (w, s')"; |
904 val eval_var_proc =eval_fun "var" "In2" "\<exists>vf. w=In2 vf \<and> G\<turnstile>s \<midarrow>t=\<succ>vf\<rightarrow> s'" |
883 val eval_var_proc = eval_fun "eval_var_eq" "G\<turnstile>s \<midarrow>In2 t\<succ>\<rightarrow> (w, s')"; |
905 val eval_exprs_proc=eval_fun "exprs""In3" "\<exists>vs. w=In3 vs \<and> G\<turnstile>s \<midarrow>t\<doteq>\<succ>vs\<rightarrow> s'" |
884 val eval_exprs_proc = eval_fun "eval_exprs_eq" "G\<turnstile>s \<midarrow>In3 t\<succ>\<rightarrow> (w, s')"; |
906 val eval_stmt_proc =eval_fun "stmt" "In1r" " w=\<diamondsuit> \<and> G\<turnstile>s \<midarrow>t \<rightarrow> s'"; |
885 val eval_stmt_proc = eval_fun "eval_stmt_eq" "G\<turnstile>s \<midarrow>In1r t\<succ>\<rightarrow> (w, s')"; |
907 Addsimprocs [eval_expr_proc,eval_var_proc,eval_exprs_proc,eval_stmt_proc]; |
886 Addsimprocs [eval_expr_proc,eval_var_proc,eval_exprs_proc,eval_stmt_proc]; |
908 bind_thms ("AbruptIs", sum3_instantiate (thm "eval.Abrupt")) |
887 bind_thms ("AbruptIs", sum3_instantiate (thm "eval.Abrupt")) |
909 *} |
888 *} |
910 |
889 |
911 declare halloc.Abrupt [intro!] eval.Abrupt [intro!] AbruptIs [intro!] |
890 declare halloc.Abrupt [intro!] eval.Abrupt [intro!] AbruptIs [intro!] |