-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathComplex_Bounded_Linear_Function.thy
2981 lines (2622 loc) · 141 KB
/
Complex_Bounded_Linear_Function.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
section \<open>\<open>Complex_Bounded_Linear_Function\<close> -- Complex bounded linear functions (bounded operators)\<close>
(*
Authors:
Dominique Unruh, University of Tartu, [email protected]
Jose Manuel Rodriguez Caballero, University of Tartu, [email protected]
*)
theory Complex_Bounded_Linear_Function
imports
Complex_Inner_Product One_Dimensional_Spaces
Banach_Steinhaus.Banach_Steinhaus
"HOL-Types_To_Sets.Types_To_Sets"
Complex_Bounded_Linear_Function0
begin
subsection \<open>Misc basic facts and declarations\<close>
notation cblinfun_apply (infixr "*\<^sub>V" 70)
lemma id_cblinfun_apply[simp]: "id_cblinfun *\<^sub>V \<psi> = \<psi>"
apply transfer by simp
lemma isCont_cblinfun_apply[simp]: "isCont ((*\<^sub>V) A) \<psi>"
apply transfer
by (simp add: clinear_continuous_at)
declare cblinfun.scaleC_left[simp]
lemma cblinfun_apply_clinear[simp]: \<open>clinear (cblinfun_apply A)\<close>
using bounded_clinear.axioms(1) cblinfun_apply by blast
lemma cblinfun_cinner_eqI:
fixes A B :: \<open>'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'a\<close>
assumes \<open>\<And>\<psi>. cinner \<psi> (A *\<^sub>V \<psi>) = cinner \<psi> (B *\<^sub>V \<psi>)\<close>
shows \<open>A = B\<close>
proof -
define C where \<open>C = A - B\<close>
have C0[simp]: \<open>cinner \<psi> (C \<psi>) = 0\<close> for \<psi>
by (simp add: C_def assms cblinfun.diff_left cinner_diff_right)
{ fix f g \<alpha>
have \<open>0 = cinner (f + \<alpha> *\<^sub>C g) (C *\<^sub>V (f + \<alpha> *\<^sub>C g))\<close>
by (simp add: cinner_diff_right minus_cblinfun.rep_eq)
also have \<open>\<dots> = \<alpha> *\<^sub>C cinner f (C g) + cnj \<alpha> *\<^sub>C cinner g (C f)\<close>
by (smt (z3) C0 add.commute add.right_neutral cblinfun.add_right cblinfun.scaleC_right cblinfun_cinner_right.rep_eq cinner_add_left cinner_scaleC_left complex_scaleC_def)
finally have \<open>\<alpha> *\<^sub>C cinner f (C g) = - cnj \<alpha> *\<^sub>C cinner g (C f)\<close>
by (simp add: eq_neg_iff_add_eq_0)
}
then have \<open>cinner f (C g) = 0\<close> for f g
by (metis complex_cnj_i complex_cnj_one complex_vector.scale_cancel_right complex_vector.scale_left_imp_eq equation_minus_iff i_squared mult_eq_0_iff one_neq_neg_one)
then have \<open>C g = 0\<close> for g
using cinner_eq_zero_iff by blast
then have \<open>C = 0\<close>
by (simp add: cblinfun_eqI)
then show \<open>A = B\<close>
using C_def by auto
qed
lemma id_cblinfun_not_0[simp]: \<open>(id_cblinfun :: 'a::{complex_normed_vector, not_singleton} \<Rightarrow>\<^sub>C\<^sub>L _) \<noteq> 0\<close>
by (metis (full_types) Extra_General.UNIV_not_singleton cblinfun.zero_left cblinfun_id_cblinfun_apply ex_norm1 norm_zero one_neq_zero)
lemma cblinfun_norm_geqI:
assumes \<open>norm (f *\<^sub>V x) / norm x \<ge> K\<close>
shows \<open>norm f \<ge> K\<close>
using assms apply transfer
by (smt (z3) bounded_clinear.bounded_linear le_onorm)
(* This lemma is proven in Complex_Bounded_Linear_Function0 but we add the [simp]
only here because we try to keep Complex_Bounded_Linear_Function0 as close to
Bounded_Linear_Function as possible. *)
declare scaleC_conv_of_complex[simp]
lemma cblinfun_eq_0_on_span:
fixes S::\<open>'a::complex_normed_vector set\<close>
assumes "x \<in> cspan S"
and "\<And>s. s\<in>S \<Longrightarrow> F *\<^sub>V s = 0"
shows \<open>F *\<^sub>V x = 0\<close>
apply (rule complex_vector.linear_eq_0_on_span[where f=F])
using bounded_clinear.axioms(1) cblinfun_apply assms by auto
lemma cblinfun_eq_on_span:
fixes S::\<open>'a::complex_normed_vector set\<close>
assumes "x \<in> cspan S"
and "\<And>s. s\<in>S \<Longrightarrow> F *\<^sub>V s = G *\<^sub>V s"
shows \<open>F *\<^sub>V x = G *\<^sub>V x\<close>
apply (rule complex_vector.linear_eq_on_span[where f=F])
using bounded_clinear.axioms(1) cblinfun_apply assms by auto
lemma cblinfun_eq_0_on_UNIV_span:
fixes basis::\<open>'a::complex_normed_vector set\<close>
assumes "cspan basis = UNIV"
and "\<And>s. s\<in>basis \<Longrightarrow> F *\<^sub>V s = 0"
shows \<open>F = 0\<close>
by (metis cblinfun_eq_0_on_span UNIV_I assms cblinfun.zero_left cblinfun_eqI)
lemma cblinfun_eq_on_UNIV_span:
fixes basis::"'a::complex_normed_vector set" and \<phi>::"'a \<Rightarrow> 'b::complex_normed_vector"
assumes "cspan basis = UNIV"
and "\<And>s. s\<in>basis \<Longrightarrow> F *\<^sub>V s = G *\<^sub>V s"
shows \<open>F = G\<close>
proof-
have "F - G = 0"
apply (rule cblinfun_eq_0_on_UNIV_span[where basis=basis])
using assms by (auto simp add: cblinfun.diff_left)
thus ?thesis by simp
qed
lemma cblinfun_eq_on_canonical_basis:
fixes f g::"'a::{basis_enum,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector"
defines "basis == set (canonical_basis::'a list)"
assumes "\<And>u. u \<in> basis \<Longrightarrow> f *\<^sub>V u = g *\<^sub>V u"
shows "f = g"
apply (rule cblinfun_eq_on_UNIV_span[where basis=basis])
using assms is_generator_set is_cindependent_set by auto
lemma cblinfun_eq_0_on_canonical_basis:
fixes f ::"'a::{basis_enum,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector"
defines "basis == set (canonical_basis::'a list)"
assumes "\<And>u. u \<in> basis \<Longrightarrow> f *\<^sub>V u = 0"
shows "f = 0"
by (simp add: assms cblinfun_eq_on_canonical_basis)
lemma cinner_canonical_basis_eq_0:
defines "basisA == set (canonical_basis::'a::onb_enum list)"
and "basisB == set (canonical_basis::'b::onb_enum list)"
assumes "\<And>u v. u\<in>basisA \<Longrightarrow> v\<in>basisB \<Longrightarrow> \<langle>v, F *\<^sub>V u\<rangle> = 0"
shows "F = 0"
proof-
have "F *\<^sub>V u = 0"
if "u\<in>basisA" for u
proof-
have "\<And>v. v\<in>basisB \<Longrightarrow> \<langle>v, F *\<^sub>V u\<rangle> = 0"
by (simp add: assms(3) that)
moreover have "(\<And>v. v\<in>basisB \<Longrightarrow> \<langle>v, x\<rangle> = 0) \<Longrightarrow> x = 0"
for x
proof-
assume r1: "\<And>v. v\<in>basisB \<Longrightarrow> \<langle>v, x\<rangle> = 0"
have "\<langle>v, x\<rangle> = 0" for v
proof-
have "cspan basisB = UNIV"
using basisB_def is_generator_set by auto
hence "v \<in> cspan basisB"
by (smt iso_tuple_UNIV_I)
hence "\<exists>t s. v = (\<Sum>a\<in>t. s a *\<^sub>C a) \<and> finite t \<and> t \<subseteq> basisB"
using complex_vector.span_explicit
by (smt mem_Collect_eq)
then obtain t s where b1: "v = (\<Sum>a\<in>t. s a *\<^sub>C a)" and b2: "finite t" and b3: "t \<subseteq> basisB"
by blast
have "\<langle>v, x\<rangle> = \<langle>(\<Sum>a\<in>t. s a *\<^sub>C a), x\<rangle>"
by (simp add: b1)
also have "\<dots> = (\<Sum>a\<in>t. \<langle>s a *\<^sub>C a, x\<rangle>)"
using cinner_sum_left by blast
also have "\<dots> = (\<Sum>a\<in>t. cnj (s a) * \<langle>a, x\<rangle>)"
by auto
also have "\<dots> = 0"
using b3 r1 subsetD by force
finally show ?thesis by simp
qed
thus ?thesis
by (simp add: \<open>\<And>v. \<langle>v, x\<rangle> = 0\<close> cinner_extensionality)
qed
ultimately show ?thesis by simp
qed
thus ?thesis
using basisA_def cblinfun_eq_0_on_canonical_basis by auto
qed
lemma cinner_canonical_basis_eq:
defines "basisA == set (canonical_basis::'a::onb_enum list)"
and "basisB == set (canonical_basis::'b::onb_enum list)"
assumes "\<And>u v. u\<in>basisA \<Longrightarrow> v\<in>basisB \<Longrightarrow> \<langle>v, F *\<^sub>V u\<rangle> = \<langle>v, G *\<^sub>V u\<rangle>"
shows "F = G"
proof-
define H where "H = F - G"
have "\<And>u v. u\<in>basisA \<Longrightarrow> v\<in>basisB \<Longrightarrow> \<langle>v, H *\<^sub>V u\<rangle> = 0"
unfolding H_def
by (simp add: assms(3) cinner_diff_right minus_cblinfun.rep_eq)
hence "H = 0"
by (simp add: basisA_def basisB_def cinner_canonical_basis_eq_0)
thus ?thesis unfolding H_def by simp
qed
lemma cinner_canonical_basis_eq':
defines "basisA == set (canonical_basis::'a::onb_enum list)"
and "basisB == set (canonical_basis::'b::onb_enum list)"
assumes "\<And>u v. u\<in>basisA \<Longrightarrow> v\<in>basisB \<Longrightarrow> \<langle>F *\<^sub>V u, v\<rangle> = \<langle>G *\<^sub>V u, v\<rangle>"
shows "F = G"
using cinner_canonical_basis_eq assms
by (metis cinner_commute')
lemma cblinfun_norm_approx_witness:
fixes A :: \<open>'a::{not_singleton,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector\<close>
assumes \<open>\<epsilon> > 0\<close>
shows \<open>\<exists>\<psi>. norm (A *\<^sub>V \<psi>) \<ge> norm A - \<epsilon> \<and> norm \<psi> = 1\<close>
proof (transfer fixing: \<epsilon>)
fix A :: \<open>'a \<Rightarrow> 'b\<close> assume [simp]: \<open>bounded_clinear A\<close>
have \<open>\<exists>y\<in>{norm (A x) |x. norm x = 1}. y > \<Squnion> {norm (A x) |x. norm x = 1} - \<epsilon>\<close>
apply (rule Sup_real_close)
using assms by (auto simp: ex_norm1 bounded_clinear.bounded_linear bdd_above_norm_f)
also have \<open>\<Squnion> {norm (A x) |x. norm x = 1} = onorm A\<close>
by (simp add: Complex_Vector_Spaces0.bounded_clinear.bounded_linear onorm_sphere)
finally
show \<open>\<exists>\<psi>. onorm A - \<epsilon> \<le> norm (A \<psi>) \<and> norm \<psi> = 1\<close>
by force
qed
lemma cblinfun_norm_approx_witness_mult:
fixes A :: \<open>'a::{not_singleton,complex_normed_vector} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector\<close>
assumes \<open>\<epsilon> < 1\<close>
shows \<open>\<exists>\<psi>. norm (A *\<^sub>V \<psi>) \<ge> norm A * \<epsilon> \<and> norm \<psi> = 1\<close>
proof (cases \<open>norm A = 0\<close>)
case True
then show ?thesis
apply auto
by (simp add: ex_norm1)
next
case False
then have \<open>(1 - \<epsilon>) * norm A > 0\<close>
using assms by fastforce
then obtain \<psi> where geq: \<open>norm (A *\<^sub>V \<psi>) \<ge> norm A - ((1 - \<epsilon>) * norm A)\<close> and \<open>norm \<psi> = 1\<close>
using cblinfun_norm_approx_witness by blast
have \<open>norm A * \<epsilon> = norm A - (1 - \<epsilon>) * norm A\<close>
by (simp add: mult.commute right_diff_distrib')
also have \<open>\<dots> \<le> norm (A *\<^sub>V \<psi>)\<close>
by (rule geq)
finally show ?thesis
using \<open>norm \<psi> = 1\<close> by auto
qed
lemma cblinfun_to_CARD_1_0[simp]: \<open>(A :: _ \<Rightarrow>\<^sub>C\<^sub>L _::CARD_1) = 0\<close>
apply (rule cblinfun_eqI)
by auto
lemma cblinfun_from_CARD_1_0[simp]: \<open>(A :: _::CARD_1 \<Rightarrow>\<^sub>C\<^sub>L _) = 0\<close>
apply (rule cblinfun_eqI)
apply (subst CARD_1_vec_0)
by auto
lemma cblinfun_cspan_UNIV:
fixes basis :: \<open>('a::{complex_normed_vector,cfinite_dim} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector) set\<close>
and basisA :: \<open>'a set\<close> and basisB :: \<open>'b set\<close>
assumes \<open>cspan basisA = UNIV\<close> and \<open>cspan basisB = UNIV\<close>
assumes basis: \<open>\<And>a b. a\<in>basisA \<Longrightarrow> b\<in>basisB \<Longrightarrow> \<exists>F\<in>basis. \<forall>a'\<in>basisA. F *\<^sub>V a' = (if a'=a then b else 0)\<close>
shows \<open>cspan basis = UNIV\<close>
proof -
obtain basisA' where \<open>basisA' \<subseteq> basisA\<close> and \<open>cindependent basisA'\<close> and \<open>cspan basisA' = UNIV\<close>
by (metis assms(1) complex_vector.maximal_independent_subset complex_vector.span_eq top_greatest)
then have [simp]: \<open>finite basisA'\<close>
by (simp add: cindependent_cfinite_dim_finite)
have basis': \<open>\<And>a b. a\<in>basisA' \<Longrightarrow> b\<in>basisB \<Longrightarrow> \<exists>F\<in>basis. \<forall>a'\<in>basisA'. F *\<^sub>V a' = (if a'=a then b else 0)\<close>
using basis \<open>basisA' \<subseteq> basisA\<close> by fastforce
obtain F where F: \<open>F a b \<in> basis \<and> F a b *\<^sub>V a' = (if a'=a then b else 0)\<close>
if \<open>a\<in>basisA'\<close> \<open>b\<in>basisB\<close> \<open>a'\<in>basisA'\<close> for a b a'
apply atomize_elim apply (intro choice allI)
using basis' by metis
then have F_apply: \<open>F a b *\<^sub>V a' = (if a'=a then b else 0)\<close>
if \<open>a\<in>basisA'\<close> \<open>b\<in>basisB\<close> \<open>a'\<in>basisA'\<close> for a b a'
using that by auto
have F_basis: \<open>F a b \<in> basis\<close>
if \<open>a\<in>basisA'\<close> \<open>b\<in>basisB\<close> for a b
using that F by auto
have b_span: \<open>\<exists>G\<in>cspan {F a b|b. b\<in>basisB}. \<forall>a'\<in>basisA'. G *\<^sub>V a' = (if a'=a then b else 0)\<close> if \<open>a\<in>basisA'\<close> for a b
proof -
from \<open>cspan basisB = UNIV\<close>
obtain r t where \<open>finite t\<close> and \<open>t \<subseteq> basisB\<close> and b_lincom: \<open>b = (\<Sum>a\<in>t. r a *\<^sub>C a)\<close>
unfolding complex_vector.span_alt apply atomize_elim by blast
define G where \<open>G = (\<Sum>i\<in>t. r i *\<^sub>C F a i)\<close>
have \<open>G \<in> cspan {F a b|b. b\<in>basisB}\<close>
using \<open>finite t\<close> \<open>t \<subseteq> basisB\<close> unfolding G_def
by (smt (verit, ccfv_threshold) complex_vector.span_base complex_vector.span_scale complex_vector.span_sum mem_Collect_eq subset_eq)
moreover have \<open>G *\<^sub>V a' = (if a'=a then b else 0)\<close> if \<open>a'\<in>basisA'\<close> for a'
apply (cases \<open>a'=a\<close>)
using \<open>t \<subseteq> basisB\<close> \<open>a\<in>basisA'\<close> \<open>a'\<in>basisA'\<close>
by (auto simp: b_lincom G_def cblinfun.sum_left F_apply intro!: sum.neutral sum.cong)
ultimately show ?thesis
by blast
qed
have a_span: \<open>cspan (\<Union>a\<in>basisA'. cspan {F a b|b. b\<in>basisB}) = UNIV\<close>
proof (intro equalityI subset_UNIV subsetI, rename_tac H)
fix H
obtain G where G: \<open>G a b \<in> cspan {F a b|b. b\<in>basisB} \<and> G a b *\<^sub>V a' = (if a'=a then b else 0)\<close> if \<open>a\<in>basisA'\<close> and \<open>a'\<in>basisA'\<close> for a b a'
apply atomize_elim apply (intro choice allI)
using b_span by blast
then have G_cspan: \<open>G a b \<in> cspan {F a b|b. b\<in>basisB}\<close> if \<open>a\<in>basisA'\<close> for a b
using that by auto
from G have G: \<open>G a b *\<^sub>V a' = (if a'=a then b else 0)\<close> if \<open>a\<in>basisA'\<close> and \<open>a'\<in>basisA'\<close> for a b a'
using that by auto
define H' where \<open>H' = (\<Sum>a\<in>basisA'. G a (H *\<^sub>V a))\<close>
have \<open>H' \<in> cspan (\<Union>a\<in>basisA'. cspan {F a b|b. b\<in>basisB})\<close>
unfolding H'_def using G_cspan
by (smt (verit, del_insts) UN_iff complex_vector.span_clauses(1) complex_vector.span_sum)
moreover have \<open>H' = H\<close>
using \<open>cspan basisA' = UNIV\<close> apply (rule cblinfun_eq_on_UNIV_span)
apply (auto simp: H'_def cblinfun.sum_left)
apply (subst sum_single)
by (auto simp: G)
ultimately show \<open>H \<in> cspan (\<Union>a\<in>basisA'. cspan {F a b |b. b \<in> basisB})\<close>
by simp
qed
moreover have \<open>cspan basis \<supseteq> cspan (\<Union>a\<in>basisA'. cspan {F a b|b. b\<in>basisB})\<close>
using F_basis
by (smt (z3) UN_subset_iff complex_vector.span_alt complex_vector.span_minimal complex_vector.subspace_span mem_Collect_eq subset_iff)
ultimately show \<open>cspan basis = UNIV\<close>
by auto
qed
instance cblinfun :: (\<open>{cfinite_dim,complex_normed_vector}\<close>, \<open>{cfinite_dim,complex_normed_vector}\<close>) cfinite_dim
proof intro_classes
obtain basisA :: \<open>'a set\<close> where [simp]: \<open>cspan basisA = UNIV\<close> \<open>cindependent basisA\<close> \<open>finite basisA\<close>
using finite_basis by blast
obtain basisB :: \<open>'b set\<close> where [simp]: \<open>cspan basisB = UNIV\<close> \<open>cindependent basisB\<close> \<open>finite basisB\<close>
using finite_basis by blast
define f where \<open>f a b = cconstruct basisA (\<lambda>x. if x=a then b else 0)\<close> for a :: 'a and b :: 'b
have f_a: \<open>f a b a = b\<close> if \<open>a : basisA\<close> for a b
by (simp add: complex_vector.construct_basis f_def that)
have f_not_a: \<open>f a b c = 0\<close> if \<open>a : basisA\<close> and \<open>c : basisA\<close> and \<open>a \<noteq> c\<close>for a b c
using that by (simp add: complex_vector.construct_basis f_def)
define F where \<open>F a b = CBlinfun (f a b)\<close> for a b
have \<open>clinear (f a b)\<close> for a b
by (auto intro: complex_vector.linear_construct simp: f_def)
then have \<open>bounded_clinear (f a b)\<close> for a b
by auto
then have F_apply: \<open>cblinfun_apply (F a b) = f a b\<close> for a b
by (simp add: F_def bounded_clinear_CBlinfun_apply)
define basis where \<open>basis = {F a b| a b. a\<in>basisA \<and> b\<in>basisB}\<close>
have \<open>cspan basis = UNIV\<close>
apply (rule cblinfun_cspan_UNIV[where basisA=basisA and basisB=basisB])
apply (auto simp: basis_def)
by (metis F_apply f_a f_not_a)
moreover have \<open>finite basis\<close>
unfolding basis_def apply (rule finite_image_set2) by auto
ultimately show \<open>\<exists>S :: ('a \<Rightarrow>\<^sub>C\<^sub>L 'b) set. finite S \<and> cspan S = UNIV\<close>
by auto
qed
subsection \<open>Relationship to real bounded operators (\<^typ>\<open>_ \<Rightarrow>\<^sub>L _\<close>)\<close>
instantiation blinfun :: (real_normed_vector, complex_normed_vector) "complex_normed_vector"
begin
lift_definition scaleC_blinfun :: \<open>complex \<Rightarrow>
('a::real_normed_vector, 'b::complex_normed_vector) blinfun \<Rightarrow>
('a, 'b) blinfun\<close>
is \<open>\<lambda> c::complex. \<lambda> f::'a\<Rightarrow>'b. (\<lambda> x. c *\<^sub>C (f x) )\<close>
proof
fix c::complex and f :: \<open>'a\<Rightarrow>'b\<close> and b1::'a and b2::'a
assume \<open>bounded_linear f\<close>
show \<open>c *\<^sub>C f (b1 + b2) = c *\<^sub>C f b1 + c *\<^sub>C f b2\<close>
by (simp add: \<open>bounded_linear f\<close> linear_simps scaleC_add_right)
fix c::complex and f :: \<open>'a\<Rightarrow>'b\<close> and b::'a and r::real
assume \<open>bounded_linear f\<close>
show \<open>c *\<^sub>C f (r *\<^sub>R b) = r *\<^sub>R (c *\<^sub>C f b)\<close>
by (simp add: \<open>bounded_linear f\<close> linear_simps(5) scaleR_scaleC)
fix c::complex and f :: \<open>'a\<Rightarrow>'b\<close>
assume \<open>bounded_linear f\<close>
have \<open>\<exists> K. \<forall> x. norm (f x) \<le> norm x * K\<close>
using \<open>bounded_linear f\<close>
by (simp add: bounded_linear.bounded)
then obtain K where \<open>\<forall> x. norm (f x) \<le> norm x * K\<close>
by blast
have \<open>cmod c \<ge> 0\<close>
by simp
hence \<open>\<forall> x. (cmod c) * norm (f x) \<le> (cmod c) * norm x * K\<close>
using \<open>\<forall> x. norm (f x) \<le> norm x * K\<close>
by (metis ordered_comm_semiring_class.comm_mult_left_mono vector_space_over_itself.scale_scale)
moreover have \<open>norm (c *\<^sub>C f x) = (cmod c) * norm (f x)\<close>
for x
by simp
ultimately show \<open>\<exists>K. \<forall>x. norm (c *\<^sub>C f x) \<le> norm x * K\<close>
by (metis ab_semigroup_mult_class.mult_ac(1) mult.commute)
qed
instance
proof
have "r *\<^sub>R x = complex_of_real r *\<^sub>C x"
for x :: "('a, 'b) blinfun" and r
apply transfer
by (simp add: scaleR_scaleC)
thus "((*\<^sub>R) r::'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> _) = (*\<^sub>C) (complex_of_real r)" for r
by auto
show "a *\<^sub>C (x + y) = a *\<^sub>C x + a *\<^sub>C y"
for a :: complex and x y :: "'a \<Rightarrow>\<^sub>L 'b"
apply transfer
by (simp add: scaleC_add_right)
show "(a + b) *\<^sub>C x = a *\<^sub>C x + b *\<^sub>C x"
for a b :: complex and x :: "'a \<Rightarrow>\<^sub>L 'b"
apply transfer
by (simp add: scaleC_add_left)
show "a *\<^sub>C b *\<^sub>C x = (a * b) *\<^sub>C x"
for a b :: complex and x :: "'a \<Rightarrow>\<^sub>L 'b"
apply transfer
by simp
have \<open>1 *\<^sub>C f x = f x\<close>
for f :: \<open>'a\<Rightarrow>'b\<close> and x
by auto
thus "1 *\<^sub>C x = x"
for x :: "'a \<Rightarrow>\<^sub>L 'b"
by (simp add: scaleC_blinfun.rep_eq blinfun_eqI)
have \<open>onorm (\<lambda>x. a *\<^sub>C f x) = cmod a * onorm f\<close>
if \<open>bounded_linear f\<close>
for f :: \<open>'a \<Rightarrow> 'b\<close> and a :: complex
proof-
have \<open>cmod a \<ge> 0\<close>
by simp
have \<open>\<exists> K::real. \<forall> x. (\<bar> ereal ((norm (f x)) / (norm x)) \<bar>) \<le> K\<close>
using \<open>bounded_linear f\<close> le_onorm by fastforce
then obtain K::real where \<open>\<forall> x. (\<bar> ereal ((norm (f x)) / (norm x)) \<bar>) \<le> K\<close>
by blast
hence \<open>\<forall> x. (cmod a) *(\<bar> ereal ((norm (f x)) / (norm x)) \<bar>) \<le> (cmod a) * K\<close>
using \<open>cmod a \<ge> 0\<close>
by (metis abs_ereal.simps(1) abs_ereal_pos abs_pos ereal_mult_left_mono times_ereal.simps(1))
hence \<open>\<forall> x. (\<bar> ereal ((cmod a) * (norm (f x)) / (norm x)) \<bar>) \<le> (cmod a) * K\<close>
by simp
hence \<open>bdd_above {ereal (cmod a * (norm (f x)) / (norm x)) | x. True}\<close>
by simp
moreover have \<open>{ereal (cmod a * (norm (f x)) / (norm x)) | x. True} \<noteq> {}\<close>
by auto
ultimately have p1: \<open>(SUP x. \<bar>ereal (cmod a * (norm (f x)) / (norm x))\<bar>) \<le> cmod a * K\<close>
using \<open>\<forall> x. \<bar> ereal (cmod a * (norm (f x)) / (norm x)) \<bar> \<le> cmod a * K\<close>
Sup_least mem_Collect_eq
by (simp add: SUP_le_iff)
have p2: \<open>\<And>i. i \<in> UNIV \<Longrightarrow> 0 \<le> ereal (cmod a * norm (f i) / norm i)\<close>
by simp
hence \<open>\<bar>SUP x. ereal (cmod a * (norm (f x)) / (norm x))\<bar>
\<le> (SUP x. \<bar>ereal (cmod a * (norm (f x)) / (norm x))\<bar>)\<close>
using \<open>bdd_above {ereal (cmod a * (norm (f x)) / (norm x)) | x. True}\<close>
\<open>{ereal (cmod a * (norm (f x)) / (norm x)) | x. True} \<noteq> {}\<close>
by (metis (mono_tags, lifting) SUP_upper2 Sup.SUP_cong UNIV_I
p2 abs_ereal_ge0 ereal_le_real)
hence \<open>\<bar>SUP x. ereal (cmod a * (norm (f x)) / (norm x))\<bar> \<le> cmod a * K\<close>
using \<open>(SUP x. \<bar>ereal (cmod a * (norm (f x)) / (norm x))\<bar>) \<le> cmod a * K\<close>
by simp
hence \<open>\<bar> ( SUP i\<in>UNIV::'a set. ereal ((\<lambda> x. (cmod a) * (norm (f x)) / norm x) i)) \<bar> \<noteq> \<infinity>\<close>
by auto
hence w2: \<open>( SUP i\<in>UNIV::'a set. ereal ((\<lambda> x. cmod a * (norm (f x)) / norm x) i))
= ereal ( Sup ((\<lambda> x. cmod a * (norm (f x)) / norm x) ` (UNIV::'a set) ))\<close>
by (simp add: ereal_SUP)
have \<open>(UNIV::('a set)) \<noteq> {}\<close>
by simp
moreover have \<open>\<And> i. i \<in> (UNIV::('a set)) \<Longrightarrow> (\<lambda> x. (norm (f x)) / norm x :: ereal) i \<ge> 0\<close>
by simp
moreover have \<open>cmod a \<ge> 0\<close>
by simp
ultimately have \<open>(SUP i\<in>(UNIV::('a set)). ((cmod a)::ereal) * (\<lambda> x. (norm (f x)) / norm x :: ereal) i )
= ((cmod a)::ereal) * ( SUP i\<in>(UNIV::('a set)). (\<lambda> x. (norm (f x)) / norm x :: ereal) i )\<close>
by (simp add: Sup_ereal_mult_left')
hence \<open>(SUP x. ((cmod a)::ereal) * ( (norm (f x)) / norm x :: ereal) )
= ((cmod a)::ereal) * ( SUP x. ( (norm (f x)) / norm x :: ereal) )\<close>
by simp
hence z1: \<open>real_of_ereal ( (SUP x. ((cmod a)::ereal) * ( (norm (f x)) / norm x :: ereal) ) )
= real_of_ereal ( ((cmod a)::ereal) * ( SUP x. ( (norm (f x)) / norm x :: ereal) ) )\<close>
by simp
have z2: \<open>real_of_ereal (SUP x. ((cmod a)::ereal) * ( (norm (f x)) / norm x :: ereal) )
= (SUP x. cmod a * (norm (f x) / norm x))\<close>
using w2
by auto
have \<open>real_of_ereal ( ((cmod a)::ereal) * ( SUP x. ( (norm (f x)) / norm x :: ereal) ) )
= (cmod a) * real_of_ereal ( SUP x. ( (norm (f x)) / norm x :: ereal) )\<close>
by simp
moreover have \<open>real_of_ereal ( SUP x. ( (norm (f x)) / norm x :: ereal) )
= ( SUP x. ((norm (f x)) / norm x) )\<close>
proof-
have \<open>\<bar> ( SUP i\<in>UNIV::'a set. ereal ((\<lambda> x. (norm (f x)) / norm x) i)) \<bar> \<noteq> \<infinity>\<close>
proof-
have \<open>\<exists> K::real. \<forall> x. (\<bar> ereal ((norm (f x)) / (norm x)) \<bar>) \<le> K\<close>
using \<open>bounded_linear f\<close> le_onorm by fastforce
then obtain K::real where \<open>\<forall> x. (\<bar> ereal ((norm (f x)) / (norm x)) \<bar>) \<le> K\<close>
by blast
hence \<open>bdd_above {ereal ((norm (f x)) / (norm x)) | x. True}\<close>
by simp
moreover have \<open>{ereal ((norm (f x)) / (norm x)) | x. True} \<noteq> {}\<close>
by auto
ultimately have \<open>(SUP x. \<bar>ereal ((norm (f x)) / (norm x))\<bar>) \<le> K\<close>
using \<open>\<forall> x. \<bar> ereal ((norm (f x)) / (norm x)) \<bar> \<le> K\<close>
Sup_least mem_Collect_eq
by (simp add: SUP_le_iff)
hence \<open>\<bar>SUP x. ereal ((norm (f x)) / (norm x))\<bar>
\<le> (SUP x. \<bar>ereal ((norm (f x)) / (norm x))\<bar>)\<close>
using \<open>bdd_above {ereal ((norm (f x)) / (norm x)) | x. True}\<close>
\<open>{ereal ((norm (f x)) / (norm x)) | x. True} \<noteq> {}\<close>
by (metis (mono_tags, lifting) SUP_upper2 Sup.SUP_cong UNIV_I \<open>\<And>i. i \<in> UNIV \<Longrightarrow> 0 \<le> ereal (norm (f i) / norm i)\<close> abs_ereal_ge0 ereal_le_real)
hence \<open>\<bar>SUP x. ereal ((norm (f x)) / (norm x))\<bar> \<le> K\<close>
using \<open>(SUP x. \<bar>ereal ((norm (f x)) / (norm x))\<bar>) \<le> K\<close>
by simp
thus ?thesis
by auto
qed
hence \<open> ( SUP i\<in>UNIV::'a set. ereal ((\<lambda> x. (norm (f x)) / norm x) i))
= ereal ( Sup ((\<lambda> x. (norm (f x)) / norm x) ` (UNIV::'a set) ))\<close>
by (simp add: ereal_SUP)
thus ?thesis
by simp
qed
have z3: \<open>real_of_ereal ( ((cmod a)::ereal) * ( SUP x. ( (norm (f x)) / norm x :: ereal) ) )
= cmod a * (SUP x. norm (f x) / norm x)\<close>
by (simp add: \<open>real_of_ereal (SUP x. ereal (norm (f x) / norm x)) = (SUP x. norm (f x) / norm x)\<close>)
hence w1: \<open>(SUP x. cmod a * (norm (f x) / norm x)) =
cmod a * (SUP x. norm (f x) / norm x)\<close>
using z1 z2 by linarith
have v1: \<open>onorm (\<lambda>x. a *\<^sub>C f x) = (SUP x. norm (a *\<^sub>C f x) / norm x)\<close>
by (simp add: onorm_def)
have v2: \<open>(SUP x. norm (a *\<^sub>C f x) / norm x) = (SUP x. ((cmod a) * norm (f x)) / norm x)\<close>
by simp
have v3: \<open>(SUP x. ((cmod a) * norm (f x)) / norm x) = (SUP x. (cmod a) * ((norm (f x)) / norm x))\<close>
by simp
have v4: \<open>(SUP x. (cmod a) * ((norm (f x)) / norm x)) = (cmod a) * (SUP x. ((norm (f x)) / norm x))\<close>
using w1
by blast
show \<open>onorm (\<lambda>x. a *\<^sub>C f x) = cmod a * onorm f\<close>
using v1 v2 v3 v4
by (metis (mono_tags, lifting) onorm_def)
qed
thus \<open>norm (a *\<^sub>C x) = cmod a * norm x\<close>
for a::complex and x::\<open>('a, 'b) blinfun\<close>
apply transfer
by blast
qed
end
(* We do not have clinear_blinfun_compose_right *)
lemma clinear_blinfun_compose_left: \<open>clinear (\<lambda>x. blinfun_compose x y)\<close>
by (auto intro!: clinearI simp: blinfun_eqI scaleC_blinfun.rep_eq bounded_bilinear.add_left
bounded_bilinear_blinfun_compose)
instantiation blinfun :: (real_normed_vector, cbanach) "cbanach"
begin
instance..
end
lemma blinfun_compose_assoc: "(A o\<^sub>L B) o\<^sub>L C = A o\<^sub>L (B o\<^sub>L C)"
by (simp add: blinfun_eqI)
lift_definition blinfun_of_cblinfun::\<open>'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector
\<Rightarrow> 'a \<Rightarrow>\<^sub>L 'b\<close> is "id"
apply transfer by (simp add: bounded_clinear.bounded_linear)
lift_definition blinfun_cblinfun_eq ::
\<open>'a \<Rightarrow>\<^sub>L 'b \<Rightarrow> 'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector \<Rightarrow> bool\<close> is "(=)" .
lemma blinfun_cblinfun_eq_bi_unique[transfer_rule]: \<open>bi_unique blinfun_cblinfun_eq\<close>
unfolding bi_unique_def apply transfer by auto
lemma blinfun_cblinfun_eq_right_total[transfer_rule]: \<open>right_total blinfun_cblinfun_eq\<close>
unfolding right_total_def apply transfer
by (simp add: bounded_clinear.bounded_linear)
named_theorems cblinfun_blinfun_transfer
lemma cblinfun_blinfun_transfer_0[cblinfun_blinfun_transfer]:
"blinfun_cblinfun_eq (0::(_,_) blinfun) (0::(_,_) cblinfun)"
apply transfer by simp
lemma cblinfun_blinfun_transfer_plus[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) (+) (+)"
unfolding rel_fun_def apply transfer by auto
lemma cblinfun_blinfun_transfer_minus[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) (-) (-)"
unfolding rel_fun_def apply transfer by auto
lemma cblinfun_blinfun_transfer_uminus[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) (uminus) (uminus)"
unfolding rel_fun_def apply transfer by auto
definition "real_complex_eq r c \<longleftrightarrow> complex_of_real r = c"
lemma bi_unique_real_complex_eq[transfer_rule]: \<open>bi_unique real_complex_eq\<close>
unfolding real_complex_eq_def bi_unique_def by auto
lemma left_total_real_complex_eq[transfer_rule]: \<open>left_total real_complex_eq\<close>
unfolding real_complex_eq_def left_total_def by auto
lemma cblinfun_blinfun_transfer_scaleC[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(real_complex_eq ===> blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) (scaleR) (scaleC)"
unfolding rel_fun_def apply transfer
by (simp add: real_complex_eq_def scaleR_scaleC)
lemma cblinfun_blinfun_transfer_CBlinfun[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(eq_onp bounded_clinear ===> blinfun_cblinfun_eq) Blinfun CBlinfun"
unfolding rel_fun_def blinfun_cblinfun_eq.rep_eq eq_onp_def
by (auto simp: CBlinfun_inverse Blinfun_inverse bounded_clinear.bounded_linear)
lemma cblinfun_blinfun_transfer_norm[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> (=)) norm norm"
unfolding rel_fun_def apply transfer by auto
lemma cblinfun_blinfun_transfer_dist[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq ===> (=)) dist dist"
unfolding rel_fun_def dist_norm apply transfer by auto
lemma cblinfun_blinfun_transfer_sgn[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) sgn sgn"
unfolding rel_fun_def sgn_blinfun_def sgn_cblinfun_def apply transfer
by (auto simp: scaleR_scaleC)
lemma cblinfun_blinfun_transfer_Cauchy[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(((=) ===> blinfun_cblinfun_eq) ===> (=)) Cauchy Cauchy"
proof -
note cblinfun_blinfun_transfer[transfer_rule]
show ?thesis
unfolding Cauchy_def
by transfer_prover
qed
lemma cblinfun_blinfun_transfer_tendsto[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(((=) ===> blinfun_cblinfun_eq) ===> blinfun_cblinfun_eq ===> (=) ===> (=)) tendsto tendsto"
proof -
note cblinfun_blinfun_transfer[transfer_rule]
show ?thesis
unfolding tendsto_iff
by transfer_prover
qed
lemma cblinfun_blinfun_transfer_compose[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> blinfun_cblinfun_eq ===> blinfun_cblinfun_eq) (o\<^sub>L) (o\<^sub>C\<^sub>L)"
unfolding rel_fun_def apply transfer by auto
lemma cblinfun_blinfun_transfer_apply[cblinfun_blinfun_transfer]:
includes lifting_syntax
shows "(blinfun_cblinfun_eq ===> (=) ===> (=)) blinfun_apply cblinfun_apply"
unfolding rel_fun_def apply transfer by auto
lemma blinfun_of_cblinfun_inj:
\<open>blinfun_of_cblinfun f = blinfun_of_cblinfun g \<Longrightarrow> f = g\<close>
by (metis cblinfun_apply_inject blinfun_of_cblinfun.rep_eq)
lemma blinfun_of_cblinfun_inv:
assumes "\<And>c. \<And>x. f *\<^sub>v (c *\<^sub>C x) = c *\<^sub>C (f *\<^sub>v x)"
shows "\<exists>g. blinfun_of_cblinfun g = f"
using assms
proof transfer
show "\<exists>g\<in>Collect bounded_clinear. id g = f"
if "bounded_linear f"
and "\<And>c x. f (c *\<^sub>C x) = c *\<^sub>C f x"
for f :: "'a \<Rightarrow> 'b"
using that bounded_linear_bounded_clinear by auto
qed
lemma blinfun_of_cblinfun_zero:
\<open>blinfun_of_cblinfun 0 = 0\<close>
apply transfer by simp
lemma blinfun_of_cblinfun_uminus:
\<open>blinfun_of_cblinfun (- f) = - (blinfun_of_cblinfun f)\<close>
apply transfer
by auto
lemma blinfun_of_cblinfun_minus:
\<open>blinfun_of_cblinfun (f - g) = blinfun_of_cblinfun f - blinfun_of_cblinfun g\<close>
apply transfer
by auto
lemma blinfun_of_cblinfun_scaleC:
\<open>blinfun_of_cblinfun (c *\<^sub>C f) = c *\<^sub>C (blinfun_of_cblinfun f)\<close>
apply transfer
by auto
lemma blinfun_of_cblinfun_scaleR:
\<open>blinfun_of_cblinfun (c *\<^sub>R f) = c *\<^sub>R (blinfun_of_cblinfun f)\<close>
apply transfer by auto
lemma blinfun_of_cblinfun_norm:
fixes f::\<open>'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_normed_vector\<close>
shows \<open>norm f = norm (blinfun_of_cblinfun f)\<close>
apply transfer by auto
subsection \<open>Composition\<close>
lemma blinfun_of_cblinfun_cblinfun_compose:
fixes f::\<open>'b::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_normed_vector\<close>
and g::\<open>'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b\<close>
shows \<open>blinfun_of_cblinfun (f o\<^sub>C\<^sub>L g) = (blinfun_of_cblinfun f) o\<^sub>L (blinfun_of_cblinfun g)\<close>
apply transfer by auto
lemma cblinfun_compose_assoc:
shows "(A o\<^sub>C\<^sub>L B) o\<^sub>C\<^sub>L C = A o\<^sub>C\<^sub>L (B o\<^sub>C\<^sub>L C)"
by (metis (no_types, lifting) cblinfun_apply_inject fun.map_comp cblinfun_compose.rep_eq)
lemma cblinfun_compose_zero_right[simp]: "U o\<^sub>C\<^sub>L 0 = 0"
using bounded_cbilinear.zero_right bounded_cbilinear_cblinfun_compose by blast
lemma cblinfun_compose_zero_left[simp]: "0 o\<^sub>C\<^sub>L U = 0"
using bounded_cbilinear.zero_left bounded_cbilinear_cblinfun_compose by blast
lemma cblinfun_compose_scaleC_left[simp]:
fixes A::"'b::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_normed_vector"
and B::"'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b"
shows \<open>(a *\<^sub>C A) o\<^sub>C\<^sub>L B = a *\<^sub>C (A o\<^sub>C\<^sub>L B)\<close>
by (simp add: bounded_cbilinear.scaleC_left bounded_cbilinear_cblinfun_compose)
lemma cblinfun_compose_scaleR_left[simp]:
fixes A::"'b::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_normed_vector"
and B::"'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b"
shows \<open>(a *\<^sub>R A) o\<^sub>C\<^sub>L B = a *\<^sub>R (A o\<^sub>C\<^sub>L B)\<close>
by (simp add: scaleR_scaleC)
lemma cblinfun_compose_scaleC_right[simp]:
fixes A::"'b::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_normed_vector"
and B::"'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b"
shows \<open>A o\<^sub>C\<^sub>L (a *\<^sub>C B) = a *\<^sub>C (A o\<^sub>C\<^sub>L B)\<close>
apply transfer by (auto intro!: ext bounded_clinear.clinear complex_vector.linear_scale)
lemma cblinfun_compose_scaleR_right[simp]:
fixes A::"'b::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_normed_vector"
and B::"'a::complex_normed_vector \<Rightarrow>\<^sub>C\<^sub>L 'b"
shows \<open>A o\<^sub>C\<^sub>L (a *\<^sub>R B) = a *\<^sub>R (A o\<^sub>C\<^sub>L B)\<close>
by (simp add: scaleR_scaleC)
lemma cblinfun_compose_id_right[simp]:
shows "U o\<^sub>C\<^sub>L id_cblinfun = U"
apply transfer by auto
lemma cblinfun_compose_id_left[simp]:
shows "id_cblinfun o\<^sub>C\<^sub>L U = U"
apply transfer by auto
lemma cblinfun_eq_on:
fixes A B :: "'a::cbanach \<Rightarrow>\<^sub>C\<^sub>L'b::complex_normed_vector"
assumes "\<And>x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x" and \<open>t \<in> closure (cspan G)\<close>
shows "A *\<^sub>V t = B *\<^sub>V t"
using assms
apply transfer
using bounded_clinear_eq_on by blast
lemma cblinfun_eq_gen_eqI:
fixes A B :: "'a::cbanach \<Rightarrow>\<^sub>C\<^sub>L'b::complex_normed_vector"
assumes "\<And>x. x \<in> G \<Longrightarrow> A *\<^sub>V x = B *\<^sub>V x" and \<open>ccspan G = \<top>\<close>
shows "A = B"
apply (rule cblinfun_eqI)
apply (rule cblinfun_eq_on[where G=G])
using assms apply auto
by (metis ccspan.rep_eq iso_tuple_UNIV_I top_ccsubspace.rep_eq)
lemma cblinfun_compose_add_left: \<open>(a + b) o\<^sub>C\<^sub>L c = (a o\<^sub>C\<^sub>L c) + (b o\<^sub>C\<^sub>L c)\<close>
by (simp add: bounded_cbilinear.add_left bounded_cbilinear_cblinfun_compose)
lemma cblinfun_compose_add_right: \<open>a o\<^sub>C\<^sub>L (b + c) = (a o\<^sub>C\<^sub>L b) + (a o\<^sub>C\<^sub>L c)\<close>
by (simp add: bounded_cbilinear.add_right bounded_cbilinear_cblinfun_compose)
lemma cbilinear_cblinfun_compose[simp]: "cbilinear cblinfun_compose"
by (auto intro!: clinearI simp add: cbilinear_def bounded_cbilinear.add_left bounded_cbilinear.add_right bounded_cbilinear_cblinfun_compose)
subsection \<open>Adjoint\<close>
lift_definition
adj :: "'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_inner \<Rightarrow> 'b \<Rightarrow>\<^sub>C\<^sub>L 'a" ("_*" [99] 100)
is cadjoint by (fact cadjoint_bounded_clinear)
lemma id_cblinfun_adjoint[simp]: "id_cblinfun* = id_cblinfun"
apply transfer using cadjoint_id
by (metis eq_id_iff)
lemma double_adj[simp]: "(A*)* = A"
apply transfer using double_cadjoint by blast
lemma adj_cblinfun_compose[simp]:
fixes B::\<open>'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'b::chilbert_space\<close>
and A::\<open>'b \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_inner\<close>
shows "(A o\<^sub>C\<^sub>L B)* = (B*) o\<^sub>C\<^sub>L (A*)"
proof transfer
fix A :: \<open>'b \<Rightarrow> 'c\<close> and B :: \<open>'a \<Rightarrow> 'b\<close>
assume \<open>bounded_clinear A\<close> and \<open>bounded_clinear B\<close>
hence \<open>bounded_clinear (A \<circ> B)\<close>
by (simp add: comp_bounded_clinear)
have \<open>\<langle> (A \<circ> B) u, v \<rangle> = \<langle> u, (B\<^sup>\<dagger> \<circ> A\<^sup>\<dagger>) v \<rangle>\<close>
for u v
by (metis (no_types, lifting) cadjoint_univ_prop \<open>bounded_clinear A\<close> \<open>bounded_clinear B\<close> cinner_commute' comp_def)
thus \<open>(A \<circ> B)\<^sup>\<dagger> = B\<^sup>\<dagger> \<circ> A\<^sup>\<dagger>\<close>
using \<open>bounded_clinear (A \<circ> B)\<close>
by (metis cadjoint_eqI cinner_commute')
qed
lemma scaleC_adj[simp]: "(a *\<^sub>C A)* = (cnj a) *\<^sub>C (A*)"
apply transfer
by (simp add: Complex_Vector_Spaces0.bounded_clinear.bounded_linear bounded_clinear_def complex_vector.linear_scale scaleC_cadjoint)
lemma scaleR_adj[simp]: "(a *\<^sub>R A)* = a *\<^sub>R (A*)"
by (simp add: scaleR_scaleC)
lemma adj_plus: \<open>(A + B)* = (A*) + (B*)\<close>
proof transfer
fix A B::\<open>'b \<Rightarrow> 'a\<close>
assume a1: \<open>bounded_clinear A\<close> and a2: \<open>bounded_clinear B\<close>
define F where \<open>F = (\<lambda>x. (A\<^sup>\<dagger>) x + (B\<^sup>\<dagger>) x)\<close>
define G where \<open>G = (\<lambda>x. A x + B x)\<close>
have \<open>bounded_clinear G\<close>
unfolding G_def
by (simp add: a1 a2 bounded_clinear_add)
moreover have \<open>\<langle>F u, v\<rangle> = \<langle>u, G v\<rangle>\<close> for u v
unfolding F_def G_def
using cadjoint_univ_prop a1 a2 cinner_add_left
by (simp add: cadjoint_univ_prop cinner_add_left cinner_add_right)
ultimately have \<open>F = G\<^sup>\<dagger> \<close>
using cadjoint_eqI by blast
thus \<open>(\<lambda>x. A x + B x)\<^sup>\<dagger> = (\<lambda>x. (A\<^sup>\<dagger>) x + (B\<^sup>\<dagger>) x)\<close>
unfolding F_def G_def
by auto
qed
lemma cinner_sup_norm_cblinfun:
fixes A :: \<open>'a::{complex_normed_vector,not_singleton} \<Rightarrow>\<^sub>C\<^sub>L 'b::complex_inner\<close>
shows \<open>norm A = (SUP (\<psi>,\<phi>). cmod (cinner \<psi> (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
apply transfer
apply (rule cinner_sup_onorm)
by (simp add: bounded_clinear.bounded_linear)
lemma cinner_adj_left:
fixes G :: "'b::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'a::complex_inner"
shows \<open>\<langle>G* *\<^sub>V x, y\<rangle> = \<langle>x, G *\<^sub>V y\<rangle>\<close>
apply transfer using cadjoint_univ_prop by blast
lemma cinner_adj_right:
fixes G :: "'b::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'a::complex_inner"
shows \<open>\<langle>x, G* *\<^sub>V y\<rangle> = \<langle>G *\<^sub>V x, y\<rangle>\<close>
apply transfer using cadjoint_univ_prop' by blast
lemma adj_0[simp]: \<open>0* = 0\<close>
by (metis add_cancel_right_left adj_plus)
lemma norm_adj[simp]: \<open>norm (A*) = norm A\<close>
for A :: \<open>'b::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'c::complex_inner\<close>
proof (cases \<open>(\<exists>x y :: 'b. x \<noteq> y) \<and> (\<exists>x y :: 'c. x \<noteq> y)\<close>)
case True
then have c1: \<open>class.not_singleton TYPE('b)\<close>
apply intro_classes by simp
from True have c2: \<open>class.not_singleton TYPE('c)\<close>
apply intro_classes by simp
have normA: \<open>norm A = (SUP (\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
apply (rule cinner_sup_norm_cblinfun[internalize_sort \<open>'a::{complex_normed_vector,not_singleton}\<close>])
apply (rule complex_normed_vector_axioms)
by (rule c1)
have normAadj: \<open>norm (A*) = (SUP (\<psi>, \<phi>). cmod (\<psi> \<bullet>\<^sub>C (A* *\<^sub>V \<phi>)) / (norm \<psi> * norm \<phi>))\<close>
apply (rule cinner_sup_norm_cblinfun[internalize_sort \<open>'a::{complex_normed_vector,not_singleton}\<close>])
apply (rule complex_normed_vector_axioms)
by (rule c2)
have \<open>norm (A*) = (SUP (\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))\<close>
unfolding normAadj
apply (subst cinner_adj_right)
apply (subst cinner_commute)
apply (subst complex_mod_cnj)
by rule
also have \<open>\<dots> = Sup ((\<lambda>(\<psi>, \<phi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>)) ` prod.swap ` UNIV)\<close>
by auto
also have \<open>\<dots> = (SUP (\<phi>, \<psi>). cmod (\<phi> \<bullet>\<^sub>C (A *\<^sub>V \<psi>)) / (norm \<psi> * norm \<phi>))\<close>
apply (subst image_image)
by auto
also have \<open>\<dots> = norm A\<close>
unfolding normA
by (simp add: mult.commute)
finally show ?thesis
by -
next
case False
then consider (b) \<open>\<And>x::'b. x = 0\<close> | (c) \<open>\<And>x::'c. x = 0\<close>
by auto
then have \<open>A = 0\<close>
apply (cases; transfer)
apply (metis (full_types) bounded_clinear_def complex_vector.linear_0)
by auto
then show \<open>norm (A*) = norm A\<close>
by simp
qed
lemma antilinear_adj[simp]: \<open>antilinear adj\<close>
apply (rule antilinearI) by (auto simp add: adj_plus)
lemma bounded_antilinear_adj[bounded_antilinear, simp]: \<open>bounded_antilinear adj\<close>
by (auto intro!: antilinearI exI[of _ 1] simp: bounded_antilinear_def bounded_antilinear_axioms_def adj_plus)
lemma adjoint_eqI:
fixes G:: \<open>'b::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'a::chilbert_space\<close>
and F:: \<open>'a \<Rightarrow>\<^sub>C\<^sub>L 'b\<close>
assumes \<open>\<And>x y. \<langle>(cblinfun_apply F) x, y\<rangle> = \<langle>x, (cblinfun_apply G) y\<rangle>\<close>
shows \<open>F = G*\<close>
using assms apply transfer using cadjoint_eqI by auto
lemma cinner_real_hermiteanI:
\<comment> \<open>Prop. II.2.12 in @{cite conway2013course}\<close>
assumes \<open>\<And>\<psi>. cinner \<psi> (A *\<^sub>V \<psi>) \<in> \<real>\<close>
shows \<open>A = A*\<close>
proof -
{ fix g h :: 'a
{
fix \<alpha> :: complex
have \<open>cinner h (A h) + cnj \<alpha> *\<^sub>C cinner g (A h) + \<alpha> *\<^sub>C cinner h (A g) + (abs \<alpha>)\<^sup>2 * cinner g (A g)
= cinner (h + \<alpha> *\<^sub>C g) (A *\<^sub>V (h + \<alpha> *\<^sub>C g))\<close> (is \<open>?sum4 = _\<close>)
apply (auto simp: cinner_add_right cinner_add_left cblinfun.add_right cblinfun.scaleC_right ring_class.ring_distribs)
by (metis cnj_x_x mult.commute)
also have \<open>\<dots> \<in> \<real>\<close>
using assms by auto
finally have \<open>?sum4 = cnj ?sum4\<close>
using Reals_cnj_iff by fastforce
then have \<open>cnj \<alpha> *\<^sub>C cinner g (A h) + \<alpha> *\<^sub>C cinner h (A g)
= \<alpha> *\<^sub>C cinner (A h) g + cnj \<alpha> *\<^sub>C cinner (A g) h\<close>
using Reals_cnj_iff abs_complex_real assms by force
also have \<open>\<dots> = \<alpha> *\<^sub>C cinner h (A* *\<^sub>V g) + cnj \<alpha> *\<^sub>C cinner g (A* *\<^sub>V h)\<close>
by (simp add: cinner_adj_right)
finally have \<open>cnj \<alpha> *\<^sub>C cinner g (A h) + \<alpha> *\<^sub>C cinner h (A g) = \<alpha> *\<^sub>C cinner h (A* *\<^sub>V g) + cnj \<alpha> *\<^sub>C cinner g (A* *\<^sub>V h)\<close>
by -
}
from this[where \<alpha>2=1] this[where \<alpha>2=\<i>]
have 1: \<open>cinner g (A h) + cinner h (A g) = cinner h (A* *\<^sub>V g) + cinner g (A* *\<^sub>V h)\<close>
and i: \<open>- \<i> * cinner g (A h) + \<i> *\<^sub>C cinner h (A g) = \<i> *\<^sub>C cinner h (A* *\<^sub>V g) - \<i> *\<^sub>C cinner g (A* *\<^sub>V h)\<close>
by auto
from arg_cong2[OF 1 arg_cong[OF i, where f=\<open>(*) (-\<i>)\<close>], where f=plus]
have \<open>cinner h (A g) = cinner h (A* *\<^sub>V g)\<close>
by (auto simp: ring_class.ring_distribs)
}
then show "A = A*"
by (simp add: adjoint_eqI cinner_adj_right)
qed
lemma norm_AAadj[simp]: \<open>norm (A o\<^sub>C\<^sub>L A*) = (norm A)\<^sup>2\<close> for A :: \<open>'a::chilbert_space \<Rightarrow>\<^sub>C\<^sub>L 'b::{complex_inner}\<close>
proof (cases \<open>class.not_singleton TYPE('b)\<close>)
case True
then have [simp]: \<open>class.not_singleton TYPE('b)\<close>
by -
have 1: \<open>(norm A)\<^sup>2 * \<epsilon> \<le> norm (A o\<^sub>C\<^sub>L A*)\<close> if \<open>\<epsilon> < 1\<close> and \<open>\<epsilon> \<ge> 0\<close> for \<epsilon>
proof -
obtain \<psi> where \<psi>: \<open>norm ((A*) *\<^sub>V \<psi>) \<ge> norm (A*) * sqrt \<epsilon>\<close> and [simp]: \<open>norm \<psi> = 1\<close>
apply atomize_elim
apply (rule cblinfun_norm_approx_witness_mult[internalize_sort' 'a])
using \<open>\<epsilon> < 1\<close> by (auto intro: complex_normed_vector_class.complex_normed_vector_axioms)
have \<open>complex_of_real ((norm A)\<^sup>2 * \<epsilon>) = (norm (A*) * sqrt \<epsilon>)\<^sup>2\<close>
by (simp add: ordered_field_class.sign_simps(23) that(2))
also have \<open>\<dots> \<le> (norm ((A* *\<^sub>V \<psi>)))\<^sup>2\<close>
apply (rule complex_of_real_mono)
using \<psi> apply (rule power_mono)
using \<open>\<epsilon> \<ge> 0\<close> by auto
also have \<open>\<dots> \<le> cinner (A* *\<^sub>V \<psi>) (A* *\<^sub>V \<psi>)\<close>
by (auto simp flip: power2_norm_eq_cinner)
also have \<open>\<dots> = cinner \<psi> (A *\<^sub>V A* *\<^sub>V \<psi>)\<close>
by (simp add: cinner_adj_left)
also have \<open>\<dots> = cinner \<psi> ((A o\<^sub>C\<^sub>L A*) *\<^sub>V \<psi>)\<close>
by auto
also have \<open>\<dots> \<le> norm (A o\<^sub>C\<^sub>L A*)\<close>
using \<open>norm \<psi> = 1\<close>
by (smt (verit, best) Im_complex_of_real Re_complex_of_real \<open>(A* *\<^sub>V \<psi>) \<bullet>\<^sub>C (A* *\<^sub>V \<psi>) = \<psi> \<bullet>\<^sub>C (A *\<^sub>V A* *\<^sub>V \<psi>)\<close> \<open>\<psi> \<bullet>\<^sub>C (A *\<^sub>V A* *\<^sub>V \<psi>) = \<psi> \<bullet>\<^sub>C ((A o\<^sub>C\<^sub>L A*) *\<^sub>V \<psi>)\<close> cdot_square_norm cinner_ge_zero cmod_Re complex_inner_class.Cauchy_Schwarz_ineq2 less_eq_complex_def mult_cancel_left1 mult_cancel_right1 norm_cblinfun)
finally show ?thesis
by (auto simp: less_eq_complex_def)
qed
then have 1: \<open>(norm A)\<^sup>2 \<le> norm (A o\<^sub>C\<^sub>L A*)\<close>
by (metis field_le_mult_one_interval less_eq_real_def ordered_field_class.sign_simps(5))
have 2: \<open>norm (A o\<^sub>C\<^sub>L A*) \<le> (norm A)\<^sup>2\<close>
proof (rule norm_cblinfun_bound)
show \<open>0 \<le> (norm A)\<^sup>2\<close> by simp
fix \<psi>
have \<open>norm ((A o\<^sub>C\<^sub>L A*) *\<^sub>V \<psi>) = norm (A *\<^sub>V A* *\<^sub>V \<psi>)\<close>
by auto
also have \<open>\<dots> \<le> norm A * norm (A* *\<^sub>V \<psi>)\<close>
by (simp add: norm_cblinfun)
also have \<open>\<dots> \<le> norm A * norm (A*) * norm \<psi>\<close>
by (metis mult.assoc norm_cblinfun norm_imp_pos_and_ge ordered_comm_semiring_class.comm_mult_left_mono)
also have \<open>\<dots> = (norm A)\<^sup>2 * norm \<psi>\<close>
by (simp add: power2_eq_square)
finally show \<open>norm ((A o\<^sub>C\<^sub>L A*) *\<^sub>V \<psi>) \<le> (norm A)\<^sup>2 * norm \<psi>\<close>
by -
qed
from 1 2 show ?thesis by simp
next
case False
then have [simp]: \<open>class.CARD_1 TYPE('b)\<close>
by (rule not_singleton_vs_CARD_1)
have \<open>A = 0\<close>
apply (rule cblinfun_to_CARD_1_0[internalize_sort' 'b])