src/HOL/Hoare/HeapSyntax.thy
author huffman
Fri Mar 30 12:32:35 2012 +0200 (2012-03-30)
changeset 47220 52426c62b5d0
parent 35316 870dfea4f9c0
permissions -rw-r--r--
replace lemmas eval_nat_numeral with a simpler reformulation
     1 (*  Title:      HOL/Hoare/HeapSyntax.thy
     2     Author:     Tobias Nipkow
     3     Copyright   2002 TUM
     4 *)
     5 
     6 theory HeapSyntax imports Hoare_Logic Heap begin
     7 
     8 subsection "Field access and update"
     9 
    10 syntax
    11   "_refupdate" :: "('a \<Rightarrow> 'b) \<Rightarrow> 'a ref \<Rightarrow> 'b \<Rightarrow> ('a \<Rightarrow> 'b)"
    12    ("_/'((_ \<rightarrow> _)')" [1000,0] 900)
    13   "_fassign"  :: "'a ref => id => 'v => 's com"
    14    ("(2_^._ :=/ _)" [70,1000,65] 61)
    15   "_faccess"  :: "'a ref => ('a ref \<Rightarrow> 'v) => 'v"
    16    ("_^._" [65,1000] 65)
    17 translations
    18   "f(r \<rightarrow> v)" == "f(CONST addr r := v)"
    19   "p^.f := e" => "f := f(p \<rightarrow> e)"
    20   "p^.f" => "f(CONST addr p)"
    21 
    22 
    23 declare fun_upd_apply[simp del] fun_upd_same[simp] fun_upd_other[simp]
    24 
    25 
    26 text "An example due to Suzuki:"
    27 
    28 lemma "VARS v n
    29   {w = Ref w0 & x = Ref x0 & y = Ref y0 & z = Ref z0 &
    30    distinct[w0,x0,y0,z0]}
    31   w^.v := (1::int); w^.n := x;
    32   x^.v := 2; x^.n := y;
    33   y^.v := 3; y^.n := z;
    34   z^.v := 4; x^.n := z
    35   {w^.n^.n^.v = 4}"
    36 by vcg_simp
    37 
    38 end