equal
deleted
inserted
replaced
156 apply (rule below_trans) |
156 apply (rule below_trans) |
157 apply (rule monofun_cfun_arg) |
157 apply (rule monofun_cfun_arg) |
158 apply (rule emb_prj_below) |
158 apply (rule emb_prj_below) |
159 apply simp |
159 apply simp |
160 done |
160 done |
|
161 |
|
162 text {* Isomorphism lemmas used internally by the domain package: *} |
|
163 |
|
164 lemma domain_abs_iso: |
|
165 fixes abs and rep |
|
166 assumes REP: "REP('b) = REP('a)" |
|
167 assumes abs_def: "abs \<equiv> (coerce :: 'a \<rightarrow> 'b)" |
|
168 assumes rep_def: "rep \<equiv> (coerce :: 'b \<rightarrow> 'a)" |
|
169 shows "rep\<cdot>(abs\<cdot>x) = x" |
|
170 unfolding abs_def rep_def by (simp add: REP) |
|
171 |
|
172 lemma domain_rep_iso: |
|
173 fixes abs and rep |
|
174 assumes REP: "REP('b) = REP('a)" |
|
175 assumes abs_def: "abs \<equiv> (coerce :: 'a \<rightarrow> 'b)" |
|
176 assumes rep_def: "rep \<equiv> (coerce :: 'b \<rightarrow> 'a)" |
|
177 shows "abs\<cdot>(rep\<cdot>x) = x" |
|
178 unfolding abs_def rep_def by (simp add: REP [symmetric]) |
|
179 |
161 |
180 |
162 subsection {* Proving a subtype is representable *} |
181 subsection {* Proving a subtype is representable *} |
163 |
182 |
164 text {* |
183 text {* |
165 Temporarily relax type constraints for @{term "approx"}, |
184 Temporarily relax type constraints for @{term "approx"}, |
669 alg_defl.basis_fun (\<lambda>b. |
688 alg_defl.basis_fun (\<lambda>b. |
670 alg_defl_principal ( |
689 alg_defl_principal ( |
671 Abs_fin_defl (udom_emb oo |
690 Abs_fin_defl (udom_emb oo |
672 f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo udom_prj))))" |
691 f\<cdot>(Rep_fin_defl a)\<cdot>(Rep_fin_defl b) oo udom_prj))))" |
673 |
692 |
674 definition "one_typ = REP(one)" |
|
675 definition "tr_typ = REP(tr)" |
|
676 definition "cfun_typ = TypeRep_fun2 cfun_map" |
693 definition "cfun_typ = TypeRep_fun2 cfun_map" |
677 definition "ssum_typ = TypeRep_fun2 ssum_map" |
694 definition "ssum_typ = TypeRep_fun2 ssum_map" |
678 definition "sprod_typ = TypeRep_fun2 sprod_map" |
695 definition "sprod_typ = TypeRep_fun2 sprod_map" |
679 definition "cprod_typ = TypeRep_fun2 cprod_map" |
696 definition "cprod_typ = TypeRep_fun2 cprod_map" |
680 definition "u_typ = TypeRep_fun1 u_map" |
697 definition "u_typ = TypeRep_fun1 u_map" |
785 apply (erule finite_deflation_convex_map) |
802 apply (erule finite_deflation_convex_map) |
786 done |
803 done |
787 |
804 |
788 text {* REP of type constructor = type combinator *} |
805 text {* REP of type constructor = type combinator *} |
789 |
806 |
790 lemma REP_one: "REP(one) = one_typ" |
|
791 by (simp only: one_typ_def) |
|
792 |
|
793 lemma REP_tr: "REP(tr) = tr_typ" |
|
794 by (simp only: tr_typ_def) |
|
795 |
|
796 lemma REP_cfun: "REP('a \<rightarrow> 'b) = cfun_typ\<cdot>REP('a)\<cdot>REP('b)" |
807 lemma REP_cfun: "REP('a \<rightarrow> 'b) = cfun_typ\<cdot>REP('a)\<cdot>REP('b)" |
797 apply (rule cast_eq_imp_eq, rule ext_cfun) |
808 apply (rule cast_eq_imp_eq, rule ext_cfun) |
798 apply (simp add: cast_REP cast_cfun_typ) |
809 apply (simp add: cast_REP cast_cfun_typ) |
799 apply (simp add: cfun_map_def) |
810 apply (simp add: cfun_map_def) |
800 apply (simp only: prj_cfun_def emb_cfun_def) |
811 apply (simp only: prj_cfun_def emb_cfun_def) |
857 apply (simp add: emb_convex_pd_def) |
868 apply (simp add: emb_convex_pd_def) |
858 apply (simp add: convex_map_map cfcomp1) |
869 apply (simp add: convex_map_map cfcomp1) |
859 done |
870 done |
860 |
871 |
861 lemmas REP_simps = |
872 lemmas REP_simps = |
862 REP_one |
|
863 REP_tr |
|
864 REP_cfun |
873 REP_cfun |
865 REP_ssum |
874 REP_ssum |
866 REP_sprod |
875 REP_sprod |
867 REP_cprod |
876 REP_cprod |
868 REP_up |
877 REP_up |
942 unfolding isodefl_def |
951 unfolding isodefl_def |
943 apply (simp add: expand_cfun_eq) |
952 apply (simp add: expand_cfun_eq) |
944 apply (simp add: emb_coerce coerce_prj REP) |
953 apply (simp add: emb_coerce coerce_prj REP) |
945 done |
954 done |
946 |
955 |
|
956 lemma isodefl_abs_rep: |
|
957 fixes abs and rep and d |
|
958 assumes REP: "REP('b) = REP('a)" |
|
959 assumes abs_def: "abs \<equiv> (coerce :: 'a \<rightarrow> 'b)" |
|
960 assumes rep_def: "rep \<equiv> (coerce :: 'b \<rightarrow> 'a)" |
|
961 shows "isodefl d t \<Longrightarrow> isodefl (abs oo d oo rep) t" |
|
962 unfolding abs_def rep_def using REP by (rule isodefl_coerce) |
|
963 |
947 lemma isodefl_cfun: |
964 lemma isodefl_cfun: |
948 "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> |
965 "isodefl d1 t1 \<Longrightarrow> isodefl d2 t2 \<Longrightarrow> |
949 isodefl (cfun_map\<cdot>d1\<cdot>d2) (cfun_typ\<cdot>t1\<cdot>t2)" |
966 isodefl (cfun_map\<cdot>d1\<cdot>d2) (cfun_typ\<cdot>t1\<cdot>t2)" |
950 apply (rule isodeflI) |
967 apply (rule isodeflI) |
951 apply (simp add: cast_cfun_typ cast_isodefl) |
968 apply (simp add: cast_cfun_typ cast_isodefl) |
977 apply (simp add: cast_u_typ cast_isodefl) |
994 apply (simp add: cast_u_typ cast_isodefl) |
978 apply (simp add: emb_u_def prj_u_def) |
995 apply (simp add: emb_u_def prj_u_def) |
979 apply (simp add: u_map_map) |
996 apply (simp add: u_map_map) |
980 done |
997 done |
981 |
998 |
982 lemma isodefl_one: "isodefl (ID :: one \<rightarrow> one) one_typ" |
|
983 unfolding one_typ_def by (rule isodefl_ID_REP) |
|
984 |
|
985 lemma isodefl_tr: "isodefl (ID :: tr \<rightarrow> tr) tr_typ" |
|
986 unfolding tr_typ_def by (rule isodefl_ID_REP) |
|
987 |
|
988 lemma isodefl_upper: |
999 lemma isodefl_upper: |
989 "isodefl d t \<Longrightarrow> isodefl (upper_map\<cdot>d) (upper_typ\<cdot>t)" |
1000 "isodefl d t \<Longrightarrow> isodefl (upper_map\<cdot>d) (upper_typ\<cdot>t)" |
990 apply (rule isodeflI) |
1001 apply (rule isodeflI) |
991 apply (simp add: cast_upper_typ cast_isodefl) |
1002 apply (simp add: cast_upper_typ cast_isodefl) |
992 apply (simp add: emb_upper_pd_def prj_upper_pd_def) |
1003 apply (simp add: emb_upper_pd_def prj_upper_pd_def) |