-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPullback.thy
1275 lines (1113 loc) · 110 KB
/
Pullback.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
theory Pullback
imports Pushout
begin
locale pullback_diagram =
b: morphism A B b +
c: morphism A C c +
f: morphism B D f +
g: morphism C D g for A B C D b c f g +
assumes
node_commutativity: \<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c\<^esub>\<^sub>V v\<close> and
edge_commutativity: \<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c\<^esub>\<^sub>E e\<close> and
universal_property: \<open>\<lbrakk>
graph (A' :: ('c,'d) ngraph);
morphism A' C c';
morphism A' B b';
\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v;
\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<rbrakk>
\<Longrightarrow> Ex1M (\<lambda>u. morphism A' A u \<and>
(\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and>
(\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e))
A'\<close>
context pullback_diagram
begin
lemma universal_property_exist_gen:
fixes A'
assumes \<open>graph A'\<close> \<open>morphism A' C c'\<close> \<open>morphism A' B b'\<close>
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
shows \<open>Ex1M (\<lambda>u. morphism A' A u \<and>
(\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and>
(\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e))
A'\<close>
proof -
interpret A': graph A'
using \<open>graph A'\<close> by assumption
interpret nA': graph \<open>to_ngraph A'\<close>
using \<open>graph A'\<close>
by (simp add: graph_ngraph_corres_iff)
interpret c': morphism A' C c'
using \<open>morphism A' C c'\<close>
by assumption
interpret b': morphism A' B b'
using \<open>morphism A' B b'\<close>
by assumption
define nb' where \<open>nb' \<equiv> \<lparr>node_map = \<lambda>v. \<^bsub>b'\<^esub>\<^sub>V (from_nat v), edge_map = \<lambda>e. \<^bsub>b'\<^esub>\<^sub>E (from_nat e)\<rparr>\<close>
define nc' where \<open>nc' \<equiv> \<lparr>node_map = \<lambda>v. \<^bsub>c'\<^esub>\<^sub>V (from_nat v), edge_map = \<lambda>e. \<^bsub>c'\<^esub>\<^sub>E (from_nat e)\<rparr>\<close>
interpret nb: morphism \<open>to_ngraph A'\<close> B nb'
proof
show \<open>\<^bsub>nb'\<^esub>\<^sub>E e \<in> E\<^bsub>B\<^esub>\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nb'_def to_ngraph_def b'.morph_edge_range)
next
show \<open>\<^bsub>nb'\<^esub>\<^sub>V v \<in> V\<^bsub>B\<^esub>\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by(auto simp add: nb'_def to_ngraph_def b'.morph_node_range)
next
show \<open>\<^bsub>nb'\<^esub>\<^sub>V (s\<^bsub>to_ngraph A'\<^esub> e) = s\<^bsub>B\<^esub> (\<^bsub>nb'\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nb'_def to_ngraph_def b'.source_preserve)
next
show \<open>\<^bsub>nb'\<^esub>\<^sub>V (t\<^bsub>to_ngraph A'\<^esub> e) = t\<^bsub>B\<^esub> (\<^bsub>nb'\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nb'_def to_ngraph_def b'.target_preserve)
qed (auto simp add: nb'_def to_ngraph_def b'.label_preserve b'.mark_preserve)
interpret nc: morphism \<open>to_ngraph A'\<close> C nc'
proof
show \<open>\<^bsub>nc'\<^esub>\<^sub>E e \<in> E\<^bsub>C\<^esub>\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nc'_def to_ngraph_def c'.morph_edge_range)
next
show \<open>\<^bsub>nc'\<^esub>\<^sub>V v \<in> V\<^bsub>C\<^esub>\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by(auto simp add: nc'_def to_ngraph_def c'.morph_node_range)
next
show \<open>\<^bsub>nc'\<^esub>\<^sub>V (s\<^bsub>to_ngraph A'\<^esub> e) = s\<^bsub>C\<^esub> (\<^bsub>nc'\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nc'_def to_ngraph_def c'.source_preserve)
next
show \<open>\<^bsub>nc'\<^esub>\<^sub>V (t\<^bsub>to_ngraph A'\<^esub> e) = t\<^bsub>C\<^esub> (\<^bsub>nc'\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by(auto simp add: nc'_def to_ngraph_def c'.target_preserve)
qed (auto simp add: nc'_def to_ngraph_def c'.label_preserve c'.mark_preserve)
have tr: \<open>\<And>v. v \<in> V\<^bsub>to_ngraph A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> nb'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> nc'\<^esub>\<^sub>V v\<close> \<open>\<And>e. e \<in> E\<^bsub>to_ngraph A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> nb'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> nc'\<^esub>\<^sub>E e\<close>
using
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
by (auto simp add: nb'_def nc'_def morph_comp_def to_ngraph_def)
obtain u where \<open>morphism (to_ngraph A') A u\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close>
using universal_property[OF nA'.graph_axioms nc.morphism_axioms nb.morphism_axioms tr]
by fast
interpret u: morphism \<open>to_ngraph A'\<close> A u
using \<open>morphism (to_ngraph A') A u\<close> by assumption
define nu :: "('k, 'a, 'l, 'b) pre_morph"
where \<open>nu \<equiv> \<lparr>node_map = \<lambda>v. \<^bsub>u\<^esub>\<^sub>V (to_nat v), edge_map = \<lambda>e. \<^bsub>u\<^esub>\<^sub>E (to_nat e)\<rparr>\<close>
interpret nu: morphism A' A nu
proof
show \<open>\<^bsub>nu\<^esub>\<^sub>E e \<in> E\<^bsub>A\<^esub>\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
by (simp add: nu_def to_ngraph_def u.morph_edge_range that)
next
show \<open>\<^bsub>nu\<^esub>\<^sub>V v \<in> V\<^bsub>A\<^esub>\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close> for v
by (simp add: nu_def to_ngraph_def u.morph_node_range that)
next
show \<open>\<^bsub>nu\<^esub>\<^sub>V (s\<^bsub>A'\<^esub> e) = s\<^bsub>A\<^esub> (\<^bsub>nu\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using u.source_preserve that
unfolding nu_def to_ngraph_def
by fastforce
next
show \<open>\<^bsub>nu\<^esub>\<^sub>V (t\<^bsub>A'\<^esub> e) = t\<^bsub>A\<^esub> (\<^bsub>nu\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using u.target_preserve that
unfolding nu_def to_ngraph_def
by fastforce
next
show \<open>l\<^bsub>A'\<^esub> v = l\<^bsub>A\<^esub> (\<^bsub>nu\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close> for v
using u.label_preserve that
unfolding nu_def to_ngraph_def
by fastforce
next
show \<open>m\<^bsub>A'\<^esub> e = m\<^bsub>A\<^esub> (\<^bsub>nu\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using u.mark_preserve that
unfolding nu_def to_ngraph_def
by fastforce
qed
show ?thesis
proof (rule_tac x=nu in exI, intro conjI)
show \<open>morphism A' A nu\<close>
using nu.morphism_axioms by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> nu\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close>
by (simp add: nu_def morph_comp_def to_ngraph_def nb'_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> nu\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close>
by (simp add: nu_def morph_comp_def to_ngraph_def nb'_def)
next
show \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> nu\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close>
by (simp add: nu_def morph_comp_def to_ngraph_def nc'_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> nu\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close>
by (simp add: nu_def morph_comp_def to_ngraph_def nc'_def)
next
show \<open>\<forall>y. morphism A' A y \<and>
(\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e) \<longrightarrow>
(\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>y\<^esub>\<^sub>E e = \<^bsub>nu\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>y\<^esub>\<^sub>V v = \<^bsub>nu\<^esub>\<^sub>V v)\<close>
proof safe
show \<open>\<^bsub>y\<^esub>\<^sub>E e = \<^bsub>nu\<^esub>\<^sub>E e\<close>
if \<open>morphism A' A y\<close>
\<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>e \<in> E\<^bsub>A'\<^esub>\<close> for y e
proof -
interpret y: morphism A' A y
using \<open>morphism A' A y\<close> by assumption
define ny where \<open>ny \<equiv> \<lparr>node_map = \<lambda>v. \<^bsub>y\<^esub>\<^sub>V (from_nat v), edge_map = \<lambda>e. \<^bsub>y\<^esub>\<^sub>E (from_nat e)\<rparr>\<close>
interpret ny: morphism \<open>to_ngraph A'\<close> A ny
proof
show \<open>\<^bsub>ny\<^esub>\<^sub>E e \<in> E\<^bsub>A\<^esub>\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.morph_edge_range)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V v \<in> V\<^bsub>A\<^esub>\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by (auto simp add: ny_def to_ngraph_def y.morph_node_range)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V (s\<^bsub>to_ngraph A'\<^esub> e) = s\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close>
if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.source_preserve)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V (t\<^bsub>to_ngraph A'\<^esub> e) = t\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close>
if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.target_preserve)
next
show \<open>l\<^bsub>to_ngraph A'\<^esub> v = l\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by (auto simp add: ny_def to_ngraph_def y.label_preserve)
next
show \<open>m\<^bsub>to_ngraph A'\<^esub> e = m\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.mark_preserve)
qed
have aa: \<open>morphism (to_ngraph A') A u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e)\<close>
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close> u.morphism_axioms by blast
have a: \<open>morphism (to_ngraph A') A ny \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e)\<close>
proof(intro conjI)
show \<open>morphism (to_ngraph A') A ny\<close>
using ny.morphism_axioms
by simp
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
by (simp add: to_ngraph_def ny_def nb'_def morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close>
using\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
by (simp add: to_ngraph_def ny_def nb'_def morph_comp_def)
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
by (simp add: to_ngraph_def ny_def nc'_def morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
by (simp add: to_ngraph_def ny_def nc'_def morph_comp_def)
qed
from ex_eq[OF universal_property[OF nA'.graph_axioms nc.morphism_axioms nb.morphism_axioms tr] a aa]
have \<open>\<^bsub>ny\<^esub>\<^sub>E e = \<^bsub>u\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by fastforce
thm from_nat_to_nat
thus ?thesis
using that
by (simp add: to_ngraph_def ny_def nu_def) (metis from_nat_to_nat imageI)
qed
next
show \<open>\<^bsub>y\<^esub>\<^sub>V v = \<^bsub>nu\<^esub>\<^sub>V v\<close>
if \<open>morphism A' A y\<close>
\<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>v \<in> V\<^bsub>A'\<^esub>\<close> for y v
proof -
interpret y: morphism A' A y
using \<open>morphism A' A y\<close> by assumption
define ny where \<open>ny \<equiv> \<lparr>node_map = \<lambda>v. \<^bsub>y\<^esub>\<^sub>V (from_nat v), edge_map = \<lambda>e. \<^bsub>y\<^esub>\<^sub>E (from_nat e)\<rparr>\<close>
interpret ny: morphism \<open>to_ngraph A'\<close> A ny
proof
show \<open>\<^bsub>ny\<^esub>\<^sub>E e \<in> E\<^bsub>A\<^esub>\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.morph_edge_range)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V v \<in> V\<^bsub>A\<^esub>\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by (auto simp add: ny_def to_ngraph_def y.morph_node_range)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V (s\<^bsub>to_ngraph A'\<^esub> e) = s\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close>
if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.source_preserve)
next
show \<open>\<^bsub>ny\<^esub>\<^sub>V (t\<^bsub>to_ngraph A'\<^esub> e) = t\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close>
if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.target_preserve)
next
show \<open>l\<^bsub>to_ngraph A'\<^esub> v = l\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by (auto simp add: ny_def to_ngraph_def y.label_preserve)
next
show \<open>m\<^bsub>to_ngraph A'\<^esub> e = m\<^bsub>A\<^esub> (\<^bsub>ny\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>to_ngraph A'\<^esub>\<close> for e
using that
by (auto simp add: ny_def to_ngraph_def y.mark_preserve)
qed
have aa: \<open>morphism (to_ngraph A') A u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e)\<close>
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close> \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close> u.morphism_axioms by blast
have a: \<open>morphism (to_ngraph A') A ny \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e)\<close>
proof(intro conjI)
show \<open>morphism (to_ngraph A') A ny\<close>
using ny.morphism_axioms
by simp
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nb'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
by (simp add: to_ngraph_def ny_def nb'_def morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nb'\<^esub>\<^sub>E e\<close>
using\<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
by (simp add: to_ngraph_def ny_def nb'_def morph_comp_def)
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>V v = \<^bsub>nc'\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
by (simp add: to_ngraph_def ny_def nc'_def morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> ny\<^esub>\<^sub>E e = \<^bsub>nc'\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
by (simp add: to_ngraph_def ny_def nc'_def morph_comp_def)
qed
from ex_eq[OF universal_property[OF nA'.graph_axioms nc.morphism_axioms nb.morphism_axioms tr] a aa]
have \<open>\<^bsub>ny\<^esub>\<^sub>V v = \<^bsub>u\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph A'\<^esub>\<close> for v
using that
by fastforce
thus ?thesis
using that
by (simp add: to_ngraph_def ny_def nu_def) (metis from_nat_to_nat imageI)
qed
qed
qed
qed
(* Fundamentals of Algebraic Graph Transformation
by dualisation of Fact 2.20 P. 41 *)
theorem uniqueness_pb:
fixes A' b' c'
assumes
A': \<open>graph A'\<close> and
b': \<open>morphism A' B b'\<close> and
c': \<open>morphism A' C c'\<close>
shows \<open>pullback_diagram A' B C D b' c' f g
\<longleftrightarrow> (\<exists>u. bijective_morphism A' A u
\<and> (\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e)
\<and> (\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e))\<close>
proof
show \<open>\<exists>u. bijective_morphism A' A u \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)\<close>
if \<open>pullback_diagram A' B C D b' c' f g\<close>
proof -
interpret 2: pullback_diagram A' B C D b' c' f g
using that by assumption
obtain u where \<open>morphism A' A u\<close>
and tr: \<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
using universal_property_exist_gen[OF A' c' b' "2.node_commutativity" "2.edge_commutativity"]
by fast
interpret u: morphism A' A u using \<open>morphism A' A u\<close> by assumption
obtain u' where \<open>morphism A A' u'\<close>
and \<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close>
and \<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close>
and \<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close>
and \<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close>
using "2.universal_property_exist_gen"[OF b.G.graph_axioms c.morphism_axioms b.morphism_axioms node_commutativity edge_commutativity]
by fast
interpret u': morphism A A' u' using \<open>morphism A A' u'\<close> by assumption
interpret u'u: morphism A' A' \<open>u' \<circ>\<^sub>\<rightarrow> u\<close>
using wf_morph_comp[OF \<open>morphism A' A u\<close> \<open>morphism A A' u'\<close>]
by assumption
interpret uu': morphism A A \<open>u \<circ>\<^sub>\<rightarrow> u'\<close>
using wf_morph_comp[OF \<open>morphism A A' u'\<close> \<open>morphism A' A u\<close>]
by assumption
have a: \<open>morphism A' A' (u' \<circ>\<^sub>\<rightarrow> u) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)\<close>
proof (intro conjI)
show \<open>morphism A' A' (u' \<circ>\<^sub>\<rightarrow> u)\<close>
using u'u.morphism_axioms
by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
using
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close>
u.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
using
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close>
u.morph_edge_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
using
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close>
u.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
using
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close>
u.morph_edge_range
by (simp add: morph_comp_def)
qed
have b: \<open>morphism A' A' idM \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)\<close>
proof
show \<open>morphism A' A' idM\<close>
by (simp add: "2.b.G.idm.morphism_axioms")
qed (simp add: morph_comp_def)
have "a*": \<open>morphism A A (u \<circ>\<^sub>\<rightarrow> u') \<and> (\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e)\<close>
proof (intro conjI)
show \<open>morphism A A (u \<circ>\<^sub>\<rightarrow> u')\<close>
using uu'.morphism_axioms by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close>
using
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close>
u'.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close>
using
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close>
u'.morph_edge_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close>
using
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close>
u'.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close>
using
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close>
u'.morph_edge_range
by (simp add: morph_comp_def)
qed
have "b*": \<open>morphism A A idM \<and> (\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e)\<close>
proof
show \<open>morphism A A idM\<close>
by (simp add: b.G.idm.morphism_axioms)
qed (simp add: morph_comp_def)
have \<open>\<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = v\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close> for v
using ex_eq[OF "2.universal_property_exist_gen"[OF A' c' b' "2.node_commutativity" "2.edge_commutativity"], of "u' \<circ>\<^sub>\<rightarrow> u" idM] a b that
by (simp add: morph_assoc_nodes morph_assoc_edges)
moreover have \<open>\<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = e\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using ex_eq[OF "2.universal_property_exist_gen"[OF A' c' b' "2.node_commutativity" "2.edge_commutativity"], of "u' \<circ>\<^sub>\<rightarrow> u" idM] a b that
by (simp add: morph_assoc_nodes morph_assoc_edges)
moreover have \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = v\<close> if \<open>v \<in> V\<^bsub>A\<^esub>\<close> for v
using ex_eq[OF universal_property_exist_gen[OF b.G.graph_axioms c.morphism_axioms b.morphism_axioms node_commutativity edge_commutativity], of \<open>u \<circ>\<^sub>\<rightarrow> u'\<close> idM] "a*" "b*" that
by (simp add: morph_assoc_nodes morph_assoc_edges)
moreover have \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = e\<close> if \<open>e \<in> E\<^bsub>A\<^esub>\<close> for e
using ex_eq[OF universal_property_exist_gen[OF b.G.graph_axioms c.morphism_axioms b.morphism_axioms node_commutativity edge_commutativity], of \<open>u \<circ>\<^sub>\<rightarrow> u'\<close> idM] "a*" "b*" that
by (simp add: morph_assoc_nodes morph_assoc_edges)
ultimately show ?thesis
using comp_id_bij[OF \<open>morphism A' A u\<close> \<open>morphism A A' u'\<close>] tr
by auto
qed
next
show \<open>pullback_diagram A' B C D b' c' f g\<close>
if asm:\<open>\<exists>u. bijective_morphism A' A u \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)\<close>
proof -
interpret b': morphism A' B b'
using \<open>morphism A' B b'\<close>
by assumption
interpret c': morphism A' C c'
using \<open>morphism A' C c'\<close>
by assumption
obtain u where \<open>bijective_morphism A' A u\<close>
and \<open>\<And>v. v \<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
and \<open>\<And>e. e\<in>E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
and \<open>\<And>v. v\<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
and \<open>\<And>e. e\<in>E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
using asm
by force
interpret u: bijective_morphism A' A u
using \<open>bijective_morphism A' A u\<close> by assumption
show ?thesis
proof
show \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close> for v
proof -
have \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>f \<circ>\<^sub>\<rightarrow> b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v\<close>
using b'.morph_node_range \<open>\<And>v. v \<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>g \<circ>\<^sub>\<rightarrow> c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v\<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close> node_commutativity that
u.morph_node_range
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v\<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def)
finally show ?thesis .
qed
next
show \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
proof -
have \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>f \<circ>\<^sub>\<rightarrow> b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e\<close>
using b'.morph_edge_range \<open>\<And>e. e \<in>E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e= \<^bsub>b'\<^esub>\<^sub>E e\<close> that
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>g \<circ>\<^sub>\<rightarrow> c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close> edge_commutativity that
u.morph_edge_range
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>g \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close> that
by (simp add: morph_comp_def)
finally show ?thesis .
qed
next
show \<open>Ex1M (\<lambda>x. morphism A'' A' x \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e)) A''\<close>
if \<open>graph A''\<close> and
\<open>morphism A'' C c''\<close> \<open>morphism A'' B b''\<close> and
commutativity: \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b''\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> c''\<^esub>\<^sub>V v\<close> \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> b''\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> c''\<^esub>\<^sub>E e\<close>
for A'' :: "('c,'d) ngraph" and c'' b''
proof -
(* https://link.springer.com/content/pdf/10.1007/3-540-31188-2.pdf?pdf=button
PDF Page. 42
*)
interpret A'': graph A''
using \<open>graph A''\<close> by assumption
interpret c'': morphism A'' C c''
using \<open>morphism A'' C c''\<close> by assumption
interpret b'': morphism A'' B b''
using \<open>morphism A'' B b''\<close> by assumption
obtain u'' where \<open>morphism A'' A u''\<close>
\<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close> \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
using universal_property_exist_gen[OF A''.graph_axioms c''.morphism_axioms b''.morphism_axioms commutativity ]
by fast
interpret u'': morphism A'' A u''
using \<open>morphism A'' A u''\<close> by assumption
obtain u' where \<open>bijective_morphism A A' u'\<close>
and \<open>\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = v\<close> and \<open>\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = e\<close>
and \<open>\<forall>v \<in> V\<^bsub>A\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = v\<close> and \<open>\<forall>e \<in> E\<^bsub>A\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = e\<close>
using u.ex_inv
by auto
(* triangle properties of u' *)
have \<open> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A\<^esub>\<close> for v
using that \<open>\<And>v. v \<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close> \<open>\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = v\<close>
u.surj_nodes
by (force simp add: morph_comp_def)
have \<open> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A\<^esub>\<close> for e
using that \<open>\<And>e. e \<in>E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close> \<open>\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = e\<close>
u.surj_edges
by (force simp add: morph_comp_def)
have \<open> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A\<^esub>\<close> for v
using that \<open>\<And>v. v \<in>V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close> \<open>\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = v\<close>
u.surj_nodes
by (force simp add: morph_comp_def)
have \<open> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A\<^esub>\<close> for e
using that \<open>\<And>e. e \<in>E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close> \<open>\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = e\<close>
u.surj_edges
by (force simp add: morph_comp_def)
interpret u': bijective_morphism A A' u'
using \<open>bijective_morphism A A' u'\<close> by assumption
define u''' where \<open>u''' \<equiv> u' \<circ>\<^sub>\<rightarrow> u''\<close>
interpret u''': morphism A'' A' u'''
using wf_morph_comp[OF u''.morphism_axioms u'.morphism_axioms]
by (simp add: u'''_def)
show ?thesis
proof (rule_tac x = u''' in exI, intro conjI)
show \<open>morphism A'' A' u'''\<close>
using u'''.morphism_axioms by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in>V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>b\<^esub>\<^sub>V v\<close>
by (simp add: u'''_def morph_comp_def u''.morph_node_range)
next
show \<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close> \<open>\<And>e. e\<in>E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>b' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>b\<^esub>\<^sub>E e\<close>
by (simp add: u'''_def morph_comp_def u''.morph_edge_range)
next
show \<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> \<open>\<And>v. v\<in>V\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>V v = \<^bsub>c\<^esub>\<^sub>V v\<close>
by (simp add: u'''_def morph_comp_def u''.morph_node_range)
next
show \<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close> \<open>\<And>e. e\<in>E\<^bsub>A\<^esub> \<Longrightarrow> \<^bsub>c' \<circ>\<^sub>\<rightarrow> u'\<^esub>\<^sub>E e = \<^bsub>c\<^esub>\<^sub>E e\<close>
by (simp add: u'''_def morph_comp_def u''.morph_edge_range)
next
show \<open>\<forall>y. morphism A'' A' y \<and>
(\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e) \<longrightarrow>
(\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>y\<^esub>\<^sub>E e = \<^bsub>u'''\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>y\<^esub>\<^sub>V v = \<^bsub>u'''\<^esub>\<^sub>V v)\<close>
proof safe
show \<open>\<^bsub>y\<^esub>\<^sub>E e = \<^bsub>u'''\<^esub>\<^sub>E e\<close>
if \<open>morphism A'' A' y\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
\<open>e \<in> E\<^bsub>A''\<^esub>\<close> for y e
proof -
interpret y: morphism A'' A' y
using \<open>morphism A'' A' y\<close> by assumption
have \<open>\<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A''\<^esub>\<close> for v
using that
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
by (simp add: y.morph_node_range morph_comp_def)
moreover have \<open>\<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A''\<^esub>\<close> for e
using that
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
by (simp add: y.morph_edge_range morph_comp_def)
moreover have \<open>\<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A''\<^esub>\<close> for v
using that
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close>
by (simp add: y.morph_node_range morph_comp_def)
moreover have \<open>\<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A''\<^esub>\<close> for e
using that
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
by (simp add: y.morph_edge_range morph_comp_def)
ultimately
have dd: \<open>morphism A'' A (u \<circ>\<^sub>\<rightarrow> y) \<and>
(\<forall>v \<in> V\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and>
(\<forall>v \<in> V\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e)\<close>
using wf_morph_comp[OF y.morphism_axioms u.morphism_axioms]
by (simp add: morph_assoc_nodes morph_assoc_edges)
have ddd: \<open>morphism A'' A u'' \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e)\<close>
by (simp add: \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close> \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close> \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close> \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> u''.morphism_axioms)
have \<open>\<^bsub>y\<^esub>\<^sub>E e = \<^bsub>u'''\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A''\<^esub>\<close> for e
proof -
have \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>u''\<^esub>\<^sub>E e\<close>
using ex_eq[OF
universal_property[OF \<open>graph A''\<close> \<open>morphism A'' C c''\<close> \<open>morphism A'' B b''\<close> commutativity]
dd ddd] that
by fastforce
have \<open>\<^bsub>y\<^esub>\<^sub>E e = \<^bsub>u' \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e \<in> E\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = e\<close> that
by (simp add: morph_comp_def y.morph_edge_range)
also have \<open>\<dots> = \<^bsub>u' \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e\<close>
using \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>u''\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>u'''\<^esub>\<^sub>E e\<close>
by (simp add: u'''_def)
finally show ?thesis .
qed
thus ?thesis
using that
by blast
qed
next
show \<open>\<^bsub>y\<^esub>\<^sub>V v = \<^bsub>u'''\<^esub>\<^sub>V v\<close>
if \<open>morphism A'' A' y\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
\<open>v \<in> V\<^bsub>A''\<^esub>\<close>for y v
proof -
interpret y: morphism A'' A' y
using \<open>morphism A'' A' y\<close> by assumption
have \<open>\<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A''\<^esub>\<close> for v
using that
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close>
by (simp add: y.morph_node_range morph_comp_def)
moreover have \<open>\<^bsub>b \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A''\<^esub>\<close> for e
using that
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close>
by (simp add: y.morph_edge_range morph_comp_def)
moreover have \<open>\<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A''\<^esub>\<close> for v
using that
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close>
\<open>\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close>
by (simp add: y.morph_node_range morph_comp_def)
moreover have \<open>\<^bsub>c \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A''\<^esub>\<close> for e
using that
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close>
\<open>\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close>
by (simp add: y.morph_edge_range morph_comp_def)
ultimately
have dd: \<open>morphism A'' A (u \<circ>\<^sub>\<rightarrow> y) \<and>
(\<forall>v \<in> V\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and>
(\<forall>v \<in> V\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and>
(\<forall>e \<in> E\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> (u \<circ>\<^sub>\<rightarrow> y)\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e)\<close>
using wf_morph_comp[OF y.morphism_axioms u.morphism_axioms]
by (simp add: morph_assoc_nodes morph_assoc_edges)
have ddd: \<open>morphism A'' A u'' \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A''\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e)\<close>
by (simp add: \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>b''\<^esub>\<^sub>E e\<close> \<open>\<And>e. e \<in> E\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>E e = \<^bsub>c''\<^esub>\<^sub>E e\<close> \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>b \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>b''\<^esub>\<^sub>V v\<close> \<open>\<And>v. v \<in> V\<^bsub>A''\<^esub> \<Longrightarrow> \<^bsub>c \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v = \<^bsub>c''\<^esub>\<^sub>V v\<close> u''.morphism_axioms)
have \<open>\<^bsub>y\<^esub>\<^sub>V v = \<^bsub>u'''\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A''\<^esub>\<close> for v
proof -
have \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>u''\<^esub>\<^sub>V v\<close>
using ex_eq[OF
universal_property[OF \<open>graph A''\<close> \<open>morphism A'' C c''\<close> \<open>morphism A'' B b''\<close> commutativity]
dd ddd] that
by fastforce
have \<open>\<^bsub>y\<^esub>\<^sub>V v = \<^bsub>u' \<circ>\<^sub>\<rightarrow> u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v \<in> V\<^bsub>A'\<^esub>. \<^bsub>u' \<circ>\<^sub>\<rightarrow> u\<^esub>\<^sub>V v = v\<close> that
by(simp add: morph_comp_def y.morph_node_range)
also have \<open>\<dots> = \<^bsub>u' \<circ>\<^sub>\<rightarrow> u''\<^esub>\<^sub>V v\<close>
using \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>u''\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>u'''\<^esub>\<^sub>V v\<close>
by (simp add: u'''_def)
finally show ?thesis .
qed
thus ?thesis
using that
by blast
qed
qed
qed
qed
qed
qed
qed
lemma flip_diagram:
\<open>pullback_diagram A C B D c b g f\<close>
proof
show \<open>\<^bsub>g \<circ>\<^sub>\<rightarrow> c\<^esub>\<^sub>V v = \<^bsub>f \<circ>\<^sub>\<rightarrow> b\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A\<^esub>\<close> for v
using node_commutativity[OF that] by simp
next
show \<open>\<^bsub>g \<circ>\<^sub>\<rightarrow> c\<^esub>\<^sub>E e = \<^bsub>f \<circ>\<^sub>\<rightarrow> b\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A\<^esub>\<close> for e
using edge_commutativity[OF that] by simp
next
show \<open>Ex1M (\<lambda>x. morphism A' A x \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)) A'\<close>
if \<open>graph A'\<close> \<open>morphism A' B c'\<close> \<open>morphism A' C b'\<close> \<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close> \<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
for A' :: "('c,'d) ngraph" and c' b'
proof -
have a: \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v = \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close> for v
using that
by (simp add: \<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>)
have b: \<open>\<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e = \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using that
by (simp add: \<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>f \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>)
have c: \<open>(\<lambda>x. morphism A' A x \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e)) = (\<lambda>x. morphism A' A x \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>c \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>b \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e))\<close>
by fastforce
show ?thesis
using ex1m_eq_surrogate[OF c universal_property[OF \<open>graph A'\<close> \<open>morphism A' C b'\<close> \<open>morphism A' B c'\<close> a b]]
by assumption
qed
qed
end
lemma fun_algrtr_4_7_2:
fixes C A m
assumes \<open>injective_morphism C A m\<close>
shows \<open>pullback_diagram C C C A idM idM m m\<close>
proof -
interpret m: injective_morphism C A m
using assms by assumption
interpret idm: injective_morphism C C idM
by (simp add: m.G.idm.injective_morphism_axioms)
show ?thesis
proof
show \<open>\<^bsub>m \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v = \<^bsub>m \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>C\<^esub>\<close> for v
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>m \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e = \<^bsub>m \<circ>\<^sub>\<rightarrow> idM\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>C\<^esub>\<close> for e
by (simp add: morph_comp_def)
next
show \<open>Ex1M (\<lambda>x. morphism A' C x \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>idM \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>b'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>idM \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>b'\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>A'\<^esub>. \<^bsub>idM \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>A'\<^esub>. \<^bsub>idM \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e)) A'\<close>
if \<open>graph A'\<close> \<open>morphism A' C c'\<close> \<open>morphism A' C b'\<close>
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>m \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>m \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>m \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>m \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
for A':: "('c,'d) ngraph" and c' b'
proof -
interpret c': morphism A' C c'
using \<open>morphism A' C c'\<close> by assumption
interpret b': morphism A' C b'
using \<open>morphism A' C b'\<close> by assumption
have \<open>\<^bsub>b'\<^esub>\<^sub>V v = \<^bsub>c'\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A'\<^esub>\<close>for v
using that m.inj_nodes c'.morph_node_range b'.morph_node_range
\<open>\<And>v. v \<in> V\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>m \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>V v = \<^bsub>m \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>V v\<close>
by(simp add: morph_comp_def inj_onD)
moreover have \<open>\<^bsub>b'\<^esub>\<^sub>E e = \<^bsub>c'\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>A'\<^esub>\<close> for e
using that m.inj_edges c'.morph_edge_range b'.morph_edge_range
\<open>\<And>e. e \<in> E\<^bsub>A'\<^esub> \<Longrightarrow> \<^bsub>m \<circ>\<^sub>\<rightarrow> b'\<^esub>\<^sub>E e = \<^bsub>m \<circ>\<^sub>\<rightarrow> c'\<^esub>\<^sub>E e\<close>
by(simp add: morph_comp_def inj_onD)
ultimately show ?thesis
using c'.morphism_axioms by auto
qed
qed
qed
(*
Fundamentals of Algebraic Graph Transformation
Fact 2.27, Pullback composition (PDF P 45)
https://link.springer.com/content/pdf/10.1007/3-540-31188-2.pdf
*)
lemma pullback_composition:
assumes
1: \<open>pullback_diagram A B C D f g g' f'\<close> and
2: \<open>pullback_diagram B E D F e g' e'' e'\<close>
shows \<open>pullback_diagram A E C F (e \<circ>\<^sub>\<rightarrow> f) g e'' (e' \<circ>\<^sub>\<rightarrow> f')\<close>
proof -
interpret 1: pullback_diagram A B C D f g g' f'
using 1 by assumption
interpret 2: pullback_diagram B E D F e g' e'' e'
using 2 by assumption
interpret b: morphism A E \<open>e \<circ>\<^sub>\<rightarrow> f\<close>
using wf_morph_comp[OF "1.b.morphism_axioms" "2.b.morphism_axioms"]
by assumption
interpret b: morphism C F \<open>e' \<circ>\<^sub>\<rightarrow> f'\<close>
using wf_morph_comp[OF "1.g.morphism_axioms" "2.g.morphism_axioms"]
by assumption
show ?thesis
proof
show \<open>\<^bsub>e'' \<circ>\<^sub>\<rightarrow> (e \<circ>\<^sub>\<rightarrow> f)\<^esub>\<^sub>V v = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> g\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>A\<^esub>\<close> for v
using that "1.node_commutativity" "2.node_commutativity"
by (auto simp add: morph_comp_def "1.b.morph_node_range")
next
show \<open>\<^bsub>e'' \<circ>\<^sub>\<rightarrow> (e \<circ>\<^sub>\<rightarrow> f)\<^esub>\<^sub>E ea = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> g\<^esub>\<^sub>E ea\<close> if \<open>ea \<in> E\<^bsub>A\<^esub>\<close> for ea
using that "1.edge_commutativity" "2.edge_commutativity"
by (auto simp add: morph_comp_def "1.b.morph_edge_range")
next
show \<open>Ex1M
(\<lambda>x. morphism X A x \<and>
(\<forall>v \<in>V\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>k\<^esub>\<^sub>V v) \<and>
(\<forall>ea\<in>E\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>k\<^esub>\<^sub>E ea) \<and>
(\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>g \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>h\<^esub>\<^sub>V v) \<and> (\<forall>ea\<in>E\<^bsub>X\<^esub>. \<^bsub>g \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>h\<^esub>\<^sub>E ea))
X \<close>
if \<open>graph X\<close> \<open>morphism X C h\<close> \<open>morphism X E k\<close>
\<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>V v = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>E e = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E e\<close>
for X :: "('c,'d) ngraph" and h k
proof -
interpret f'h: morphism X D \<open>f' \<circ>\<^sub>\<rightarrow> h\<close>
using "1.g.morphism_axioms" that(2) wf_morph_comp by blast
have a: \<open>\<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>V v = \<^bsub>e' \<circ>\<^sub>\<rightarrow> (f' \<circ>\<^sub>\<rightarrow> h)\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>X\<^esub>\<close> for v
using that \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>V v = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have b: \<open>\<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>E ea = \<^bsub>e' \<circ>\<^sub>\<rightarrow> (f' \<circ>\<^sub>\<rightarrow> h)\<^esub>\<^sub>E ea\<close> if \<open>ea \<in> E\<^bsub>X\<^esub>\<close> for ea
using that \<open>\<And>e. e \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>e'' \<circ>\<^sub>\<rightarrow> k\<^esub>\<^sub>E e = \<^bsub>e' \<circ>\<^sub>\<rightarrow> f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
obtain y where \<open>morphism X B y\<close>
and \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>V v = \<^bsub> e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v\<close>
and \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>E ea = \<^bsub> e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea\<close>
and \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close>
and \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E ea\<close>
using "2.universal_property"[OF \<open>graph X\<close> f'h.morphism_axioms \<open>morphism X E k\<close> a b]
by force
have a': \<open>\<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>X\<^esub>\<close> for v
using that \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have b': \<open>\<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E ea\<close> if \<open>ea \<in> E\<^bsub>X\<^esub>\<close> for ea
using that \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g' \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E ea\<close>
by (simp add: morph_comp_def)
obtain x where \<open>morphism X A x\<close>
and \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>h\<^esub>\<^sub>V v\<close>
and \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>g \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>h\<^esub>\<^sub>E ea\<close>
and \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
and \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>y\<^esub>\<^sub>E ea\<close>
using "1.universal_property"[OF \<open>graph X\<close> \<open>morphism X C h\<close> \<open>morphism X B y\<close> a' b']
by fast
have trv: \<open>\<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>k\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>X\<^esub>\<close> for v
proof -
have \<open>\<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v\<close>
using that \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>k\<^esub>\<^sub>V v\<close>
by (simp add: \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>V v = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v\<close> that)
finally show ?thesis .
qed
have tre: \<open>\<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>k\<^esub>\<^sub>E ea\<close> if \<open>ea \<in> E\<^bsub>X\<^esub>\<close> for ea
proof -
have \<open>\<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea\<close>
using that \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>f \<circ>\<^sub>\<rightarrow> x\<^esub>\<^sub>E ea = \<^bsub>y\<^esub>\<^sub>E ea\<close>
by (simp add: morph_comp_def)
also have \<open>\<dots> = \<^bsub>k\<^esub>\<^sub>E ea\<close>
by (simp add: \<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>E ea = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea\<close> that)
finally show ?thesis .
qed
have uniq_y: \<open>(\<forall>v \<in> V\<^bsub>X\<^esub>. \<^bsub>uy\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and> (\<forall>e \<in> E\<^bsub>X\<^esub>. \<^bsub>uy\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
if \<open>morphism X B uy\<close>
\<open>\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> uy\<^esub>\<^sub>V v = \<^bsub>k\<^esub>\<^sub>V v\<close>
\<open>\<forall>ea\<in>E\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> uy\<^esub>\<^sub>E ea = \<^bsub>k\<^esub>\<^sub>E ea\<close>
\<open>\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>g' \<circ>\<^sub>\<rightarrow> uy\<^esub>\<^sub>V v = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>X\<^esub>. \<^bsub>g' \<circ>\<^sub>\<rightarrow> uy\<^esub>\<^sub>E e = \<^bsub>f' \<circ>\<^sub>\<rightarrow> h\<^esub>\<^sub>E e\<close> for uy
using that ex_eq[OF "2.universal_property"[OF \<open>graph X\<close> f'h.morphism_axioms \<open>morphism X E k\<close> a b], of uy y]
\<open>\<And>ea. ea \<in> E\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>E ea = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>E ea\<close> \<open>\<And>v. v \<in> V\<^bsub>X\<^esub> \<Longrightarrow> \<^bsub>k\<^esub>\<^sub>V v = \<^bsub>e \<circ>\<^sub>\<rightarrow> y\<^esub>\<^sub>V v\<close> \<open>morphism X B y\<close> a' b'
by fastforce
have uniq: \<open>(\<forall>e\<in>E\<^bsub>X\<^esub>. \<^bsub>ux\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>ux\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v)\<close>
if \<open>morphism X A ux\<close>
\<open>\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> ux\<^esub>\<^sub>V v = \<^bsub>k\<^esub>\<^sub>V v\<close>
\<open>\<forall>ea\<in>E\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> f \<circ>\<^sub>\<rightarrow> ux\<^esub>\<^sub>E ea = \<^bsub>k\<^esub>\<^sub>E ea\<close>
\<open>\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>g \<circ>\<^sub>\<rightarrow> ux\<^esub>\<^sub>V v = \<^bsub>h\<^esub>\<^sub>V v\<close>
\<open>\<forall>ea\<in>E\<^bsub>X\<^esub>. \<^bsub>g \<circ>\<^sub>\<rightarrow> ux\<^esub>\<^sub>E ea = \<^bsub>h\<^esub>\<^sub>E ea\<close> for ux
proof -
interpret ux: morphism X A ux
using \<open>morphism X A ux\<close>
by assumption
interpret fux: morphism X B \<open>f \<circ>\<^sub>\<rightarrow> ux\<close>
using \<open>morphism X A ux\<close>
by (simp add: "1.b.morphism_axioms" wf_morph_comp)
have aa: \<open>\<forall>v\<in>V\<^bsub>X\<^esub>. \<^bsub>e \<circ>\<^sub>\<rightarrow> (f \<circ>\<^sub>\<rightarrow> ux)\<^esub>\<^sub>V v = \<^bsub>k\<^esub>\<^sub>V v\<close>
by (simp add: morph_assoc_nodes that(2))