src/HOL/UNITY/Lift_prog.thy
author wenzelm
Fri, 05 Oct 2001 21:52:39 +0200
changeset 11701 3d51fbf81c17
parent 10834 a7897aebbffc
child 13786 ab8f39f48a6f
permissions -rw-r--r--
sane numerals (stage 1): added generic 1, removed 1' and 2 on nat, "num" syntax (still with "#"), Numeral0, Numeral1;
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     1
(*  Title:      HOL/UNITY/Lift_prog.thy
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     2
    ID:         $Id$
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     3
    Author:     Lawrence C Paulson, Cambridge University Computer Laboratory
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     4
    Copyright   1999  University of Cambridge
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     5
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     6
lift_prog, etc: replication of components
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     7
*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
     8
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
     9
Lift_prog = Rename +
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    10
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    11
constdefs
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    12
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    13
  insert_map :: "[nat, 'b, nat=>'b] => (nat=>'b)"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    14
    "insert_map i z f k == if k<i then f k
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    15
                           else if k=i then z
11701
3d51fbf81c17 sane numerals (stage 1): added generic 1, removed 1' and 2 on nat,
wenzelm
parents: 10834
diff changeset
    16
                           else f(k - 1)"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    17
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    18
  delete_map :: "[nat, nat=>'b] => (nat=>'b)"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    19
    "delete_map i g k == if k<i then g k else g (Suc k)"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    20
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    21
  lift_map :: "[nat, 'b * ((nat=>'b) * 'c)] => (nat=>'b) * 'c"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    22
    "lift_map i == %(s,(f,uu)). (insert_map i s f, uu)"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    23
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    24
  drop_map :: "[nat, (nat=>'b) * 'c] => 'b * ((nat=>'b) * 'c)"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    25
    "drop_map i == %(g, uu). (g i, (delete_map i g, uu))"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    26
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    27
  lift_set :: "[nat, ('b * ((nat=>'b) * 'c)) set] => ((nat=>'b) * 'c) set"
10834
a7897aebbffc *** empty log message ***
nipkow
parents: 8251
diff changeset
    28
    "lift_set i A == lift_map i ` A"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    29
8251
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    30
  lift :: "[nat, ('b * ((nat=>'b) * 'c)) program] => ((nat=>'b) * 'c) program"
9be357df93d4 New treatment of "guarantees" with polymorphic components and bijections.
paulson
parents: 8122
diff changeset
    31
    "lift i == rename (lift_map i)"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    32
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    33
  (*simplifies the expression of specifications*)
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    34
  constdefs
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    35
    sub :: ['a, 'a=>'b] => 'b
7947
b999c1ab9327 working again; new treatment of LocalTo
paulson
parents: 7880
diff changeset
    36
      "sub == %i f. f i"
7186
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    37
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    38
860479291bb5 new theory UNITY/Lift_prog
paulson
parents:
diff changeset
    39
end