-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathLocalChurchRosser.thy
1177 lines (1035 loc) · 118 KB
/
LocalChurchRosser.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 LocalChurchRosser
imports DirectDerivation
begin
(* Fund. Alg. GT, PDF. P. 117
https://link.springer.com/content/pdf/10.1007/3-540-31188-2.pdf?pdf=button
*)
(* declare [[show_sorts]]
*)
locale parallel_independence =
p\<^sub>1: direct_derivation r\<^sub>1 b\<^sub>1 b\<^sub>1' G g\<^sub>1 D\<^sub>1 m\<^sub>1 c\<^sub>1 H\<^sub>1 f\<^sub>1 h\<^sub>1 +
p\<^sub>2: direct_derivation r\<^sub>2 b\<^sub>2 b\<^sub>2' G g\<^sub>2 D\<^sub>2 m\<^sub>2 c\<^sub>2 H\<^sub>2 f\<^sub>2 h\<^sub>2
for r\<^sub>1 b\<^sub>1 b\<^sub>1' G g\<^sub>1 D\<^sub>1 m\<^sub>1 c\<^sub>1 H\<^sub>1 f\<^sub>1 h\<^sub>1
r\<^sub>2 b\<^sub>2 b\<^sub>2' g\<^sub>2 D\<^sub>2 m\<^sub>2 c\<^sub>2 H\<^sub>2 f\<^sub>2 h\<^sub>2 +
assumes
i: \<open>\<exists>i. morphism (lhs r\<^sub>1) D\<^sub>2 i
\<and> (\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v)
\<and> (\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e)\<close> and
j: \<open>\<exists>j. morphism (lhs r\<^sub>2) D\<^sub>1 j
\<and> (\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> j\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v)
\<and> (\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> j\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e)\<close>
locale sequential_independence =
p\<^sub>1: direct_derivation r\<^sub>1 b\<^sub>1 b\<^sub>1' G g\<^sub>1 D\<^sub>1 m\<^sub>1 c\<^sub>1 H\<^sub>1 f\<^sub>1 h\<^sub>1 +
p\<^sub>2: direct_derivation r\<^sub>2 b\<^sub>2 b\<^sub>2' H\<^sub>1 g\<^sub>2 D\<^sub>2 m\<^sub>2 c\<^sub>2 H\<^sub>2 f\<^sub>2 h\<^sub>2
for r\<^sub>1 b\<^sub>1 b\<^sub>1' G g\<^sub>1 D\<^sub>1 m\<^sub>1 c\<^sub>1 H\<^sub>1 f\<^sub>1 h\<^sub>1
r\<^sub>2 b\<^sub>2 b\<^sub>2' g\<^sub>2 D\<^sub>2 m\<^sub>2 c\<^sub>2 H\<^sub>2 f\<^sub>2 h\<^sub>2 +
assumes
i: \<open>\<exists>i. morphism (rhs r\<^sub>1) D\<^sub>2 i
\<and> (\<forall>v \<in> V\<^bsub>rhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v)
\<and> (\<forall>e \<in> E\<^bsub>rhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e)\<close> and
j: \<open>\<exists>j. morphism (lhs r\<^sub>2) D\<^sub>1 j
\<and> (\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> j\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v)
\<and> (\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> j\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e)\<close>
theorem (in parallel_independence) church_rosser1:
shows \<open>\<exists>(g' ::('o, 'm, 'p, 'n) pre_morph)
(D' :: ('k \<times> 'u + 'e, 'l \<times> 'v + 'f, 'g, 'h) pre_graph)
(m':: ('q, 'k \<times> 'u + 'e, 'r, 'l \<times> 'v + 'f) pre_morph)
(c':: ('k \<times> 'u + 'e, 'm, 'l \<times> 'v + 'f, 'n) pre_morph)
(H :: (('k \<times> 'u + 's) + 'k \<times> 'u + 'e, ('l \<times> 'v + 't) + 'l \<times> 'v + 'f, 'g, 'h) pre_graph)
(f':: ('s, ('k \<times> 'u + 's) + 'k \<times> 'u + 'e, 't, ('l \<times> 'v + 't) + 'l \<times> 'v + 'f) pre_morph)
h'
(g'')
(D'' ::('k \<times> 'u + 's, 'l \<times> 'v + 't, 'g, 'h) pre_graph)
m'' c''
(H :: (('k \<times> 'u + 's) + 'k \<times> 'u + 'e, ('l \<times> 'v + 't) + 'l \<times> 'v + 'f, 'g, 'h) pre_graph)
f'' h''.
sequential_independence r\<^sub>1 b\<^sub>1 b\<^sub>1' G g\<^sub>1 D\<^sub>1 m\<^sub>1 c\<^sub>1 H\<^sub>1 f\<^sub>1 h\<^sub>1 r\<^sub>2 b\<^sub>2 b\<^sub>2' g' D' m' c' H f' h'
\<and> sequential_independence r\<^sub>2 b\<^sub>2 b\<^sub>2' G g\<^sub>2 D\<^sub>2 m\<^sub>2 c\<^sub>2 H\<^sub>2 f\<^sub>2 h\<^sub>2 r\<^sub>1 b\<^sub>1 b\<^sub>1' g'' D'' m'' c'' H f'' h''\<close>
proof -
interpret c\<^sub>1: injective_morphism D\<^sub>1 G c\<^sub>1
using p\<^sub>1.po1.b_inj_imp_g_inj p\<^sub>1.r.k.injective_morphism_axioms by blast
interpret c\<^sub>2: injective_morphism D\<^sub>2 G c\<^sub>2
using p\<^sub>2.po1.b_inj_imp_g_inj p\<^sub>2.r.k.injective_morphism_axioms by blast
interpret h\<^sub>1: injective_morphism D\<^sub>1 H\<^sub>1 h\<^sub>1
using p\<^sub>1.po2.b_inj_imp_g_inj p\<^sub>1.r.r.injective_morphism_axioms by blast
interpret h\<^sub>2: injective_morphism D\<^sub>2 H\<^sub>2 h\<^sub>2
using p\<^sub>2.po2.b_inj_imp_g_inj p\<^sub>2.r.r.injective_morphism_axioms by blast
obtain i\<^sub>1 i\<^sub>2 where \<open>morphism (lhs r\<^sub>1) D\<^sub>2 i\<^sub>1\<close>
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
and \<open>morphism (lhs r\<^sub>2) D\<^sub>1 i\<^sub>2\<close>
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
using i j by auto
interpret i\<^sub>1: morphism "lhs r\<^sub>1" D\<^sub>2 i\<^sub>1
using \<open>morphism (lhs r\<^sub>1) D\<^sub>2 i\<^sub>1\<close> by assumption
interpret i\<^sub>1: injective_morphism "lhs r\<^sub>1" D\<^sub>2 i\<^sub>1
proof
show \<open>inj_on \<^bsub>i\<^sub>1\<^esub>\<^sub>V V\<^bsub>lhs r\<^sub>1\<^esub>\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close>
c\<^sub>2.inj_nodes p\<^sub>1.gi.inj_nodes
by (simp add: inj_on_def morph_comp_def) metis
next
show \<open>inj_on \<^bsub>i\<^sub>1\<^esub>\<^sub>E E\<^bsub>lhs r\<^sub>1\<^esub>\<close>
using \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
c\<^sub>2.inj_edges p\<^sub>1.gi.inj_edges
by (simp add: inj_on_def morph_comp_def) metis
qed
interpret i\<^sub>2: morphism "lhs r\<^sub>2" D\<^sub>1 i\<^sub>2
using \<open>morphism (lhs r\<^sub>2) D\<^sub>1 i\<^sub>2\<close>
by assumption
interpret i\<^sub>2: injective_morphism "lhs r\<^sub>2" D\<^sub>1 i\<^sub>2
proof
show \<open>inj_on \<^bsub>i\<^sub>2\<^esub>\<^sub>V V\<^bsub>lhs r\<^sub>2\<^esub>\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close>
c\<^sub>1.inj_nodes p\<^sub>2.gi.inj_nodes
by (simp add: inj_on_def morph_comp_def) metis
next
show \<open>inj_on \<^bsub>i\<^sub>2\<^esub>\<^sub>E E\<^bsub>lhs r\<^sub>2\<^esub>\<close>
using \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
c\<^sub>1.inj_edges p\<^sub>2.gi.inj_edges
by (simp add: inj_on_def morph_comp_def) metis
qed
interpret "c12": pullback_construction D\<^sub>1 G D\<^sub>2 c\<^sub>1 c\<^sub>2 ..
interpret wf_b\<^sub>1i\<^sub>1: morphism "interf r\<^sub>1" D\<^sub>2 "i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1"
using wf_morph_comp[OF p\<^sub>1.r.k.morphism_axioms i\<^sub>1.morphism_axioms]
by assumption
(* j1 start *)
have a: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> m\<^sub>1\<^esub>\<^sub>V v = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> (i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1)\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>1\<^esub>\<close> for v
using that "c12.pb.node_commutativity" \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close>
p\<^sub>1.po1.node_commutativity p\<^sub>1.r.k.morph_node_range
by (simp add: morph_comp_def "c12.b_def" "c12.c_def" "c12.A_def")
have b: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> m\<^sub>1\<^esub>\<^sub>E e = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> (i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1)\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>1\<^esub>\<close> for e
using that "c12.pb.edge_commutativity" \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
p\<^sub>1.po1.edge_commutativity p\<^sub>1.r.k.morph_edge_range
by (simp add: morph_comp_def "c12.b_def" "c12.c_def" "c12.A_def")
obtain j\<^sub>1 where \<open>morphism (interf r\<^sub>1) c12.A j\<^sub>1\<close>
and \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close>
and \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close>
using c12.pb.universal_property_exist_gen[OF p\<^sub>1.r.k.G.graph_axioms
wf_b\<^sub>1i\<^sub>1.morphism_axioms p\<^sub>1.po1.c.morphism_axioms a b]
by fast
interpret j\<^sub>1: morphism "interf r\<^sub>1" c12.A j\<^sub>1
using \<open>morphism (interf r\<^sub>1) c12.A j\<^sub>1\<close>
by assumption
interpret j\<^sub>1: injective_morphism "interf r\<^sub>1" c12.A j\<^sub>1
proof
show \<open>inj_on \<^bsub>j\<^sub>1\<^esub>\<^sub>V V\<^bsub>interf r\<^sub>1\<^esub>\<close>
thm c12.b.morphism_axioms
using \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close> p\<^sub>1.d_inj.inj_nodes
by (simp add: morph_comp_def inj_on_def) metis
next
show \<open>inj_on \<^bsub>j\<^sub>1\<^esub>\<^sub>E E\<^bsub>interf r\<^sub>1\<^esub>\<close>
using \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close> p\<^sub>1.d_inj.inj_edges
by (simp add: morph_comp_def inj_on_def) metis
qed
(* j2 start *)
interpret b\<^sub>2i\<^sub>2: morphism "interf r\<^sub>2" D\<^sub>1 "i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2"
using wf_morph_comp[OF p\<^sub>2.r.k.morphism_axioms i\<^sub>2.morphism_axioms]
by assumption
have a: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> (i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> m\<^sub>2\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>2\<^esub>\<close> for v
using c12.pb.node_commutativity \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close>
p\<^sub>2.po1.node_commutativity p\<^sub>2.r.k.morph_node_range that
by (simp add: morph_comp_def c12.b_def c12.c_def c12.A_def)
have b: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> (i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> m\<^sub>2\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>2\<^esub>\<close> for e
using c12.pb.edge_commutativity \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
p\<^sub>2.po1.edge_commutativity p\<^sub>2.r.k.morph_edge_range that
by (simp add: morph_comp_def c12.b_def c12.c_def c12.A_def)
obtain j\<^sub>2 where \<open>morphism (interf r\<^sub>2) c12.A j\<^sub>2\<close>
and \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close> \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close>
and j2c: \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>V v\<close> \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>E e\<close>
using c12.pb.universal_property_exist_gen[OF p\<^sub>2.r.k.G.graph_axioms p\<^sub>2.po1.c.morphism_axioms b\<^sub>2i\<^sub>2.morphism_axioms a b]
by fast
interpret j\<^sub>2: morphism "interf r\<^sub>2" c12.A j\<^sub>2
using \<open>morphism (interf r\<^sub>2) c12.A j\<^sub>2\<close>
by assumption
interpret j\<^sub>2: injective_morphism "interf r\<^sub>2" c12.A j\<^sub>2
proof
show \<open>inj_on \<^bsub>j\<^sub>2\<^esub>\<^sub>V V\<^bsub>interf r\<^sub>2\<^esub>\<close>
using \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close> p\<^sub>2.d_inj.inj_nodes
by (simp add: morph_comp_def inj_on_def) metis
next
show \<open>inj_on \<^bsub>j\<^sub>2\<^esub>\<^sub>E E\<^bsub>interf r\<^sub>2\<^esub>\<close>
using \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close> p\<^sub>2.d_inj.inj_edges
by (simp add: morph_comp_def inj_on_def) metis
qed
(* commutativity *)
interpret morphism "interf r\<^sub>1" D\<^sub>1 "c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1"
using wf_morph_comp[OF j\<^sub>1.morphism_axioms c12.b.morphism_axioms]
by assumption
interpret morphism "lhs r\<^sub>1" G "c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1"
using wf_morph_comp[OF i\<^sub>1.morphism_axioms p\<^sub>2.po1.g.morphism_axioms]
by assumption
interpret pb1: pullback_diagram "interf r\<^sub>1" "lhs r\<^sub>1" D\<^sub>1 G b\<^sub>1 m\<^sub>1 g\<^sub>1 c\<^sub>1
using p\<^sub>1.pb1.pullback_diagram_axioms by force
interpret "11+12": pushout_diagram "interf r\<^sub>1" D\<^sub>1 "lhs r\<^sub>1" G
"c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1" b\<^sub>1 c\<^sub>1 "c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1"
proof
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>1\<^esub>\<close> for v
using that p\<^sub>1.po1.node_commutativity \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> p\<^sub>1.r.k.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>1\<^esub>\<close> for e
using that p\<^sub>1.po1.edge_commutativity \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close> p\<^sub>1.r.k.morph_edge_range
by (simp add: morph_comp_def)
next
show \<open>Ex1M
(\<lambda>xa. morphism (to_ngraph G) D' xa \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e))
(to_ngraph G)\<close> if \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>1)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>1) D' x\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1\<^esub>\<^sub>E e\<close>
for D' :: "('g,'h) ngraph" and x y
proof -
have \<open>\<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>1\<^esub>\<close> for v
using that \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
have \<open>\<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>\<close> for v
using that \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
(* from here: *)
have a: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>1\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
have b: \<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>1\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close> \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
obtain u where \<open>morphism (to_ngraph G) D' u\<close>
and aa1: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
and aa2: \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
using p\<^sub>1.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>1)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>1) D' x\<close> a b]
by fast
(* used for technical reasons within the upcoming proof *)
have n: \<open>morphism (to_ngraph G) D' u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using \<open>morphism (to_ngraph G) D' u\<close> aa1(1) aa1(2) aa2(1) aa2(2) by force
show ?thesis
proof (rule_tac x = u in exI, safe)
show \<open>morphism (to_ngraph G) D' u\<close>
using \<open>morphism (to_ngraph G) D' u\<close> by assumption
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph D\<^sub>1\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> if \<open>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>\<close> for e
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> that
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> if \<open>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>\<close> for v
using aa1(1) \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> that
by (auto simp add: to_nmorph_def morph_comp_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close> if \<open>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>\<close> for e
using aa1(2) \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close> that
by (auto simp add: to_nmorph_def morph_comp_def to_ngraph_def)
next
show \<open>\<^bsub>ya\<^esub>\<^sub>E e = \<^bsub>u\<^esub>\<^sub>E e\<close>
if \<open>morphism (to_ngraph G) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open> e \<in> E\<^bsub>to_ngraph G\<^esub>\<close>
for ya e
proof -
have m:\<open>morphism (to_ngraph G) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using that
proof (intro conjI)
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
qed assumption
show ?thesis
using ex_eq[OF p\<^sub>1.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>1)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>1) D' x\<close> a b], OF n m] that
by simp
qed
next
show \<open>\<^bsub>ya\<^esub>\<^sub>V v = \<^bsub>u\<^esub>\<^sub>V v\<close>
if \<open>morphism (to_ngraph G) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open>v \<in> V\<^bsub>to_ngraph G\<^esub>\<close>
for ya v
proof -
have m:\<open>morphism (to_ngraph G) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using that
proof (intro conjI)
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>V v = \<^bsub>g\<^sub>1\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1\<^esub>\<^sub>E e = \<^bsub>g\<^sub>1\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
qed assumption
show ?thesis
using ex_eq[OF p\<^sub>1.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>1)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>1) D' x\<close> a b], OF n m] that
by simp
qed
qed
qed
qed
(* show pb is also a pushout *)
interpret inj_k: injective_morphism c12.A D\<^sub>1 c12.b
using c12.pb.g_inj_imp_b_inj[OF c\<^sub>2.injective_morphism_axioms]
by assumption
interpret ink_l: injective_morphism c12.A D\<^sub>2 c12.c
using pullback_diagram.g_inj_imp_b_inj[OF c12.pb.flip_diagram c\<^sub>1.injective_morphism_axioms]
by assumption
have a: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>1\<^esub>\<close> for v
using that "11+12.node_commutativity"
by(simp add: morph_comp_def)
have b: \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>1\<^esub>\<close> for e
using that "11+12.edge_commutativity"
by(simp add: morph_comp_def)
(* till here (experiment) *)
interpret pbj1: injective_morphism "interf r\<^sub>1" D\<^sub>1 "c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1"
using inj_comp_inj
using "11+12.flip_diagram" c\<^sub>2.injective_morphism_axioms i\<^sub>1.injective_morphism_axioms p\<^sub>1.r.k.injective_morphism_axioms pushout_diagram.b_f_inj_imp_c_inj by blast
interpret "11+12pb": pullback_diagram "interf r\<^sub>1" D\<^sub>1 "lhs r\<^sub>1" G "c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1" b\<^sub>1 c\<^sub>1 "c\<^sub>2 \<circ>\<^sub>\<rightarrow> i\<^sub>1"
using "11+12.pushout_pullback_inj_b"[OF pbj1.injective_morphism_axioms]
using p\<^sub>1.r.k.injective_morphism_axioms by fastforce
interpret pb11: pullback_diagram "interf r\<^sub>1" c12.A "lhs r\<^sub>1" D\<^sub>2 j\<^sub>1 b\<^sub>1 c12.c i\<^sub>1
using pullback_decomposition[OF j\<^sub>1.morphism_axioms _ c12.pb.pullback_diagram_axioms]
using "11+12pb.pullback_diagram_axioms" \<open>\<And>e. e \<in> E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close> \<open>\<And>v. v \<in> V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close> i\<^sub>1.morphism_axioms by blast
(* CLEANUP HERE *)
(* WITH BRIAN *)
have jointly_surj_nodes: \<open>(\<exists>v\<in>V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>i\<^sub>1\<^esub>\<^sub>V v = x) \<or> (\<exists>v\<in>V\<^bsub>c12.A\<^esub>. \<^bsub>c12.c\<^esub>\<^sub>V v = x)\<close>
if \<open>x \<in> V\<^bsub>D\<^sub>2\<^esub>\<close> for x
apply (simp add: c12.A_def c12.c_def)
using c\<^sub>2.inj_nodes "11+12.joint_surjectivity_nodes"[OF p\<^sub>2.po1.g.morph_node_range[OF \<open>x \<in> V\<^bsub>D\<^sub>2\<^esub>\<close>]] that i\<^sub>1.morph_node_range
by (auto simp add: morph_comp_def inj_on_def)
have jointly_surj_nodes: \<open>(\<exists>v\<in>V\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>i\<^sub>1\<^esub>\<^sub>V v = x) \<or> (\<exists>v\<in>V\<^bsub>c12.A\<^esub>. \<^bsub>c12.c\<^esub>\<^sub>V v = x)\<close>
if \<open>x \<in> V\<^bsub>D\<^sub>2\<^esub>\<close> for x
using that c\<^sub>2.inj_nodes p\<^sub>2.po1.g.morph_node_range c12.reduced_chain_condition_nodes
"11+12.joint_surjectivity_nodes" p\<^sub>1.po1.joint_surjectivity_nodes i\<^sub>1.morph_node_range
by (auto simp add: morph_comp_def inj_on_def) metis
have jointly_surj_edges: \<open>(\<exists>e\<in>E\<^bsub>lhs r\<^sub>1\<^esub>. \<^bsub>i\<^sub>1\<^esub>\<^sub>E e = x) \<or> (\<exists>e\<in>E\<^bsub>c12.A\<^esub>. \<^bsub>c12.c\<^esub>\<^sub>E e = x)\<close>
if \<open>x \<in> E\<^bsub>D\<^sub>2\<^esub>\<close> for x
using that c\<^sub>2.inj_edges p\<^sub>2.po1.g.morph_edge_range c12.reduced_chain_condition_edges
"11+12.joint_surjectivity_edges" p\<^sub>1.po1.joint_surjectivity_edges i\<^sub>1.morph_edge_range
by (auto simp add: morph_comp_def inj_on_def) metis
interpret "11": pushout_diagram "interf r\<^sub>1" c12.A "lhs r\<^sub>1" D\<^sub>2
j\<^sub>1 b\<^sub>1 c12.c i\<^sub>1
using po_characterization[OF j\<^sub>1.injective_morphism_axioms
p\<^sub>1.r.k.injective_morphism_axioms
ink_l.injective_morphism_axioms i\<^sub>1.injective_morphism_axioms
\<open>\<And>v. v \<in> V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close>
pb11.reduced_chain_condition_nodes
pb11.reduced_chain_condition_edges
jointly_surj_nodes jointly_surj_edges] by blast
interpret pushout_diagram c12.A D\<^sub>1 D\<^sub>2 G c12.b c12.c c\<^sub>1 c\<^sub>2
using pushout_decomposition[OF c12.b.morphism_axioms p\<^sub>2.po1.g.morphism_axioms "11.pushout_diagram_axioms" "11+12.pushout_diagram_axioms" c12.pb.node_commutativity c12.pb.edge_commutativity]
by simp
interpret morphism "interf r\<^sub>2" D\<^sub>2 "c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2"
using wf_morph_comp[OF j\<^sub>2.morphism_axioms c12.c.morphism_axioms]
by assumption
interpret morphism "lhs r\<^sub>2" G "c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2"
proof
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e \<in> E\<^bsub>G\<^esub>\<close> if \<open>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>\<close> for e
using that i\<^sub>2.morph_edge_range p\<^sub>1.po1.g.morph_edge_range
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v \<in> V\<^bsub>G\<^esub>\<close> if \<open>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>\<close> for v
using that i\<^sub>2.morph_node_range p\<^sub>1.po1.g.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V (s\<^bsub>lhs r\<^sub>2\<^esub> e) = s\<^bsub>G\<^esub> (\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>\<close> for e
using that i\<^sub>2.morph_edge_range i\<^sub>2.source_preserve p\<^sub>1.po1.g.source_preserve
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V (t\<^bsub>lhs r\<^sub>2\<^esub> e) = t\<^bsub>G\<^esub> (\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>\<close> for e
using that i\<^sub>2.morph_edge_range i\<^sub>2.target_preserve p\<^sub>1.po1.g.target_preserve
by (simp add: morph_comp_def)
next
show \<open>l\<^bsub>lhs r\<^sub>2\<^esub> v = l\<^bsub>G\<^esub> (\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>\<close> for v
using that i\<^sub>2.label_preserve i\<^sub>2.morph_node_range p\<^sub>1.po1.g.label_preserve
by (simp add: morph_comp_def)
next
show \<open>m\<^bsub>lhs r\<^sub>2\<^esub> e = m\<^bsub>G\<^esub> (\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>\<close> for e
using that i\<^sub>2.mark_preserve i\<^sub>2.morph_edge_range p\<^sub>1.po1.g.mark_preserve
by (simp add: morph_comp_def)
qed
interpret "31+32": pushout_diagram "interf r\<^sub>2" D\<^sub>2 "lhs r\<^sub>2" G "c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2" b\<^sub>2 c\<^sub>2 "c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2"
proof
show \<open>\<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>2\<^esub>\<close> for v
using that p\<^sub>2.po1.node_commutativity p\<^sub>2.r.k.morph_node_range
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>2\<^esub>\<close> for e
using that p\<^sub>2.po1.edge_commutativity p\<^sub>2.r.k.morph_edge_range
\<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close> \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e= \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
next
show \<open>Ex1M
(\<lambda>xa. morphism (to_ngraph G) D' xa \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e))
(to_ngraph G)\<close>
if \<open>graph D'\<close>
\<open>morphism (to_ngraph D\<^sub>2) D' x\<close>
\<open>morphism (to_ngraph (lhs r\<^sub>2)) D' y\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2\<^esub>\<^sub>E e\<close>
for D' :: "('g,'h) ngraph" and x y
proof -
have \<open>\<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>2\<^esub>\<close> for v
using that \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have \<open>\<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>\<close> for v
using that \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have a: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>2\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
have b: \<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>2\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close> \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
obtain u where \<open>morphism (to_ngraph G) D' u\<close>
and aa1: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
and aa2: \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
using p\<^sub>2.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>2)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>2) D' x\<close> a b]
by fast
(* used for technical reasons within the upcoming proof *)
have n: \<open>morphism (to_ngraph G) D' u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using \<open>morphism (to_ngraph G) D' u\<close> aa1(1) aa1(2) aa2(1) aa2(2) by force
show ?thesis
proof (rule_tac x = u in exI, safe)
show \<open>morphism (to_ngraph G) D' u\<close>
using \<open>morphism (to_ngraph G) D' u\<close> by assumption
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph D\<^sub>2\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> if \<open>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>\<close> for e
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> that
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> if \<open>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>\<close> for v
using aa1(1) \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> that
by (auto simp add: to_nmorph_def morph_comp_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close> if \<open>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>\<close> for e
using aa1(2) \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close> that
by (auto simp add: to_nmorph_def morph_comp_def to_ngraph_def)
next
show \<open>\<^bsub>ya\<^esub>\<^sub>E e = \<^bsub>u\<^esub>\<^sub>E e\<close>
if \<open>morphism (to_ngraph G) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open> e \<in> E\<^bsub>to_ngraph G\<^esub>\<close>
for ya e
proof -
have m:\<open>morphism (to_ngraph G) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using that
proof (intro conjI)
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
qed assumption
show ?thesis
using ex_eq[OF p\<^sub>2.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>2)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>2) D' x\<close> a b], OF n m] that
by simp
qed
next
show \<open>\<^bsub>ya\<^esub>\<^sub>V v = \<^bsub>u\<^esub>\<^sub>V v\<close>
if \<open>morphism (to_ngraph G) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2)\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open>v \<in> V\<^bsub>to_ngraph G\<^esub>\<close>
for ya v
proof -
have m:\<open>morphism (to_ngraph G) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph c\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e)\<close>
using that
proof (intro conjI)
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v \<in> V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>V v = \<^bsub>g\<^sub>2\<^esub>\<^sub>V v\<close> that
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (lhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph g\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e \<in> E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2\<^esub>\<^sub>E e = \<^bsub>g\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_ngraph_def to_nmorph_def)
qed assumption
show ?thesis
using ex_eq[OF p\<^sub>2.po1.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (lhs r\<^sub>2)) D' y\<close> \<open>morphism (to_ngraph D\<^sub>2) D' x\<close> a b], OF n m] that
by simp
qed
qed
qed
qed
have a: \<open>\<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>2\<^esub>\<close> for v
using "31+32.node_commutativity" that
by (simp add: morph_comp_def)
have b: \<open>\<^bsub>c\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>2\<^esub>\<close> for e
using "31+32.edge_commutativity" that
by (simp add: morph_comp_def)
(* Experimental *)
(* TODO: proof *)
interpret "31+32pb": pullback_diagram "interf r\<^sub>2" D\<^sub>2 "lhs r\<^sub>2" G "c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2" b\<^sub>2 c\<^sub>2 "c\<^sub>1 \<circ>\<^sub>\<rightarrow> i\<^sub>2"
using "31+32.flip_diagram" "31+32.pushout_pullback_inj_b" c\<^sub>1.injective_morphism_axioms i\<^sub>2.injective_morphism_axioms inj_comp_inj p\<^sub>2.r.k.injective_morphism_axioms pushout_diagram.b_f_inj_imp_c_inj by blast
(* TODO Proof *)
interpret pb31: pullback_diagram "interf r\<^sub>2" c12.A "lhs r\<^sub>2" D\<^sub>1 j\<^sub>2 b\<^sub>2 c12.b i\<^sub>2
using pullback_decomposition[OF _ _ c12.pb.flip_diagram "31+32pb.pullback_diagram_axioms"]
using i\<^sub>2.morphism_axioms j2c(1) j2c(2) j\<^sub>2.morphism_axioms by blast
have jointly_surj_nodes: \<open>(\<exists>v\<in>V\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>i\<^sub>2\<^esub>\<^sub>V v = x) \<or> (\<exists>v\<in>V\<^bsub>c12.A\<^esub>. \<^bsub>c12.b\<^esub>\<^sub>V v = x)\<close>
if \<open>x \<in> V\<^bsub>D\<^sub>1\<^esub>\<close> for x
using that c12.reduced_chain_condition_nodes i\<^sub>2.inj_nodes inj_k.inj_nodes
p\<^sub>2.po1.joint_surjectivity_nodes "31+32.joint_surjectivity_nodes"
c\<^sub>1.inj_nodes i\<^sub>2.morph_node_range inj_on_def p\<^sub>1.po1.g.morph_node_range
apply (auto simp add: morph_comp_def inj_on_def)
by metis
have jointly_surj_edges: \<open>(\<exists>e\<in>E\<^bsub>lhs r\<^sub>2\<^esub>. \<^bsub>i\<^sub>2\<^esub>\<^sub>E e = x) \<or> (\<exists>e\<in>E\<^bsub>c12.A\<^esub>. \<^bsub>c12.b\<^esub>\<^sub>E e = x)\<close>
if \<open>x \<in> E\<^bsub>D\<^sub>1\<^esub>\<close> for x
using that c12.reduced_chain_condition_edges i\<^sub>2.inj_edges inj_k.inj_edges
p\<^sub>2.po1.joint_surjectivity_edges "31+32.joint_surjectivity_edges"
c\<^sub>1.inj_edges i\<^sub>2.morph_edge_range inj_on_def p\<^sub>1.po1.g.morph_edge_range
apply (auto simp add: morph_comp_def inj_on_def)
by metis
(* pushout_diagram (interf r\<^sub>2) c12.A (lhs r\<^sub>2) D\<^sub>1 j\<^sub>2 b\<^sub>2 c12.b i\<^sub>2 *)
interpret "31": pushout_diagram "interf r\<^sub>2" "lhs r\<^sub>2" c12.A D\<^sub>1 b\<^sub>2 j\<^sub>2 i\<^sub>2 c12.b
using po_characterization[OF j\<^sub>2.injective_morphism_axioms p\<^sub>2.r.k.injective_morphism_axioms
inj_k.injective_morphism_axioms i\<^sub>2.injective_morphism_axioms
j2c
pb31.reduced_chain_condition_nodes pb31.reduced_chain_condition_edges
jointly_surj_nodes jointly_surj_edges]
using pushout_diagram.flip_diagram by blast
interpret "c21": gluing "interf r\<^sub>1" c12.A "rhs r\<^sub>1" j\<^sub>1 b\<^sub>1' ..
interpret "c41": gluing "interf r\<^sub>2" c12.A "rhs r\<^sub>2" j\<^sub>2 b\<^sub>2' ..
interpret "c5": gluing c12.A "c41.H" "c21.H" "c41.c" "c21.c" ..
interpret h1b: morphism c12.A H\<^sub>1 "h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b"
using wf_morph_comp[OF c12.b.morphism_axioms p\<^sub>1.po2.g.morphism_axioms]
by assumption
(* aaa and bbb belong to s\<^sub>1 *)
have aaa: \<open>\<forall>v\<in>V\<^bsub>interf r\<^sub>1\<^esub>. \<^bsub>f\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1'\<^esub>\<^sub>V v = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v\<close>
using p\<^sub>1.po2.node_commutativity a \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have bbb: \<open>\<forall>e\<in>E\<^bsub>interf r\<^sub>1\<^esub>. \<^bsub>f\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1'\<^esub>\<^sub>E e = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e\<close>
using p\<^sub>1.po2.edge_commutativity b \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
obtain s\<^sub>1 where
\<open>morphism c21.H H\<^sub>1 s\<^sub>1\<close> and
\<open>\<And>v. v \<in> V\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.c\<^esub>\<^sub>V v = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.c\<^esub>\<^sub>E e = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b\<^esub>\<^sub>E e\<close>
(* and (2) = (8) + (11) *)
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
using c21.po.universal_property_exist_gen[OF p\<^sub>1.po2.f.H.graph_axioms
p\<^sub>1.po2.f.morphism_axioms
wf_morph_comp[OF c12.b.morphism_axioms p\<^sub>1.po2.g.morphism_axioms] aaa bbb]
by auto
interpret s\<^sub>1: morphism c21.H H\<^sub>1 s\<^sub>1
using \<open>morphism c21.H H\<^sub>1 s\<^sub>1\<close> by assumption
interpret morphism "rhs r\<^sub>1" H\<^sub>1 "s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h"
proof
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e \<in> E\<^bsub>H\<^sub>1\<^esub>\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>1\<^esub>\<close> for e
using that \<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
p\<^sub>1.po2.f.morph_edge_range
by simp
next
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v \<in> V\<^bsub>H\<^sub>1\<^esub>\<close> if \<open>v \<in> V\<^bsub>rhs r\<^sub>1\<^esub>\<close> for v
using that \<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
p\<^sub>1.po2.f.morph_node_range
by simp
next
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V (s\<^bsub>rhs r\<^sub>1\<^esub> e) = s\<^bsub>H\<^sub>1\<^esub> (\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>1\<^esub>\<close> for e
using that p\<^sub>1.r.r.H.source_integrity p\<^sub>1.po2.f.source_preserve
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close> p\<^sub>1.r.r.H.source_integrity
by simp
next
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V (t\<^bsub>rhs r\<^sub>1\<^esub> e) = t\<^bsub>H\<^sub>1\<^esub> (\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>1\<^esub>\<close> for e
using that p\<^sub>1.r.r.H.target_integrity p\<^sub>1.po2.f.target_preserve
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close> p\<^sub>1.r.r.H.target_integrity
by simp
next
show \<open>l\<^bsub>rhs r\<^sub>1\<^esub> v = l\<^bsub>H\<^sub>1\<^esub> (\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>rhs r\<^sub>1\<^esub>\<close> for v
using that p\<^sub>1.po2.f.label_preserve
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
by simp
next
show \<open> m\<^bsub>rhs r\<^sub>1\<^esub> e = m\<^bsub>H\<^sub>1\<^esub> (\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>1\<^esub>\<close> for e
using that p\<^sub>1.po2.f.mark_preserve
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
by simp
qed
interpret "21+22": pushout_diagram "interf r\<^sub>1" "rhs r\<^sub>1" D\<^sub>1 H\<^sub>1 b\<^sub>1' "c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1" \<open>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<close> h\<^sub>1
proof
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h \<circ>\<^sub>\<rightarrow> b\<^sub>1'\<^esub>\<^sub>V v = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>interf r\<^sub>1\<^esub>\<close> for v
using that aaa
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close> p\<^sub>1.r.r.morph_node_range
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h \<circ>\<^sub>\<rightarrow> b\<^sub>1'\<^esub>\<^sub>E e = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>interf r\<^sub>1\<^esub>\<close> for e
using that bbb
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close> p\<^sub>1.r.r.morph_edge_range
by (simp add: morph_comp_def)
next
show \<open>Ex1M
(\<lambda>xa. morphism (to_ngraph H\<^sub>1) D' xa \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e))
(to_ngraph H\<^sub>1)\<close>
if \<open>graph D'\<close>
\<open>morphism (to_ngraph (rhs r\<^sub>1)) D' x\<close>
\<open>morphism (to_ngraph D\<^sub>1) D' y\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>E e\<close>
for D' :: "('g,'h) ngraph" and x y
proof -
have a: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>1\<^esub>\<^sub>V v\<close>
using \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>m\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def to_nmorph_def to_ngraph_def)
have b:\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>1\<^esub>\<^sub>E e\<close>
using \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>m\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>1)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>1'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.b \<circ>\<^sub>\<rightarrow> j\<^sub>1)\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_nmorph_def to_ngraph_def)
obtain u where \<open>morphism (to_ngraph H\<^sub>1) D' u\<close>
and u1: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
and u2: \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using p\<^sub>1.po2.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (rhs r\<^sub>1)) D' x\<close> \<open>morphism (to_ngraph D\<^sub>1) D' y\<close> a b]
by fast
have m: \<open>morphism (to_ngraph H\<^sub>1) D' u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
using u1 u2 \<open>morphism (to_ngraph H\<^sub>1) D' u\<close>
by fastforce
show ?thesis
proof (rule_tac x = u in exI, safe)
show \<open>morphism (to_ngraph H\<^sub>1) D' u\<close>
using \<open>morphism (to_ngraph H\<^sub>1) D' u\<close> by assumption
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>\<close> for e
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph D\<^sub>1\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>to_ngraph D\<^sub>1\<^esub>\<close> for e
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
by simp
next
show \<open>\<^bsub>ya\<^esub>\<^sub>E e = \<^bsub>u\<^esub>\<^sub>E e\<close>
if \<open>morphism (to_ngraph H\<^sub>1) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open>e \<in> E\<^bsub>to_ngraph H\<^sub>1\<^esub>\<close> for ya e
proof -
have n: \<open>morphism (to_ngraph H\<^sub>1) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
proof (intro conjI)
show \<open>morphism (to_ngraph H\<^sub>1) D' ya\<close>
using \<open> morphism (to_ngraph H\<^sub>1) D' ya\<close> by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> by assumption
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that(5) by assumption
qed
show ?thesis
using that ex_eq[OF p\<^sub>1.po2.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (rhs r\<^sub>1)) D' x\<close> \<open>morphism (to_ngraph D\<^sub>1) D' y\<close> a b] n m]
by blast
qed
next
show \<open>\<^bsub>ya\<^esub>\<^sub>V v = \<^bsub>u\<^esub>\<^sub>V v\<close>
if \<open>morphism (to_ngraph H\<^sub>1) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open>v \<in> V\<^bsub>to_ngraph H\<^sub>1\<^esub>\<close> for ya v
proof -
have n: \<open>morphism (to_ngraph H\<^sub>1) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
proof (intro conjI)
show \<open>morphism (to_ngraph H\<^sub>1) D' ya\<close>
using \<open> morphism (to_ngraph H\<^sub>1) D' ya\<close> by assumption
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>1\<^esub>\<^sub>V v\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>1)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>1\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>1\<^esub>\<^sub>E e\<close>
by (fastforce simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> by assumption
next
show \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>1\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>1\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using that(5) by blast
qed
show ?thesis
using that ex_eq[OF p\<^sub>1.po2.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (rhs r\<^sub>1)) D' x\<close> \<open>morphism (to_ngraph D\<^sub>1) D' y\<close> a b] n m]
by blast
qed
qed
qed
qed
interpret "22": pushout_diagram c12.A D\<^sub>1 c21.H H\<^sub>1 c12.b c21.c h\<^sub>1 s\<^sub>1
using pushout_decomposition[OF c12.b.morphism_axioms s\<^sub>1.morphism_axioms
c21.po.flip_diagram "21+22.flip_diagram"]
\<open>\<And>e. e \<in> E\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.c\<^esub>\<^sub>E e = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b\<^esub>\<^sub>E e\<close>
\<open>\<And>v. v \<in> V\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>1 \<circ>\<^sub>\<rightarrow> c21.c\<^esub>\<^sub>V v = \<^bsub>h\<^sub>1 \<circ>\<^sub>\<rightarrow> c12.b\<^esub>\<^sub>V v\<close>
by simp
(* start of s\<^sub>2 *)
have aaa2: \<open>\<forall>v\<in>V\<^bsub>interf r\<^sub>2\<^esub>. \<^bsub>f\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2'\<^esub>\<^sub>V v = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v\<close>
using p\<^sub>2.po2.node_commutativity \<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>V v = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
have bbb2: \<open>\<forall>e\<in>E\<^bsub>interf r\<^sub>2\<^esub>. \<^bsub>f\<^sub>2 \<circ>\<^sub>\<rightarrow> b\<^sub>2'\<^esub>\<^sub>E e = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e\<close>
using p\<^sub>2.po2.edge_commutativity \<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>1\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>1\<^esub>\<^sub>E e = \<^bsub>i\<^sub>1 \<circ>\<^sub>\<rightarrow> b\<^sub>1\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
obtain s\<^sub>2 where
\<open>morphism c41.H H\<^sub>2 s\<^sub>2\<close> and
\<open>\<And>v. v \<in> V\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.c\<^esub>\<^sub>V v = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>c12.A\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.c\<^esub>\<^sub>E e = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> c12.c\<^esub>\<^sub>E e\<close>
(* (4) = (9)+(12) *)
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
using c41.po.universal_property_exist_gen[OF p\<^sub>2.po2.f.H.graph_axioms
p\<^sub>2.po2.f.morphism_axioms
wf_morph_comp[OF c12.c.morphism_axioms p\<^sub>2.po2.g.morphism_axioms] aaa2 bbb2]
by fast
interpret s\<^sub>2: morphism c41.H H\<^sub>2 s\<^sub>2
using \<open>morphism c41.H H\<^sub>2 s\<^sub>2\<close> by assumption
interpret morphism "rhs r\<^sub>2" H\<^sub>2 "s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h"
proof
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e \<in> E\<^bsub>H\<^sub>2\<^esub>\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>2\<^esub>\<close> for e
using that \<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close> p\<^sub>2.po2.f.morph_edge_range
by simp
next
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v \<in> V\<^bsub>H\<^sub>2\<^esub>\<close> if \<open>v \<in> V\<^bsub>rhs r\<^sub>2\<^esub>\<close> for v
using that \<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close> p\<^sub>2.po2.f.morph_node_range
by simp
next
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V (s\<^bsub>rhs r\<^sub>2\<^esub> e) = s\<^bsub>H\<^sub>2\<^esub> (\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>2\<^esub>\<close> for e
using that
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
p\<^sub>2.po2.f.source_preserve p\<^sub>2.r.r.H.source_integrity
by simp
next
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V (t\<^bsub>rhs r\<^sub>2\<^esub> e) = t\<^bsub>H\<^sub>2\<^esub> (\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>2\<^esub>\<close> for e
using that
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
p\<^sub>2.po2.f.target_preserve p\<^sub>2.r.r.H.target_integrity
by simp
next
show \<open>l\<^bsub>rhs r\<^sub>2\<^esub> v = l\<^bsub>H\<^sub>2\<^esub> (\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v)\<close> if \<open>v \<in> V\<^bsub>rhs r\<^sub>2\<^esub>\<close> for v
using that \<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
p\<^sub>2.po2.f.label_preserve
by simp
next
show \<open>m\<^bsub>rhs r\<^sub>2\<^esub> e = m\<^bsub>H\<^sub>2\<^esub> (\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e)\<close> if \<open>e \<in> E\<^bsub>rhs r\<^sub>2\<^esub>\<close> for e
using that \<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
p\<^sub>2.po2.f.mark_preserve
by simp
qed
interpret "41+42": pushout_diagram "interf r\<^sub>2" "rhs r\<^sub>2" D\<^sub>2 H\<^sub>2 b\<^sub>2' "c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2" "s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h" h\<^sub>2
proof
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h \<circ>\<^sub>\<rightarrow> b\<^sub>2'\<^esub>\<^sub>V v = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>V v\<close>
if \<open>v \<in> V\<^bsub>interf r\<^sub>2\<^esub>\<close> for v
using that p\<^sub>2.po2.node_commutativity aaa2 p\<^sub>2.r.r.morph_node_range
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def)
next
show \<open>\<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h \<circ>\<^sub>\<rightarrow> b\<^sub>2'\<^esub>\<^sub>E e = \<^bsub>h\<^sub>2 \<circ>\<^sub>\<rightarrow> (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>E e\<close>
if \<open>e \<in> E\<^bsub>interf r\<^sub>2\<^esub>\<close> for e
using that p\<^sub>2.po2.edge_commutativity bbb2 p\<^sub>2.r.r.morph_edge_range
\<open>\<And>e. e\<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def)
next
show \<open>Ex1M
(\<lambda>xa. morphism (to_ngraph H\<^sub>2) D' xa \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and> (\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and> (\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>xa \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e))
(to_ngraph H\<^sub>2)\<close>
if \<open>graph D'\<close>
\<open>morphism (to_ngraph (rhs r\<^sub>2)) D' x\<close>
\<open>morphism (to_ngraph D\<^sub>2) D' y\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>E e\<close>
for D' :: "('g,'h) ngraph" and x y
proof -
have a: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>2\<^esub>\<^sub>V v\<close>
using \<open>\<forall>v\<in>V\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>V v = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v\<in>V\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>V v = \<^bsub>m\<^sub>2\<^esub>\<^sub>V v\<close>
by (simp add: morph_comp_def to_nmorph_def to_ngraph_def)
have b: \<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph m\<^sub>2\<^esub>\<^sub>E e\<close>
using \<open>\<forall>e\<in>E\<^bsub>to_ngraph (interf r\<^sub>2)\<^esub>. \<^bsub>x \<circ>\<^sub>\<rightarrow> to_nmorph b\<^sub>2'\<^esub>\<^sub>E e = \<^bsub>y \<circ>\<^sub>\<rightarrow> to_nmorph (c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2)\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e\<in>E\<^bsub>interf r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>c12.c \<circ>\<^sub>\<rightarrow> j\<^sub>2\<^esub>\<^sub>E e = \<^bsub>m\<^sub>2\<^esub>\<^sub>E e\<close>
by (simp add: morph_comp_def to_nmorph_def to_ngraph_def)
obtain u where \<open>morphism (to_ngraph H\<^sub>2) D' u\<close>
and u1: \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
and u2: \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
using p\<^sub>2.po2.universal_property[OF \<open>graph D'\<close> \<open>morphism (to_ngraph (rhs r\<^sub>2)) D' x\<close> \<open>morphism (to_ngraph D\<^sub>2) D' y\<close> a b]
by fast
(* technical reasons *)
have m: \<open>morphism (to_ngraph H\<^sub>2) D' u \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
using u1 u2 \<open>morphism (to_ngraph H\<^sub>2) D' u\<close>
by fastforce
show ?thesis
proof (rule_tac x = u in exI, safe)
show \<open>morphism (to_ngraph H\<^sub>2) D' u\<close>
using \<open>morphism (to_ngraph H\<^sub>2) D' u\<close> by assumption
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<And>v. v \<in> V\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>V v = \<^bsub>f\<^sub>2\<^esub>\<^sub>V v\<close>
by (auto simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>\<close> for e
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<And>e. e \<in> E\<^bsub>rhs r\<^sub>2\<^esub> \<Longrightarrow> \<^bsub>s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h\<^esub>\<^sub>E e = \<^bsub>f\<^sub>2\<^esub>\<^sub>E e\<close>
by (auto simp add: morph_comp_def to_nmorph_def to_ngraph_def)
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close> if \<open>v \<in> V\<^bsub>to_ngraph D\<^sub>2\<^esub>\<close> for v
using that \<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
by simp
next
show \<open>\<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close> if \<open>e \<in> E\<^bsub>to_ngraph D\<^sub>2\<^esub>\<close> for e
using that \<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>u \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
by simp
next
show \<open>\<^bsub>ya\<^esub>\<^sub>E e = \<^bsub>u\<^esub>\<^sub>E e\<close>
if \<open>morphism (to_ngraph H\<^sub>2) D' ya\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph (s\<^sub>2 \<circ>\<^sub>\<rightarrow> c41.h)\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e\<close>
\<open>\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v\<close>
\<open>\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e\<close>
\<open>e \<in> E\<^bsub>to_ngraph H\<^sub>2\<^esub>\<close>
for ya e
proof -
have n: \<open>morphism (to_ngraph H\<^sub>2) D' ya \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>V v = \<^bsub>x\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph (rhs r\<^sub>2)\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph f\<^sub>2\<^esub>\<^sub>E e = \<^bsub>x\<^esub>\<^sub>E e) \<and>
(\<forall>v\<in>V\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>V v = \<^bsub>y\<^esub>\<^sub>V v) \<and>
(\<forall>e\<in>E\<^bsub>to_ngraph D\<^sub>2\<^esub>. \<^bsub>ya \<circ>\<^sub>\<rightarrow> to_nmorph h\<^sub>2\<^esub>\<^sub>E e = \<^bsub>y\<^esub>\<^sub>E e)\<close>
proof (intro conjI)