|     10 subsection {* The graph of a function *} |     10 subsection {* The graph of a function *} | 
|     11  |     11  | 
|     12 text{* We define the \emph{graph} of a (real) function $f$ with |     12 text{* We define the \emph{graph} of a (real) function $f$ with | 
|     13 domain $F$ as the set  |     13 domain $F$ as the set  | 
|     14 \[ |     14 \[ | 
|     15 \{(x, f\ap x). \ap x:F\} |     15 \{(x, f\ap x). \ap x \in F\} | 
|     16 \] |     16 \] | 
|     17 So we are modeling partial functions by specifying the domain and  |     17 So we are modeling partial functions by specifying the domain and  | 
|     18 the mapping function. We use the term ``function'' also for its graph. |     18 the mapping function. We use the term ``function'' also for its graph. | 
|     19 *} |     19 *} | 
|     20  |     20  | 
|     21 types 'a graph = "('a * real) set" |     21 types 'a graph = "('a * real) set" | 
|     22  |     22  | 
|     23 constdefs |     23 constdefs | 
|     24   graph :: "['a set, 'a => real] => 'a graph " |     24   graph :: "['a set, 'a => real] => 'a graph " | 
|     25   "graph F f == {(x, f x) | x. x:F}"  |     25   "graph F f == {(x, f x) | x. x \<in> F}"  | 
|     26  |     26  | 
|     27 lemma graphI [intro??]: "x:F ==> (x, f x) : graph F f" |     27 lemma graphI [intro??]: "x \<in> F ==> (x, f x) \<in> graph F f" | 
|     28   by (unfold graph_def, intro CollectI exI) force |     28   by (unfold graph_def, intro CollectI exI) force | 
|     29  |     29  | 
|     30 lemma graphI2 [intro??]: "x:F ==> EX t: (graph F f). t = (x, f x)" |     30 lemma graphI2 [intro??]: "x \<in> F ==> \<exists>t\<in> (graph F f). t = (x, f x)" | 
|     31   by (unfold graph_def, force) |     31   by (unfold graph_def, force) | 
|     32  |     32  | 
|     33 lemma graphD1 [intro??]: "(x, y): graph F f ==> x:F" |     33 lemma graphD1 [intro??]: "(x, y) \<in> graph F f ==> x \<in> F" | 
|     34   by (unfold graph_def, elim CollectE exE) force |     34   by (unfold graph_def, elim CollectE exE) force | 
|     35  |     35  | 
|     36 lemma graphD2 [intro??]: "(x, y): graph H h ==> y = h x" |     36 lemma graphD2 [intro??]: "(x, y) \<in> graph H h ==> y = h x" | 
|     37   by (unfold graph_def, elim CollectE exE) force  |     37   by (unfold graph_def, elim CollectE exE) force  | 
|     38  |     38  | 
|     39 subsection {* Functions ordered by domain extension *} |     39 subsection {* Functions ordered by domain extension *} | 
|     40  |     40  | 
|     41 text{* A function $h'$ is an extension of $h$, iff the graph of  |     41 text{* A function $h'$ is an extension of $h$, iff the graph of  | 
|     42 $h$ is a subset of the graph of $h'$.*} |     42 $h$ is a subset of the graph of $h'$.*} | 
|     43  |     43  | 
|     44 lemma graph_extI:  |     44 lemma graph_extI:  | 
|     45   "[| !! x. x: H ==> h x = h' x; H <= H'|] |     45   "[| !! x. x \<in> H ==> h x = h' x; H <= H'|] | 
|     46   ==> graph H h <= graph H' h'" |     46   ==> graph H h <= graph H' h'" | 
|     47   by (unfold graph_def, force) |     47   by (unfold graph_def, force) | 
|     48  |     48  | 
|     49 lemma graph_extD1 [intro??]:  |     49 lemma graph_extD1 [intro??]:  | 
|     50   "[| graph H h <= graph H' h'; x:H |] ==> h x = h' x" |     50   "[| graph H h <= graph H' h'; x \<in> H |] ==> h x = h' x" | 
|     51   by (unfold graph_def, force) |     51   by (unfold graph_def, force) | 
|     52  |     52  | 
|     53 lemma graph_extD2 [intro??]:  |     53 lemma graph_extD2 [intro??]:  | 
|     54   "[| graph H h <= graph H' h' |] ==> H <= H'" |     54   "[| graph H h <= graph H' h' |] ==> H <= H'" | 
|     55   by (unfold graph_def, force) |     55   by (unfold graph_def, force) | 
|     59 text{* The inverse functions to $\idt{graph}$ are $\idt{domain}$ and  |     59 text{* The inverse functions to $\idt{graph}$ are $\idt{domain}$ and  | 
|     60 $\idt{funct}$.*} |     60 $\idt{funct}$.*} | 
|     61  |     61  | 
|     62 constdefs |     62 constdefs | 
|     63   domain :: "'a graph => 'a set"  |     63   domain :: "'a graph => 'a set"  | 
|     64   "domain g == {x. EX y. (x, y):g}" |     64   "domain g == {x. \<exists>y. (x, y) \<in> g}" | 
|     65  |     65  | 
|     66   funct :: "'a graph => ('a => real)" |     66   funct :: "'a graph => ('a => real)" | 
|     67   "funct g == \<lambda>x. (SOME y. (x, y):g)" |     67   "funct g == \<lambda>x. (SOME y. (x, y) \<in> g)" | 
|     68  |     68  | 
|     69 (*text{*  The equations  |     69 (*text{*  The equations  | 
|     70 \begin{matharray} |     70 \begin{matharray} | 
|     71 \idt{domain} graph F f = F {\rm and}\\  |     71 \idt{domain} graph F f = F {\rm and}\\  | 
|     72 \idt{funct} graph F f = f |     72 \idt{funct} graph F f = f | 
|     76  |     76  | 
|     77 text {* The following lemma states that $g$ is the graph of a function |     77 text {* The following lemma states that $g$ is the graph of a function | 
|     78 if the relation induced by $g$ is unique. *} |     78 if the relation induced by $g$ is unique. *} | 
|     79  |     79  | 
|     80 lemma graph_domain_funct:  |     80 lemma graph_domain_funct:  | 
|     81   "(!!x y z. (x, y):g ==> (x, z):g ==> z = y)  |     81   "(!!x y z. (x, y) \<in> g ==> (x, z) \<in> g ==> z = y)  | 
|     82   ==> graph (domain g) (funct g) = g" |     82   ==> graph (domain g) (funct g) = g" | 
|     83 proof (unfold domain_def funct_def graph_def, auto) |     83 proof (unfold domain_def funct_def graph_def, auto) | 
|     84   fix a b assume "(a, b) : g" |     84   fix a b assume "(a, b) \<in> g" | 
|     85   show "(a, SOME y. (a, y) : g) : g" by (rule selectI2) |     85   show "(a, SOME y. (a, y) \<in> g) \<in> g" by (rule selectI2) | 
|     86   show "EX y. (a, y) : g" .. |     86   show "\<exists>y. (a, y) \<in> g" .. | 
|     87   assume uniq: "!!x y z. (x, y):g ==> (x, z):g ==> z = y" |     87   assume uniq: "!!x y z. (x, y) \<in> g ==> (x, z) \<in> g ==> z = y" | 
|     88   show "b = (SOME y. (a, y) : g)" |     88   show "b = (SOME y. (a, y) \<in> g)" | 
|     89   proof (rule select_equality [RS sym]) |     89   proof (rule select_equality [RS sym]) | 
|     90     fix y assume "(a, y):g" show "y = b" by (rule uniq) |     90     fix y assume "(a, y) \<in> g" show "y = b" by (rule uniq) | 
|     91   qed |     91   qed | 
|     92 qed |     92 qed | 
|     93  |     93  | 
|     94  |     94  | 
|     95  |     95  | 
|    100 $F$, which are bounded by $p$, is defined as follows. *} |    100 $F$, which are bounded by $p$, is defined as follows. *} | 
|    101  |    101  | 
|    102  |    102  | 
|    103 constdefs |    103 constdefs | 
|    104   norm_pres_extensions ::  |    104   norm_pres_extensions ::  | 
|    105     "['a::{minus, plus} set, 'a  => real, 'a set, 'a => real]  |    105     "['a::{plus, minus, zero} set, 'a  => real, 'a set, 'a => real]  | 
|    106     => 'a graph set" |    106     => 'a graph set" | 
|    107     "norm_pres_extensions E p F f  |    107     "norm_pres_extensions E p F f  | 
|    108     == {g. EX H h. graph H h = g  |    108     == {g. \<exists>H h. graph H h = g  | 
|    109                 & is_linearform H h  |    109                 \<and> is_linearform H h  | 
|    110                 & is_subspace H E |    110                 \<and> is_subspace H E | 
|    111                 & is_subspace F H |    111                 \<and> is_subspace F H | 
|    112                 & graph F f <= graph H h |    112                 \<and> graph F f <= graph H h | 
|    113                 & (ALL x:H. h x <= p x)}" |    113                 \<and> (\<forall>x \<in> H. h x <= p x)}" | 
|    114                         |    114                         | 
|    115 lemma norm_pres_extension_D:   |    115 lemma norm_pres_extension_D:   | 
|    116   "g : norm_pres_extensions E p F f |    116   "g \<in> norm_pres_extensions E p F f | 
|    117   ==> EX H h. graph H h = g  |    117   ==> \<exists>H h. graph H h = g  | 
|    118             & is_linearform H h  |    118             \<and> is_linearform H h  | 
|    119             & is_subspace H E |    119             \<and> is_subspace H E | 
|    120             & is_subspace F H |    120             \<and> is_subspace F H | 
|    121             & graph F f <= graph H h |    121             \<and> graph F f <= graph H h | 
|    122             & (ALL x:H. h x <= p x)" |    122             \<and> (\<forall>x \<in> H. h x <= p x)" | 
|    123   by (unfold norm_pres_extensions_def) force |    123   by (unfold norm_pres_extensions_def) force | 
|    124  |    124  | 
|    125 lemma norm_pres_extensionI2 [intro]:   |    125 lemma norm_pres_extensionI2 [intro]:   | 
|    126   "[| is_linearform H h; is_subspace H E; is_subspace F H; |    126   "[| is_linearform H h; is_subspace H E; is_subspace F H; | 
|    127   graph F f <= graph H h; ALL x:H. h x <= p x |] |    127   graph F f <= graph H h; \<forall>x \<in> H. h x <= p x |] | 
|    128   ==> (graph H h : norm_pres_extensions E p F f)" |    128   ==> (graph H h \<in> norm_pres_extensions E p F f)" | 
|    129  by (unfold norm_pres_extensions_def) force |    129  by (unfold norm_pres_extensions_def) force | 
|    130  |    130  | 
|    131 lemma norm_pres_extensionI [intro]:   |    131 lemma norm_pres_extensionI [intro]:   | 
|    132   "EX H h. graph H h = g  |    132   "\<exists>H h. graph H h = g  | 
|    133          & is_linearform H h     |    133          \<and> is_linearform H h     | 
|    134          & is_subspace H E |    134          \<and> is_subspace H E | 
|    135          & is_subspace F H |    135          \<and> is_subspace F H | 
|    136          & graph F f <= graph H h |    136          \<and> graph F f <= graph H h | 
|    137          & (ALL x:H. h x <= p x) |    137          \<and> (\<forall>x \<in> H. h x <= p x) | 
|    138   ==> g: norm_pres_extensions E p F f" |    138   ==> g\<in> norm_pres_extensions E p F f" | 
|    139   by (unfold norm_pres_extensions_def) force |    139   by (unfold norm_pres_extensions_def) force | 
|    140  |    140  | 
|    141 end |    141 end |