author | Thomas Sewell <tsewell@nicta.com.au> |
Fri, 11 Sep 2009 15:56:51 +1000 | |
changeset 32746 | 2f1701a6d4e8 |
parent 32745 | 192d58483fdf |
permissions | -rw-r--r-- |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
1 |
(* Title: HOL/IsTuple.thy |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
2 |
Author: Thomas Sewell, NICTA |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
3 |
*) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
4 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
5 |
header {* Operators on types isomorphic to tuples *} |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
6 |
|
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
7 |
theory IsTuple imports Product_Type |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
8 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
9 |
uses ("Tools/istuple_support.ML") |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
10 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
11 |
begin |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
12 |
|
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
13 |
text {* |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
14 |
This module provides operators and lemmas for types isomorphic to tuples. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
15 |
These types are used in defining efficient records. Consider the record |
32746
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
16 |
access/update simplification "alpha (beta_update f rec) = alpha rec" for |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
17 |
distinct fields alpha and beta of some record rec with n fields. There |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
18 |
are n^2 such theorems, which prohibits storage of all of them for |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
19 |
large n. The rules can be proved on the fly by case decomposition and |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
20 |
simplification in O(n) time. By creating O(n) isomorphic-tuple types |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
21 |
while defining the record, however, we can prove the access/update |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
22 |
simplification in O(log(n)^2) time. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
23 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
24 |
The O(n) cost of case decomposition is not because O(n) steps are taken, |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
25 |
but rather because the resulting rule must contain O(n) new variables and |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
26 |
an O(n) size concrete record construction. To sidestep this cost, we would |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
27 |
like to avoid case decomposition in proving access/update theorems. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
28 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
29 |
Record types are defined as isomorphic to tuple types. For instance, a |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
30 |
record type with fields 'a, 'b, 'c and 'd might be introduced as |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
31 |
isomorphic to 'a \<times> ('b \<times> ('c \<times> 'd)). If we balance the tuple tree to |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
32 |
('a \<times> 'b) \<times> ('c \<times> 'd) then accessors can be defined by converting to |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
33 |
the underlying type then using O(log(n)) fst or snd operations. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
34 |
Updators can be defined similarly, if we introduce a fst_update and |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
35 |
snd_update function. Furthermore, we can prove the access/update |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
36 |
theorem in O(log(n)) steps by using simple rewrites on fst, snd, |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
37 |
fst_update and snd_update. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
38 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
39 |
The catch is that, although O(log(n)) steps were taken, the underlying |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
40 |
type we converted to is a tuple tree of size O(n). Processing this term |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
41 |
type wastes performance. We avoid this for large n by taking each |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
42 |
subtree of size K and defining a new type isomorphic to that tuple |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
43 |
subtree. The record can now be defined as isomorphic to a tuple tree |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
44 |
of these O(n/K) new types, or, if n > K*K, we can repeat the process, |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
45 |
until the record can be defined in terms of a tuple tree of complexity |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
46 |
less than the constant K. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
47 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
48 |
If we prove the access/update theorem on this type with the analagous |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
49 |
steps to the tuple tree, we consume O(log(n)^2) time as the intermediate |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
50 |
terms are O(log(n)) in size and the types needed have size bounded by K. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
51 |
To enable this analagous traversal, we define the functions seen below: |
32746
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
52 |
istuple_fst, istuple_snd, istuple_fst_update and istuple_snd_update. |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
53 |
These functions generalise tuple operations by taking a parameter that |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
54 |
encapsulates a tuple isomorphism. The rewrites needed on these functions |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
55 |
now need an additional assumption which is that the isomorphism works. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
56 |
|
32746
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
57 |
These rewrites are typically used in a structured way. They are here |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
58 |
presented as the introduction rule isomorphic_tuple.intros rather than |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
59 |
as a rewrite rule set. The introduction form is an optimisation, as net |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
60 |
matching can be performed at one term location for each step rather than |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
61 |
the simplifier searching the term for possible pattern matches. The rule |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
62 |
set is used as it is viewed outside the locale, with the locale assumption |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
63 |
(that the isomorphism is valid) left as rule assumption. All rules are |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
64 |
structured to aid net matching, using either a point-free form or an |
2f1701a6d4e8
Adjust some documentation.
Thomas Sewell <tsewell@nicta.com.au>
parents:
32745
diff
changeset
|
65 |
encapsulating predicate. |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
66 |
*} |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
67 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
68 |
typedef ('a, 'b, 'c) tuple_isomorphism |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
69 |
= "UNIV :: (('a \<Rightarrow> ('b \<times> 'c)) \<times> (('b \<times> 'c) \<Rightarrow> 'a)) set" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
70 |
by simp |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
71 |
|
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
72 |
constdefs |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
73 |
"TupleIsomorphism repr abst \<equiv> Abs_tuple_isomorphism (repr, abst)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
74 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
75 |
constdefs |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
76 |
istuple_fst :: "('a, 'b, 'c) tuple_isomorphism \<Rightarrow> 'a \<Rightarrow> 'b" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
77 |
"istuple_fst isom \<equiv> let (repr, abst) = Rep_tuple_isomorphism isom in fst \<circ> repr" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
78 |
istuple_snd :: "('a, 'b, 'c) tuple_isomorphism \<Rightarrow> 'a \<Rightarrow> 'c" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
79 |
"istuple_snd isom \<equiv> let (repr, abst) = Rep_tuple_isomorphism isom in snd \<circ> repr" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
80 |
istuple_fst_update :: "('a, 'b, 'c) tuple_isomorphism \<Rightarrow> ('b \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'a)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
81 |
"istuple_fst_update isom \<equiv> |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
82 |
let (repr, abst) = Rep_tuple_isomorphism isom in |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
83 |
(\<lambda>f v. abst (f (fst (repr v)), snd (repr v)))" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
84 |
istuple_snd_update :: "('a, 'b, 'c) tuple_isomorphism \<Rightarrow> ('c \<Rightarrow> 'c) \<Rightarrow> ('a \<Rightarrow> 'a)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
85 |
"istuple_snd_update isom \<equiv> |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
86 |
let (repr, abst) = Rep_tuple_isomorphism isom in |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
87 |
(\<lambda>f v. abst (fst (repr v), f (snd (repr v))))" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
88 |
istuple_cons :: "('a, 'b, 'c) tuple_isomorphism \<Rightarrow> 'b \<Rightarrow> 'c \<Rightarrow> 'a" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
89 |
"istuple_cons isom \<equiv> let (repr, abst) = Rep_tuple_isomorphism isom in curry abst" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
90 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
91 |
text {* |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
92 |
These predicates are used in the introduction rule set to constrain |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
93 |
matching appropriately. The elimination rules for them produce the |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
94 |
desired theorems once they are proven. The final introduction rules are |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
95 |
used when no further rules from the introduction rule set can apply. |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
96 |
*} |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
97 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
98 |
constdefs |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
99 |
istuple_surjective_proof_assist :: "'a \<Rightarrow> 'b \<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
100 |
"istuple_surjective_proof_assist x y f \<equiv> f x = y" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
101 |
istuple_update_accessor_cong_assist :: "(('b \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'a)) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
102 |
\<Rightarrow> ('a \<Rightarrow> 'b) \<Rightarrow> bool" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
103 |
"istuple_update_accessor_cong_assist upd acc |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
104 |
\<equiv> (\<forall>f v. upd (\<lambda>x. f (acc v)) v = upd f v) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
105 |
\<and> (\<forall>v. upd id v = v)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
106 |
istuple_update_accessor_eq_assist :: "(('b \<Rightarrow> 'b) \<Rightarrow> ('a \<Rightarrow> 'a)) \<Rightarrow> ('a \<Rightarrow> 'b) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
107 |
\<Rightarrow> 'a \<Rightarrow> ('b \<Rightarrow> 'b) \<Rightarrow> 'a \<Rightarrow> 'b \<Rightarrow> bool" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
108 |
"istuple_update_accessor_eq_assist upd acc v f v' x |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
109 |
\<equiv> upd f v = v' \<and> acc v = x |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
110 |
\<and> istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
111 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
112 |
lemma update_accessor_congruence_foldE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
113 |
assumes uac: "istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
114 |
and r: "r = r'" and v: "acc r' = v'" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
115 |
and f: "\<And>v. v' = v \<Longrightarrow> f v = f' v" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
116 |
shows "upd f r = upd f' r'" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
117 |
using uac r v[symmetric] |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
118 |
apply (subgoal_tac "upd (\<lambda>x. f (acc r')) r' = upd (\<lambda>x. f' (acc r')) r'") |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
119 |
apply (simp add: istuple_update_accessor_cong_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
120 |
apply (simp add: f) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
121 |
done |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
122 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
123 |
lemma update_accessor_congruence_unfoldE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
124 |
"\<lbrakk> istuple_update_accessor_cong_assist upd acc; |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
125 |
r = r'; acc r' = v'; \<And>v. v = v' \<Longrightarrow> f v = f' v \<rbrakk> |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
126 |
\<Longrightarrow> upd f r = upd f' r'" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
127 |
apply (erule(2) update_accessor_congruence_foldE) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
128 |
apply simp |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
129 |
done |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
130 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
131 |
lemma istuple_update_accessor_cong_assist_id: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
132 |
"istuple_update_accessor_cong_assist upd acc \<Longrightarrow> upd id = id" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
133 |
by (rule ext, simp add: istuple_update_accessor_cong_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
134 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
135 |
lemma update_accessor_noopE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
136 |
assumes uac: "istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
137 |
and acc: "f (acc x) = acc x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
138 |
shows "upd f x = x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
139 |
using uac |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
140 |
by (simp add: acc istuple_update_accessor_cong_assist_id[OF uac, unfolded id_def] |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
141 |
cong: update_accessor_congruence_unfoldE[OF uac]) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
142 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
143 |
lemma update_accessor_noop_compE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
144 |
assumes uac: "istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
145 |
assumes acc: "f (acc x) = acc x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
146 |
shows "upd (g \<circ> f) x = upd g x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
147 |
by (simp add: acc cong: update_accessor_congruence_unfoldE[OF uac]) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
148 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
149 |
lemma update_accessor_cong_assist_idI: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
150 |
"istuple_update_accessor_cong_assist id id" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
151 |
by (simp add: istuple_update_accessor_cong_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
152 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
153 |
lemma update_accessor_cong_assist_triv: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
154 |
"istuple_update_accessor_cong_assist upd acc |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
155 |
\<Longrightarrow> istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
156 |
by assumption |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
157 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
158 |
lemma update_accessor_accessor_eqE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
159 |
"\<lbrakk> istuple_update_accessor_eq_assist upd acc v f v' x \<rbrakk> \<Longrightarrow> acc v = x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
160 |
by (simp add: istuple_update_accessor_eq_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
161 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
162 |
lemma update_accessor_updator_eqE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
163 |
"\<lbrakk> istuple_update_accessor_eq_assist upd acc v f v' x \<rbrakk> \<Longrightarrow> upd f v = v'" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
164 |
by (simp add: istuple_update_accessor_eq_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
165 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
166 |
lemma istuple_update_accessor_eq_assist_idI: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
167 |
"v' = f v \<Longrightarrow> istuple_update_accessor_eq_assist id id v f v' v" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
168 |
by (simp add: istuple_update_accessor_eq_assist_def |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
169 |
update_accessor_cong_assist_idI) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
170 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
171 |
lemma istuple_update_accessor_eq_assist_triv: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
172 |
"istuple_update_accessor_eq_assist upd acc v f v' x |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
173 |
\<Longrightarrow> istuple_update_accessor_eq_assist upd acc v f v' x" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
174 |
by assumption |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
175 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
176 |
lemma istuple_update_accessor_cong_from_eq: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
177 |
"istuple_update_accessor_eq_assist upd acc v f v' x |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
178 |
\<Longrightarrow> istuple_update_accessor_cong_assist upd acc" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
179 |
by (simp add: istuple_update_accessor_eq_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
180 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
181 |
lemma o_eq_dest: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
182 |
"a o b = c o d \<Longrightarrow> a (b v) = c (d v)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
183 |
apply (clarsimp simp: o_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
184 |
apply (erule fun_cong) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
185 |
done |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
186 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
187 |
lemma o_eq_elim: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
188 |
"\<lbrakk> a o b = c o d; \<lbrakk> \<And>v. a (b v) = c (d v) \<rbrakk> \<Longrightarrow> R \<rbrakk> \<Longrightarrow> R" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
189 |
apply (erule meta_mp) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
190 |
apply (erule o_eq_dest) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
191 |
done |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
192 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
193 |
lemma istuple_surjective_proof_assistI: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
194 |
"f x = y \<Longrightarrow> |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
195 |
istuple_surjective_proof_assist x y f" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
196 |
by (simp add: istuple_surjective_proof_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
197 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
198 |
lemma istuple_surjective_proof_assist_idE: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
199 |
"istuple_surjective_proof_assist x y id \<Longrightarrow> x = y" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
200 |
by (simp add: istuple_surjective_proof_assist_def) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
201 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
202 |
locale isomorphic_tuple = |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
203 |
fixes isom :: "('a, 'b, 'c) tuple_isomorphism" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
204 |
and repr and abst |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
205 |
defines "repr \<equiv> fst (Rep_tuple_isomorphism isom)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
206 |
defines "abst \<equiv> snd (Rep_tuple_isomorphism isom)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
207 |
assumes repr_inv: "\<And>x. abst (repr x) = x" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
208 |
assumes abst_inv: "\<And>y. repr (abst y) = y" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
209 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
210 |
begin |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
211 |
|
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
212 |
lemma repr_inj: |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
213 |
"(repr x = repr y) = (x = y)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
214 |
apply (rule iffI, simp_all) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
215 |
apply (drule_tac f=abst in arg_cong, simp add: repr_inv) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
216 |
done |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
217 |
|
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
218 |
lemma abst_inj: |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
219 |
"(abst x = abst y) = (x = y)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
220 |
apply (rule iffI, simp_all) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
221 |
apply (drule_tac f=repr in arg_cong, simp add: abst_inv) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
222 |
done |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
223 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
224 |
lemma split_Rep: |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
225 |
"split f (Rep_tuple_isomorphism isom) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
226 |
= f repr abst" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
227 |
by (simp add: split_def repr_def abst_def) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
228 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
229 |
lemmas simps = Let_def split_Rep repr_inv abst_inv repr_inj abst_inj |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
230 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
231 |
lemma istuple_access_update_fst_fst: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
232 |
"\<lbrakk> f o h g = j o f \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
233 |
(f o istuple_fst isom) o (istuple_fst_update isom o h) g |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
234 |
= j o (f o istuple_fst isom)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
235 |
by (clarsimp simp: istuple_fst_update_def istuple_fst_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
236 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
237 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
238 |
lemma istuple_access_update_snd_snd: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
239 |
"\<lbrakk> f o h g = j o f \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
240 |
(f o istuple_snd isom) o (istuple_snd_update isom o h) g |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
241 |
= j o (f o istuple_snd isom)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
242 |
by (clarsimp simp: istuple_snd_update_def istuple_snd_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
243 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
244 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
245 |
lemma istuple_access_update_fst_snd: |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
246 |
"(f o istuple_fst isom) o (istuple_snd_update isom o h) g |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
247 |
= id o (f o istuple_fst isom)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
248 |
by (clarsimp simp: istuple_snd_update_def istuple_fst_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
249 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
250 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
251 |
lemma istuple_access_update_snd_fst: |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
252 |
"(f o istuple_snd isom) o (istuple_fst_update isom o h) g |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
253 |
= id o (f o istuple_snd isom)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
254 |
by (clarsimp simp: istuple_fst_update_def istuple_snd_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
255 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
256 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
257 |
lemma istuple_update_swap_fst_fst: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
258 |
"\<lbrakk> h f o j g = j g o h f \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
259 |
(istuple_fst_update isom o h) f o (istuple_fst_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
260 |
= (istuple_fst_update isom o j) g o (istuple_fst_update isom o h) f" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
261 |
by (clarsimp simp: istuple_fst_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
262 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
263 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
264 |
lemma istuple_update_swap_snd_snd: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
265 |
"\<lbrakk> h f o j g = j g o h f \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
266 |
(istuple_snd_update isom o h) f o (istuple_snd_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
267 |
= (istuple_snd_update isom o j) g o (istuple_snd_update isom o h) f" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
268 |
by (clarsimp simp: istuple_snd_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
269 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
270 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
271 |
lemma istuple_update_swap_fst_snd: |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
272 |
"(istuple_snd_update isom o h) f o (istuple_fst_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
273 |
= (istuple_fst_update isom o j) g o (istuple_snd_update isom o h) f" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
274 |
by (clarsimp simp: istuple_fst_update_def istuple_snd_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
275 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
276 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
277 |
lemma istuple_update_swap_snd_fst: |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
278 |
"(istuple_fst_update isom o h) f o (istuple_snd_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
279 |
= (istuple_snd_update isom o j) g o (istuple_fst_update isom o h) f" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
280 |
by (clarsimp simp: istuple_fst_update_def istuple_snd_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
281 |
intro!: ext elim!: o_eq_elim) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
282 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
283 |
lemma istuple_update_compose_fst_fst: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
284 |
"\<lbrakk> h f o j g = k (f o g) \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
285 |
(istuple_fst_update isom o h) f o (istuple_fst_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
286 |
= (istuple_fst_update isom o k) (f o g)" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
287 |
by (fastsimp simp: istuple_fst_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
288 |
intro!: ext elim!: o_eq_elim dest: fun_cong) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
289 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
290 |
lemma istuple_update_compose_snd_snd: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
291 |
"\<lbrakk> h f o j g = k (f o g) \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
292 |
(istuple_snd_update isom o h) f o (istuple_snd_update isom o j) g |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
293 |
= (istuple_snd_update isom o k) (f o g)" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
294 |
by (fastsimp simp: istuple_snd_update_def simps |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
295 |
intro!: ext elim!: o_eq_elim dest: fun_cong) |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
296 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
297 |
lemma istuple_surjective_proof_assist_step: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
298 |
"\<lbrakk> istuple_surjective_proof_assist v a (istuple_fst isom o f); |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
299 |
istuple_surjective_proof_assist v b (istuple_snd isom o f) \<rbrakk> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
300 |
\<Longrightarrow> istuple_surjective_proof_assist v (istuple_cons isom a b) f" |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
301 |
by (clarsimp simp: istuple_surjective_proof_assist_def simps |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
302 |
istuple_fst_def istuple_snd_def istuple_cons_def) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
303 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
304 |
lemma istuple_fst_update_accessor_cong_assist: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
305 |
"istuple_update_accessor_cong_assist f g \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
306 |
istuple_update_accessor_cong_assist (istuple_fst_update isom o f) (g o istuple_fst isom)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
307 |
by (clarsimp simp: istuple_update_accessor_cong_assist_def simps |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
308 |
istuple_fst_update_def istuple_fst_def) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
309 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
310 |
lemma istuple_snd_update_accessor_cong_assist: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
311 |
"istuple_update_accessor_cong_assist f g \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
312 |
istuple_update_accessor_cong_assist (istuple_snd_update isom o f) (g o istuple_snd isom)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
313 |
by (clarsimp simp: istuple_update_accessor_cong_assist_def simps |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
314 |
istuple_snd_update_def istuple_snd_def) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
315 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
316 |
lemma istuple_fst_update_accessor_eq_assist: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
317 |
"istuple_update_accessor_eq_assist f g a u a' v \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
318 |
istuple_update_accessor_eq_assist (istuple_fst_update isom o f) (g o istuple_fst isom) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
319 |
(istuple_cons isom a b) u (istuple_cons isom a' b) v" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
320 |
by (clarsimp simp: istuple_update_accessor_eq_assist_def istuple_fst_update_def istuple_fst_def |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
321 |
istuple_update_accessor_cong_assist_def istuple_cons_def simps) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
322 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
323 |
lemma istuple_snd_update_accessor_eq_assist: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
324 |
"istuple_update_accessor_eq_assist f g b u b' v \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
325 |
istuple_update_accessor_eq_assist (istuple_snd_update isom o f) (g o istuple_snd isom) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
326 |
(istuple_cons isom a b) u (istuple_cons isom a b') v" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
327 |
by (clarsimp simp: istuple_update_accessor_eq_assist_def istuple_snd_update_def istuple_snd_def |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
328 |
istuple_update_accessor_cong_assist_def istuple_cons_def simps) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
329 |
|
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
330 |
lemma istuple_cons_conj_eqI: |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
331 |
"\<lbrakk> (a = c \<and> b = d \<and> P) = Q \<rbrakk> \<Longrightarrow> |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
332 |
(istuple_cons isom a b = istuple_cons isom c d \<and> P) = Q" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
333 |
by (clarsimp simp: istuple_cons_def simps) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
334 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
335 |
lemmas intros = |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
336 |
istuple_access_update_fst_fst |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
337 |
istuple_access_update_snd_snd |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
338 |
istuple_access_update_fst_snd |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
339 |
istuple_access_update_snd_fst |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
340 |
istuple_update_swap_fst_fst |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
341 |
istuple_update_swap_snd_snd |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
342 |
istuple_update_swap_fst_snd |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
343 |
istuple_update_swap_snd_fst |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
344 |
istuple_update_compose_fst_fst |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
345 |
istuple_update_compose_snd_snd |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
346 |
istuple_surjective_proof_assist_step |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
347 |
istuple_fst_update_accessor_eq_assist |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
348 |
istuple_snd_update_accessor_eq_assist |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
349 |
istuple_fst_update_accessor_cong_assist |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
350 |
istuple_snd_update_accessor_cong_assist |
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
351 |
istuple_cons_conj_eqI |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
352 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
353 |
end |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
354 |
|
32745
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
355 |
lemma isomorphic_tuple_intro: |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
356 |
assumes repr_inj: "\<And>x y. (repr x = repr y) = (x = y)" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
357 |
and abst_inv: "\<And>z. repr (abst z) = z" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
358 |
shows "v \<equiv> TupleIsomorphism repr abst \<Longrightarrow> isomorphic_tuple v" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
359 |
apply (rule isomorphic_tuple.intro, |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
360 |
simp_all add: TupleIsomorphism_def Abs_tuple_isomorphism_inverse |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
361 |
tuple_isomorphism_def abst_inv) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
362 |
apply (cut_tac x="abst (repr x)" and y="x" in repr_inj) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
363 |
apply (simp add: abst_inv) |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
364 |
done |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
365 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
366 |
constdefs |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
367 |
"tuple_istuple \<equiv> TupleIsomorphism id id" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
368 |
|
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
369 |
lemma tuple_istuple: |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
370 |
"isomorphic_tuple tuple_istuple" |
192d58483fdf
Simplification of various aspects of the IsTuple component
Thomas Sewell <tsewell@nicta.com.au>
parents:
32744
diff
changeset
|
371 |
by (simp add: isomorphic_tuple_intro[OF _ _ reflexive] tuple_istuple_def) |
32743
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
372 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
373 |
lemma refl_conj_eq: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
374 |
"Q = R \<Longrightarrow> (P \<and> Q) = (P \<and> R)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
375 |
by simp |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
376 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
377 |
lemma meta_all_sameI: |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
378 |
"(\<And>x. PROP P x \<equiv> PROP Q x) \<Longrightarrow> (\<And>x. PROP P x) \<equiv> (\<And>x. PROP Q x)" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
379 |
by simp |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
380 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
381 |
lemma istuple_UNIV_I: "\<And>x. x\<in>UNIV \<equiv> True" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
382 |
by simp |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
383 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
384 |
lemma istuple_True_simp: "(True \<Longrightarrow> PROP P) \<equiv> PROP P" |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
385 |
by simp |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
386 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
387 |
use "Tools/istuple_support.ML"; |
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
388 |
|
c4e9a48bc50e
Initial attempt at porting record update to repository Isabelle.
tsewell@rubicon.NSW.bigpond.net.au
parents:
diff
changeset
|
389 |
end |