# Theory RefMappings

Up to index of Isabelle/HOLCF/IOA

theory RefMappings
imports Traces
uses [RefMappings.ML]
begin

    (*  Title:      HOLCF/IOA/meta_theory/RefMappings.thy
        ID:         $Id: RefMappings.thy,v 1.9 2005/09/02 15:24:02 wenzelm Exp $
        Author:     Olaf Müller
    *)

    header {* Refinement Mappings in HOLCF/IOA *}

    theory RefMappings
    imports Traces
    begin

    defaultsort type

    consts
      move         ::"[('a,'s)ioa,('a,'s)pairs,'s,'a,'s] => bool"
      is_ref_map   ::"[('s1=>'s2),('a,'s1)ioa,('a,'s2)ioa] => bool"
      is_weak_ref_map ::"[('s1=>'s2),('a,'s1)ioa,('a,'s2)ioa] => bool"

    defs

    move_def:
      "move ioa ex s a t ==
        (is_exec_frag ioa (s,ex) &  Finite ex &
         laststate (s,ex)=t  &
         mk_trace ioa$ex = (if a:ext(ioa) then a>>nil else nil))"

    is_ref_map_def:
      "is_ref_map f C A ==
       (!s:starts_of(C). f(s):starts_of(A)) &
       (!s t a. reachable C s &
                s -a--C-> t
                --> (? ex. move A ex (f s) a (f t)))"

    is_weak_ref_map_def:
      "is_weak_ref_map f C A ==
       (!s:starts_of(C). f(s):starts_of(A)) &
       (!s t a. reachable C s &
                s -a--C-> t
                --> (if a:ext(C)
                     then (f s) -a--A-> (f t)
                     else (f s)=(f t)))"

    ML {* use_legacy_bindings (the_context ()) *}

    end

## transitions and moves

theorem transition_is_ex:

      s -a--A-> t ==> ∃ex. move A ex s a t

theorem nothing_is_ex:

      a ∉ ext A ∧ s = t ==> ∃ex. move A ex s a t

theorem ei_transitions_are_ex:

      s -a--A-> s' ∧ s' -a'--A-> s'' ∧ a' ∉ ext A ==> ∃ex. move A ex s a s''

theorem eii_transitions_are_ex:

      s1.0 -a1.0--A-> s2.0 ∧
      s2.0 -a2.0--A-> s3.0 ∧ s3.0 -a3.0--A-> s4.0 ∧ a2.0 ∉ ext A ∧ a3.0 ∉ ext A
      ==> ∃ex. move A ex s1.0 a1.0 s4.0

## weak_ref_map and ref_map

theorem weak_ref_map2ref_map:

      [| ext C = ext A; is_weak_ref_map f C A |] ==> is_ref_map f C A

theorem imp_conj_lemma:

      (P ==> Q --> R) ==> P ∧ Q --> R

theorem rename_through_pmap:

      is_weak_ref_map f C A ==> is_weak_ref_map f (rename C g) (rename A g)