-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathOVA.thy
2303 lines (2052 loc) · 145 KB
/
OVA.thy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
section \<open> OVA.thy \<close>
theory OVA
imports Main Poset Grothendieck Semigroup Prealgebra
begin
type_synonym ('A, 'a) Valuation = "('A set \<times> 'a)"
(* OVA type (ordered valuation algebra) *)
record ('A, 'a) OVA =
prealgebra :: "('A, 'a) Prealgebra"
neutral :: "('A, unit, 'a) PrealgebraMap"
semigroup :: "(('A, 'a) Valuation) Semigroup"
abbreviation ob :: "('A, 'a) OVA \<Rightarrow> ('A Open, 'a Poset) Function" where
"ob V \<equiv> Prealgebra.ob (prealgebra V)"
abbreviation ar :: "('A, 'a) OVA \<Rightarrow> ('A Inclusion, ('a, 'a) PosetMap) Function" where
"ar V \<equiv> Prealgebra.ar (prealgebra V)"
abbreviation comb :: "('A, 'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" where
"comb V a b \<equiv> (Semigroup.mult (semigroup V)) \<star> (a, b)"
(*
abbreviation comb\_V :: "('A, 'a) Valuation \<Rightarrow> ('A, 'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" ("\_ \<otimes>\<langle>\_\<rangle> \_") where
"comb\_V a V b \<equiv> (Semigroup.mult (semigroup V)) \<star> (a, b)"
*)
abbreviation neut :: "('A, 'a) OVA \<Rightarrow> 'A set \<Rightarrow> ('A, 'a) Valuation" where
"neut V A \<equiv> (A, (Prealgebra.nat (neutral V) \<cdot> A) \<star> ())"
abbreviation poset :: "('A,'a) OVA \<Rightarrow> (('A, 'a) Valuation) Poset" where
"poset V \<equiv> Semigroup.poset (semigroup V)"
abbreviation le :: "('A,'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> bool" where
"le V a b \<equiv> Poset.le (poset V) a b"
abbreviation elems :: "('A,'a) OVA \<Rightarrow> ('A, 'a) Valuation set" where
"elems V \<equiv> el (poset V)"
abbreviation local_elems :: "('A,'a) OVA \<Rightarrow> 'A Open \<Rightarrow> ('A, 'a) Valuation set" where
"local_elems V A \<equiv> { (A, a) | a . a \<in> el (ob V \<cdot> A)}"
lemma local_elem_d : "a \<in> local_elems V A \<Longrightarrow> d a = A"
by auto
(*
abbreviation le\_V :: "('A, 'a) Valuation \<Rightarrow> ('A,'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> bool" ("\_ \<preceq>\<langle>\_\<rangle> \_") where
"le\_V a V b \<equiv> Poset.le (Semigroup.poset (semigroup V)) a b"
*)
definition "OVA_local_le_undefined_domain_mismatch _ _ \<equiv> undefined"
(* Note the parameter A is actually redundant *)
definition local_le :: "('A,'a) OVA \<Rightarrow> 'A Open \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> bool" where
"local_le V A a a' \<equiv>
if A = d a \<and> A = d a'
then Poset.le (ob V \<cdot> A) (e a) (e a')
else OVA_local_le_undefined_domain_mismatch a a'"
abbreviation space :: "('A,'a) OVA \<Rightarrow> 'A Space" where
"space V \<equiv> Prealgebra.space (prealgebra V)"
definition "OVA_res_undefined_bad_args _ _ \<equiv> undefined"
definition res :: "('A,'a) OVA \<Rightarrow> 'A Open \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" where
"res V B a \<equiv>
if a \<in> elems V \<and> B \<in> opens (space V) \<and> B \<subseteq> d a
then (B, ar V \<cdot> (make_inc B (d a)) \<star> (e a))
else OVA_res_undefined_bad_args B a"
definition "OVA_ext_undefined_bad_args _ _ \<equiv> undefined"
definition ext :: "('A,'a) OVA \<Rightarrow> 'A Open \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" where
"ext V A b \<equiv>
if b \<in> elems V \<and> A \<in> opens (space V) \<and> d b \<subseteq> A
then comb V (neut V A) b
else OVA_ext_undefined_bad_args A b"
definition valid :: "('A, 'a) OVA \<Rightarrow> bool" where
"valid V \<equiv>
let
welldefined = Prealgebra.valid (prealgebra V)
\<and> Semigroup.valid (semigroup V)
\<and> Prealgebra.valid_map (neutral V)
\<and> Prealgebra.cod (neutral V) = prealgebra V
\<and> Prealgebra.dom (neutral V) = Prealgebra.terminal (space V)
\<and> Semigroup.poset (semigroup V) = gc (prealgebra V);
domain_law = \<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow> d (comb V a b) = d a \<union> d b;
neutral_law_left = \<forall>A a. A \<in> opens (space V) \<longrightarrow> a \<in> elems V \<longrightarrow> comb V (neut V (d a)) a = a;
neutral_law_right = \<forall>A a. A \<in> opens (space V) \<and> a \<in> elems V \<longrightarrow> comb V a (neut V (d a)) = a;
comb_law_left = \<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow>
res V (d a) (comb V a b) = comb V a (res V (d a \<inter> d b) b);
comb_law_right = \<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow>
res V (d b) (comb V a b) = comb V (res V (d a \<inter> d b) a) b
in
welldefined \<and> domain_law \<and> neutral_law_left \<and> neutral_law_right \<and> comb_law_left \<and> comb_law_right"
abbreviation meet :: "('A,'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" where
"meet V a b \<equiv> Poset.meet (poset V) a b"
abbreviation join :: "('A,'a) OVA \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation \<Rightarrow> ('A, 'a) Valuation" where
"join V a b \<equiv> Poset.join (poset V) a b"
abbreviation inf :: "('A,'a) OVA \<Rightarrow> (('A, 'a) Valuation) set \<Rightarrow> ('A, 'a) Valuation" where
"inf V U \<equiv> Poset.inf (poset V) U"
abbreviation sup :: "('A,'a) OVA \<Rightarrow> (('A, 'a) Valuation) set \<Rightarrow> ('A, 'a) Valuation" where
"sup V U \<equiv> Poset.sup (poset V) U"
(* Properties *)
abbreviation is_complete :: "('A,'a) OVA \<Rightarrow> bool" where
"is_complete V \<equiv> Poset.is_complete (OVA.poset V)"
lemma cocomplete : "is_complete V = is_cocomplete (poset V)"
using complete_equiv_cocomplete by blast
definition is_commutative :: "('A, 'a) OVA \<Rightarrow> bool" where
"is_commutative V \<equiv> \<forall> a b . a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow> comb V a b = comb V b a"
definition is_strongly_neutral :: "('A, 'a) OVA \<Rightarrow> bool" where
"is_strongly_neutral V \<equiv> \<forall> A B . A \<in> opens (space V) \<longrightarrow> B \<in> opens (space V) \<longrightarrow> B \<subseteq> A \<longrightarrow> ext V A (neut V B) = neut V A"
(* Validity *)
lemma validI [intro] :
fixes V :: "('A,'a) OVA"
assumes welldefined : "Prealgebra.valid (prealgebra V)
\<and> Semigroup.valid (semigroup V)
\<and> Prealgebra.valid_map (neutral V)
\<and> Prealgebra.cod (neutral V) = prealgebra V
\<and> Prealgebra.dom (neutral V) = Prealgebra.terminal (space V)
\<and> Semigroup.poset (semigroup V) = gc (prealgebra V)"
assumes domain_law : "\<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow> d (comb V a b) = d a \<union> d b"
assumes neutral_law_left : "\<forall>A a. A \<in> opens (space V) \<longrightarrow> a \<in> elems V \<longrightarrow> comb V (neut V (d a)) a = a"
assumes neutral_law_right: "\<forall>A a. A \<in> opens (space V) \<and> a \<in> elems V \<longrightarrow> comb V a (neut V (d a)) = a"
assumes comb_law_left : "\<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow>
res V (d a) (comb V a b) = comb V a (res V (d a \<inter> d b) b)"
assumes comb_law_right : "\<forall> a b. a \<in> elems V \<longrightarrow> b \<in> elems V \<longrightarrow>
res V (d b) (comb V a b) = comb V (res V (d a \<inter> d b) a) b"
shows "valid V"
unfolding valid_def
apply (simp_all add: Let_def)
apply safe
apply (simp add: welldefined)
using welldefined apply blast
using welldefined apply blast
using welldefined apply blast
using welldefined apply blast
using welldefined apply auto[1]
using welldefined apply auto[1]
apply (simp add: domain_law)
apply (simp add: domain_law)
apply (simp add: domain_law)
using neutral_law_left apply auto[1]
using neutral_law_right apply force
using comb_law_left apply auto[1]
using comb_law_right by auto
lemma valid_welldefined :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Prealgebra.valid (prealgebra V)
\<and> Semigroup.valid (semigroup V)
\<and> Prealgebra.valid_map (neutral V)
\<and> Prealgebra.cod (neutral V) = prealgebra V
\<and> Prealgebra.dom (neutral V) = Prealgebra.terminal (space V)
\<and> Semigroup.poset (semigroup V) = gc (prealgebra V)"
unfolding valid_def
using OVA.valid_def assms by auto
lemma valid_prealgebra :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Prealgebra.valid (prealgebra V)"
by (simp add: OVA.valid_welldefined assms)
lemma valid_semigroup :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Semigroup.valid (semigroup V)"
using OVA.valid_welldefined assms by blast
lemma valid_neutral :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Prealgebra.valid_map (neutral V)"
by (simp add: OVA.valid_welldefined assms)
lemma valid_codomain :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Prealgebra.cod (neutral V) = prealgebra V"
using OVA.valid_welldefined assms by blast
lemma valid_domain :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Prealgebra.dom (neutral V) = Prealgebra.terminal (space V)"
using OVA.valid_welldefined assms by blast
lemma valid_gc_poset :
fixes V :: "('A,'a) OVA"
assumes V_valid : "valid V"
shows "Semigroup.poset (semigroup V) = gc (prealgebra V)"
using OVA.valid_welldefined assms by blast
lemma valid_le :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
and a_le_b : "le V a b"
shows "d b \<subseteq> d a \<and> local_le V (d b) (res V (d b) a) b"
proof
show "d b \<subseteq> d a" using assms
by (metis d_antitone valid_gc_poset valid_prealgebra)
next
define "i" where "i = make_inc (d b) (d a)"
define "pr_B" where "pr_B = ar V \<cdot> i"
define "ea_B" where "ea_B = pr_B \<star> (e a)"
define "FA" where "FA = ob V \<cdot> d a"
define "FB" where "FB = ob V \<cdot> d b"
have "e a \<in> el FA"
by (metis FA_def V_valid a_el gc_elem_local valid_gc_poset valid_prealgebra)
moreover have B_le_A: "d b \<subseteq> d a"
by (metis OVA.valid_welldefined V_valid a_el a_le_b b_el d_antitone)
moreover have "i \<in> inclusions (space V)" using B_le_A V_valid
by (metis (no_types, lifting) CollectI Inclusion.select_convs(1) Inclusion.select_convs(2) a_el b_el i_def inclusions_def local_dom valid_gc_poset valid_prealgebra)
moreover have psh_valid : "Prealgebra.valid (prealgebra V)"
by (simp add: V_valid valid_prealgebra)
moreover have "Poset.valid_map pr_B"
using calculation(3) pr_B_def psh_valid valid_ar by blast
moreover have "Poset.dom pr_B = FA \<and> Poset.cod pr_B = FB"
using FA_def FB_def calculation(3) i_def pr_B_def psh_valid by auto
moreover have "ea_B \<in> el FB"
by (metis Poset.fun_app2 calculation(1) calculation(5) calculation(6) ea_B_def)
moreover have "e b \<in> el FB"
by (metis FB_def V_valid b_el gc_elem_local psh_valid valid_gc_poset)
moreover have "Poset.le (poset V) a b"
using a_le_b by blast
moreover have "Poset.le FB ea_B (e b)"
using psh_valid a_el b_el a_le_b FB_def ea_B_def pr_B_def
i_def V_valid valid_gc_poset valid_gc_le_unwrap [where ?Aa=a and ?Bb=b and ?F="prealgebra V"]
by force
moreover have "d b = d (res V (d b) a) \<and> d b = d b"
by (metis B_le_A Inclusion.select_convs(1) a_el calculation(3) fstI i_def res_def valid_inc_dom)
ultimately show "local_le V (d b) (res V (d b) a) b"
by (smt (verit) FB_def Inclusion.simps(1) a_el ea_B_def i_def le_eq_local_le local_elem_gc local_le_def local_le_eq_le pr_B_def prod.collapse res_def valid_inc_dom)
qed
lemma valid_domain_law : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> d (comb V a b) = d a \<union> d b"
unfolding valid_def
by meson
lemma valid_neutral_law_left : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> comb V (neut V (d a)) a = a"
unfolding valid_def
by (metis local_dom)
lemma valid_neutral_law_right : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> comb V a (neut V (d a)) = a"
unfolding valid_def
by (metis local_dom)
lemma valid_comb_law_left : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow>
res V (d a) (comb V a b) = comb V a (res V (d a \<inter> d b) b)"
unfolding valid_def
by meson
lemma valid_comb_law_right : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow>
res V (d b) (comb V a b) = comb V (res V (d a \<inter> d b) a) b"
unfolding valid_def
by meson
lemma valid_comb_associative : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> c \<in> elems V \<Longrightarrow>
comb V (comb V a b) c = comb V a (comb V b c)"
unfolding valid_def
by (meson valid_associative)
lemma valid_comb_monotone : "valid V \<Longrightarrow> a1 \<in> elems V \<Longrightarrow> a2 \<in> elems V \<Longrightarrow> b1 \<in> elems V \<Longrightarrow> b2 \<in> elems V
\<Longrightarrow> le V a1 a2 \<Longrightarrow> le V b1 b2
\<Longrightarrow> le V (comb V a1 b1) (comb V a2 b2)"
by (smt (verit) valid_monotone valid_semigroup)
(* Don't mark this as [intro] *)
lemma leI : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> d b \<subseteq> d a
\<Longrightarrow> Poset.le (ob V \<cdot> d b) ((ar V \<cdot> (make_inc (d b) (d a))) \<star> e a) (e b) \<Longrightarrow> le V a b"
using valid_gc_poset [where ?V=V] gc_leI [where ?a=a and ?b=b and ?F="prealgebra V"]
by simp
lemma leD [dest] : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> le V a b
\<Longrightarrow> d b \<subseteq> d a \<and> Poset.le (ob V \<cdot> d b) ((ar V \<cdot> (make_inc (d b) (d a))) \<star> e a) (e b)"
using valid_prealgebra [where ?V=V] valid_le [where ?V=V]
by (smt (verit, del_insts) fst_conv local_dom local_le_def res_def snd_conv valid_gc_poset)
lemma le_eq : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> le V a b
= (d b \<subseteq> d a \<and> Poset.le (ob V \<cdot> d b) ((ar V \<cdot> (make_inc (d b) (d a))) \<star> e a) (e b))"
using gc_le_eq [where ?F="prealgebra V" and ?a=a and ?b=b] valid_gc_poset [where ?V=V]
by force
lemma le_rel : "le_rel (gc (prealgebra V)) = { ((A, a), (B, b)) .
A \<in> opens (space V) \<and> B \<in> opens (space V)
\<and> a \<in> el (ob V \<cdot> A) \<and> b \<in> el (ob V \<cdot> B)
\<and> B \<subseteq> A \<and> Poset.le (ob V \<cdot> B) (ar V \<cdot> (make_inc B A) \<star> a) b }"
using gc_le_rel [where ?F="prealgebra V"] valid_gc_poset [where ?V=V]
by force
lemma elem_is_raw_elem : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> e a \<in> el (ob V \<cdot> d a)"
by (metis OVA.valid_welldefined gc_elem_local)
lemma raw_elem_is_elem : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> el ((ob V) \<cdot> A)
\<Longrightarrow> (A, a) \<in> elems V"
by (metis local_elem_gc valid_gc_poset valid_prealgebra)
lemma elem_is_local_elem : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> a \<in> local_elems V (d a)"
by (metis (mono_tags, lifting) CollectI elem_is_raw_elem prod.collapse)
lemma local_elem_is_elem : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> local_elems V A \<Longrightarrow> a \<in> elems V"
using local_elem_gc valid_gc_poset valid_prealgebra by fastforce
lemma raw_elem_is_local_elem : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> el (ob V \<cdot> A) \<Longrightarrow> (A, a) \<in> local_elems V A"
by blast
lemma local_elem_is_raw_elem : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> local_elems V A \<Longrightarrow> e a \<in> el (ob V \<cdot> A) "
by auto
lemma d_elem_is_open : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> d a \<in> opens (space V)"
by (metis local_dom valid_gc_poset valid_prealgebra)
lemma d_neut [simp] : "A \<in> opens (space V) \<Longrightarrow> d (neut V A) = A"
by simp
lemma d_comb [simp] : "valid V \<Longrightarrow> a \<in> elems V \<Longrightarrow> b \<in> elems V \<Longrightarrow> d (comb V a b) = d a \<union> d b"
by (simp add: valid_domain_law)
lemma d_res [simp] : "a \<in> elems V \<Longrightarrow> B \<in> opens (space V) \<Longrightarrow> B \<subseteq> d a \<Longrightarrow> d (res V B a) = B"
by (simp add: res_def)
lemma comb_is_element :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
shows "comb V a b \<in> elems V"
by (metis (no_types, lifting) Poset.Poset.select_convs(1) Poset.fun_app2 Poset.product_def SigmaI V_valid a_el b_el comp_apply valid_semigroup valid_welldefined_dom valid_welldefined_map)
lemma res_elem :
fixes V :: "('A,'a) OVA" and B :: "'A Open" and a :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
assumes a_el : "a \<in> elems V"
and "B \<subseteq> d a" and "B \<in> opens (space V)"
defines "a_B \<equiv> res V B a"
shows "a_B \<in> elems V"
by (metis Prealgebra.restricted_element V_valid a_B_def a_el assms(3) assms(4) d_elem_is_open elem_is_raw_elem local_elem_gc res_def valid_gc_poset valid_prealgebra)
lemma neutral_is_element :
fixes V :: "('A,'a) OVA" and A :: "'A Open"
assumes V_valid : "valid V" and "A \<in> opens (space V)"
shows "neut V A \<in> elems V"
proof -
have "Function.valid_map (PrealgebraMap.nat (neutral V))" using valid_neutral [where ?V=V]
using V_valid valid_map_nat by blast
moreover have "Poset.valid_map (PrealgebraMap.nat (neutral V) \<cdot> A)" using valid_neutral [where ?V=V]
by (simp add: OVA.valid_welldefined Prealgebra.const_def V_valid assms(2) valid_map_nat_welldefined)
moreover have "Poset.cod (PrealgebraMap.nat (neutral V) \<cdot> A) = (ob V) \<cdot>
A" using Prealgebra.valid_map_def [where ?f="neutral V"]
by (metis (no_types, lifting) V_valid assms(2) valid_codomain valid_neutral)
moreover have "Prealgebra.dom (neutral V) = Prealgebra.terminal (space V)"
using OVA.valid_welldefined V_valid by blast
moreover have "(Prealgebra.ob ( Prealgebra.terminal (space V))) \<cdot> A = Poset.discrete"
using Prealgebra.valid_space V_valid assms(2) const_ob valid_prealgebra by blast
moreover have "Poset.dom (PrealgebraMap.nat (neutral V) \<cdot> A) = Poset.discrete"
using Prealgebra.valid_map_def [where ?f="neutral V"]
by (metis (no_types, lifting) OVA.valid_welldefined V_valid assms(2) calculation(5))
moreover have "(PrealgebraMap.nat (neutral V) \<cdot> A \<star> ()) \<in> el ((ob V)
\<cdot> A)"
by (metis Poset.fun_app2 UNIV_unit UNIV_witness V_valid assms(2) calculation(2) calculation(3) calculation(5) calculation(6) singletonD terminal_value valid_prealgebra valid_space)
ultimately show ?thesis
by (meson V_valid assms(2) raw_elem_is_elem)
qed
lemma neutral_local_element :
fixes V :: "('A,'a) OVA" and A :: "'A Open"
assumes V_valid : "valid V"
and domain : "A \<in> opens (space V)"
shows " e (neut V A) \<in> el (ob V \<cdot> A)"
using V_valid assms(2) elem_is_raw_elem neutral_is_element by fastforce
lemma d_ext [simp] : "valid V \<Longrightarrow> b \<in> elems V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> d b \<subseteq> A \<Longrightarrow> d (ext V A b) = A"
unfolding ext_def
by (smt (verit, best) d_neut neutral_is_element sup.orderE valid_domain_law)
lemma symmetric_ext:
fixes V :: "('A,'a) OVA" and A :: "'A Open" and b :: "('A,'a) Valuation"
assumes V_valid: "valid V"
and A_open : "A \<in> opens (space V)"
and b_el : "b \<in> elems V"
and B_le_A : "d b \<subseteq> A"
shows "ext V A b = comb V b (neut V A)"
by (smt (verit, ccfv_SIG) A_open B_le_A V_valid b_el comb_is_element d_ext fst_conv ext_def d_elem_is_open neutral_is_element subset_Un_eq valid_comb_associative valid_domain_law valid_neutral_law_left valid_neutral_law_right)
lemma le_eq_local_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> elems V
\<Longrightarrow> a' \<in> elems V \<Longrightarrow> d a = A \<Longrightarrow> d a'= A \<Longrightarrow> le V a a' = local_le V A a a'"
by (metis OVA.valid_welldefined le_eq_local_le local_le_def)
lemma le_eq_raw_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> elems V
\<Longrightarrow> a' \<in> elems V \<Longrightarrow> d a = A \<Longrightarrow> d a' = A \<Longrightarrow> le V a a' = Poset.le (ob V \<cdot> A) (e a) (e a')"
by (metis Grothendieck.le_eq_local_le valid_gc_poset valid_prealgebra)
lemma local_le_eq_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> local_elems V A
\<Longrightarrow> a' \<in> local_elems V A \<Longrightarrow> local_le V A a a' = le V a a'"
using Grothendieck.le_eq_local_le fst_conv local_elem_gc mem_Collect_eq valid_gc_poset valid_prealgebra
by (smt (verit) OVA.le_eq_local_le)
lemma local_le_eq_raw_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> local_elems V A
\<Longrightarrow> a' \<in> local_elems V A \<Longrightarrow> local_le V A a a' = Poset.le (ob V \<cdot> A) (e a) (e a')"
by (simp add: local_elem_d local_le_def)
lemma raw_le_eq_local_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> el (ob V \<cdot> A)
\<Longrightarrow> a' \<in> el (ob V \<cdot> A) \<Longrightarrow> Poset.le (ob V \<cdot> A) a a' = local_le V A (A, a) (A, a')"
by (simp add: local_le_def)
lemma raw_le_eq_le : "valid V \<Longrightarrow> A \<in> opens (space V) \<Longrightarrow> a \<in> el (ob V \<cdot> A)
\<Longrightarrow> a' \<in> el (ob V \<cdot> A) \<Longrightarrow> Poset.le (ob V \<cdot> A) a a' = le V (A, a) (A, a')"
by (metis Grothendieck.local_le_eq_le valid_gc_poset valid_prealgebra)
lemma res_monotone :
fixes V :: "('A,'a) OVA" and a a' :: "('A, 'a) Valuation" and B :: "'A Open"
assumes V_valid: "valid V"
and "B \<in> opens (space V)"
and "B \<subseteq> d a"
and "d a = d a'"
and "a \<in> elems V" and "a' \<in> elems V" and "le V a a'"
shows "le V (res V B a) (res V B a')"
proof -
define "A" where "A = d a"
define "i" where "i = make_inc B A"
define "Fi" where "Fi = (ar V) \<cdot> i"
define "FA" where "FA = (ob V) \<cdot> A"
define "FB" where "FB = (ob V) \<cdot> B"
moreover have "le V a a' \<longrightarrow> Poset.le FA (e a) (e a')"
by (metis A_def FA_def Grothendieck.le_eq_local_le V_valid assms(4) assms(5) assms(6) valid_gc_poset valid_prealgebra)
moreover have "local_le V A a a'" using assms
using A_def FA_def calculation(2)
by (meson local_le_def)
moreover have "i \<in> inclusions (space V) \<and> Space.dom i = B \<and> Space.cod i = A"
by (metis (no_types, lifting) inclusions_def A_def CollectI Inclusion.select_convs(1) Inclusion.select_convs(2) V_valid assms(2) assms(3) assms(5) d_elem_is_open i_def)
moreover have "d (res V B a) = B"
using V_valid assms(2) assms(3) assms(5) by auto
moreover have "d (res V B a') = B"
using V_valid assms(2) assms(3) assms(4) assms(6) by auto
ultimately show ?thesis
using le_eq_local_le [where ?V=V and ?A=B and ?a="res V B a" and ?a'="res V B a'"] assms
by (metis (no_types, lifting) A_def FA_def Prealgebra.image elem_is_raw_elem i_def raw_le_eq_local_le res_def res_elem res_monotone valid_prealgebra)
qed
lemma res_monotone_local :
fixes V :: "('A,'a) OVA" and A B :: "'A Open" and a a' :: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and "A \<in> opens (space V)" and "B \<in> opens (space V)"
and "B \<subseteq> A"
and "a \<in> local_elems V A" and "a' \<in> local_elems V A" and "local_le V A a a'"
shows "local_le V B (res V B a) (res V B a')"
by (smt (verit) OVA.le_eq_local_le OVA.res_monotone V_valid assms(2) assms(3) assms(4) assms(5) assms(6) assms(7) d_res fst_conv local_elem_gc mem_Collect_eq res_elem valid_gc_poset valid_prealgebra)
lemma e_res :
fixes V :: "('A,'a) OVA" and A B :: "'A Open" and a :: "('A, 'a) Valuation"
defines "pr \<equiv> res V"
and "FB \<equiv> ob V \<cdot> B"
and "a_B \<equiv> res V B a"
assumes V_valid : "valid V"
and "B \<subseteq> A" and "B \<in> opens (space V)" and "A \<in> opens (space V)"
and "d a = A"
and "a \<in> elems V"
shows "e (a_B) \<in> el FB"
by (metis FB_def a_B_def assms(4) assms(5) assms(6)assms(8) assms(9) d_res gc_elem_local res_elem valid_gc_poset valid_prealgebra)
lemma ext_elem :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and "b \<in> elems V" and "A \<in> opens (space V)"
and "d b \<subseteq> A"
shows "ext V A b \<in> elems V"
proof -
have "d b \<subseteq> A \<and> d b \<in> opens (space V) \<and> A \<in> opens (space V)"
using V_valid assms(2) assms(3) assms(4) d_elem_is_open by blast
moreover have "ext V A b = comb V (neut V A) b" using assms calculation ext_def [where ?b=b and
?V=V and ?A=A]
by presburger
ultimately show ?thesis
by (metis V_valid assms(2) comb_is_element neutral_is_element)
qed
lemma e_ext :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and b :: "('A, 'a) Valuation"
defines "FA \<equiv> ob V \<cdot> A"
assumes V_valid : "valid V"
and "d b \<subseteq> A" and "A \<in> opens (space V)"
and "b \<in> elems V"
shows " e (ext V A b) \<in> el FA"
by (metis FA_def V_valid assms(3) assms(4) assms(5) d_ext ext_elem elem_is_raw_elem)
lemma ext_monotone :
fixes V :: "('A,'a) OVA" and b b' :: "('A, 'a) Valuation" and A :: "'A Open"
assumes V_valid: "valid V"
and "A \<in> opens (space V)"
and "d b \<subseteq> A"
and "d b = d b'"
and "b \<in> elems V" and "b' \<in> elems V" and "le V b b'"
shows "le V (ext V A b) (ext V A b')"
unfolding ext_def
using valid_comb_monotone [where ?V=V]
by (smt (verit) OVA.valid_welldefined Poset.valid_def V_valid assms(2) assms(3) assms(4) assms(5) assms(6) assms(7) neutral_is_element valid_poset)
lemma ext_monotone_local :
fixes V :: "('A,'a) OVA" and A B :: "'A Open" and a a' :: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and "A \<in> opens (space V)" and "B \<in> opens (space V)"
and "B \<subseteq> A"
and "b \<in> local_elems V B" and "b' \<in> local_elems V B" and "local_le V B b b'"
shows "local_le V A (ext V A b) (ext V A b')" using ext_monotone [where ?V=V] local_elem_is_elem
[where ?V=V] local_le_def
elem_is_local_elem [where ?V=V]
by (smt (verit) Grothendieck.le_eq_local_le V_valid assms(2) assms(3) assms(4) assms(5) assms(6) assms(7) d_ext e_ext fst_conv mem_Collect_eq prod.collapse raw_elem_is_elem valid_gc_poset valid_prealgebra)
lemma local_le_refl :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and a :: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and A_open : "A \<in> opens (space V)"
and a_el : "a \<in> local_elems V A"
shows "local_le V A a a"
using A_open V_valid a_el valid_ob valid_prealgebra valid_reflexivity local_le_def by fastforce
lemma local_le_trans :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and a a' a'':: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and A_open : "A \<in> opens (space V)"
and a_el : "a \<in> local_elems V A" and a'_el : "a' \<in> local_elems V A" and a''_el : "a'' \<in> local_elems V A"
and a_le_a' : "local_le V A a a'" and a'_le_a'' : "local_le V A a' a''"
shows "local_le V A a a''" using local_le_def
by (smt (verit, del_insts) A_open V_valid a''_el a'_el a'_le_a'' a_el a_le_a' mem_Collect_eq prod.exhaust_sel prod.inject valid_ob valid_prealgebra valid_transitivity)
lemma local_le_antisym :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and a a':: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and A_open : "A \<in> opens (space V)"
and a_el : "a \<in> local_elems V A" and a'_el : "a' \<in> local_elems V A" and a''_el : "a'' \<in> local_elems V A"
and a_le_a' : "local_le V A a a'" and a'_le_a : "local_le V A a' a"
shows "a = a'" using local_le_def
by (smt (verit, best) A_open Poset.valid_def V_valid a'_el a_el a_le_a' assms(7) fst_eqD mem_Collect_eq snd_eqD valid_ob valid_prealgebra)
lemma ext_comm :
fixes V :: "('A, 'a) OVA" and A :: "'A Open" and b b' :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and A_open : "A \<in> opens (space V)"
and b_el : "b \<in> elems V" and b'_el : "b' \<in> elems V"
and db_eq_db' : "d b = d b'"
and B_le_A : "d b \<subseteq> A"
shows "ext V A (comb V b b') = comb V (ext V A b) (ext V A b')"
unfolding ext_def
by (smt (verit) A_open B_le_A V_valid b'_el b_el comb_is_element comp_eq_dest_lhs db_eq_db' fst_eqD neutral_is_element sup.absorb_iff1 valid_comb_associative valid_domain_law valid_neutral_law_right)
lemma ext_comm_local :
fixes V :: "('A, 'a) OVA" and A B :: "'A Open" and b b' :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and A_open : "A \<in> opens (space V)" and B_open : "B \<in> opens (space V)"
and b_el : "b \<in> local_elems V B" and b'_el : "b' \<in> local_elems V B"
and B_le_A : "B \<subseteq> A"
shows "ext V A (comb V b b') = comb V (ext V A b) (ext V A b')"
using A_open B_le_A V_valid assms(3) assms(4) b'_el ext_comm local_elem_is_elem by fastforce
(* Paper results *)
(* [Remark 2 (1/3), TMCVA] *)
lemma res_functorial_id :
fixes V :: "('A,'a) OVA" and a :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and "a \<in> elems V"
shows "res V (d a) a = a"
unfolding res_def
by (metis (no_types, lifting) Poset.ident_app Prealgebra.valid_identity Space.ident_def V_valid assms(2) d_elem_is_open elem_is_raw_elem fst_conv prod.expand snd_conv subset_eq valid_ob valid_prealgebra)
(* [Remark 2 (2/3), TMCVA] *)
lemma res_functorial_trans :
fixes V :: "('A,'a) OVA" and B C :: "'A Open" and a :: "('A, 'a) Valuation"
defines "A \<equiv> d a"
assumes V_valid : "valid V"
and B_open : "B \<in> opens (space V)" and C_open : "C \<in> opens (space V)"
and C_le_B : "C \<subseteq> B" and B_le_A : "B \<subseteq> A"
and a_el : "a \<in> elems V"
shows "res V C a = (res V C (res V B a))"
proof -
define "F1" where "F1 = ar V"
define "i_BA" where "i_BA = make_inc B A"
define "i_CB" where "i_CB = make_inc C B"
define "i_CA" where "i_CA = make_inc C A"
define "f" where "f = F1 \<cdot> i_BA"
define "g" where "g = F1 \<cdot> i_CB"
define "h" where "h = F1 \<cdot> i_CA"
have "res V C a = (C, (F1 \<cdot> i_CA) \<star> (e a))"
by (smt (verit, ccfv_SIG) A_def B_le_A C_le_B C_open F1_def assms(7) dual_order.trans i_CA_def res_def)
moreover have "res V B a = (B, f \<star> (e a))"
by (metis A_def B_le_A B_open F1_def a_el f_def i_BA_def res_def)
moreover have "res V C (res V B a) = (C, g \<star> (f \<star> (e a)))"
by (metis (no_types, lifting) A_def B_le_A B_open C_le_B C_open F1_def V_valid a_el calculation(2) fst_conv g_def i_CB_def res_def res_elem snd_eqD)
moreover have "Prealgebra.valid (prealgebra V)"
by (meson OVA.valid_welldefined V_valid)
moreover have "valid_inc i_CB"
by (simp add: C_le_B i_CB_def)
moreover have "i_CB \<in> inclusions (space V)"
by (simp add: B_open C_le_B C_open i_CB_def inclusions_def)
moreover have "valid_inc i_BA"
by (simp add: B_le_A i_BA_def)
moreover have "i_BA \<in> inclusions (space V)"
by (metis (no_types, lifting) A_def B_le_A B_open Inclusion.select_convs(1) Inclusion.select_convs(2) V_valid a_el d_elem_is_open i_BA_def inclusions_def mem_Collect_eq)
moreover have "valid_inc i_CA"
using assms(5) assms(6) i_CA_def by auto
moreover have "i_CA = i_BA \<propto> i_CB" using Space.compose_inc_def
by (simp add: i_BA_def i_CA_def i_CB_def)
moreover have "Poset.valid_map f \<and> Poset.valid_map g \<and> Poset.valid_map h"
by (metis F1_def Inclusion.select_convs(1) Inclusion.select_convs(2) Poset.compose_valid Prealgebra.valid_composition Prealgebra.valid_welldefined calculation(10) calculation(4) calculation(6) calculation(8) f_def g_def h_def i_BA_def i_CB_def)
moreover have "Space.cod i_BA = A \<and> Space.dom i_BA = B "
by (simp add: i_BA_def)
moreover have "Space.cod i_CB = B \<and> Space.dom i_CB = C "
by (simp add: i_CB_def)
moreover have "Space.cod i_CA = A \<and> Space.dom i_CA = C "
by (simp add: i_CA_def)
moreover have "Poset.dom f = ob V \<cdot> A"
by (simp add: F1_def calculation(12) calculation(4) calculation(8) f_def)
moreover have "Poset.cod f = ob V \<cdot> B \<and> Poset.dom g = Prealgebra.ob
(prealgebra V) \<cdot> B"
by (simp add: F1_def calculation(12) calculation(13) calculation(4) calculation(6) calculation(8) f_def g_def)
moreover have " (F1 \<cdot> i_CB) \<star> ((F1 \<cdot> i_BA) \<star> (e a)) = (F1 \<cdot> i_CA) \<star> (e a)" using Poset.compose_app_assoc
by (metis A_def F1_def Prealgebra.valid_composition V_valid a_el calculation(10) calculation(11) calculation(12) calculation(13) calculation(15) calculation(16) calculation(4) calculation(6) calculation(8) f_def g_def elem_is_raw_elem)
ultimately show ?thesis
by (metis f_def g_def)
qed
lemma res_comm :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
shows "res V (d a \<inter> d b) (comb V a b) = comb V (res V (d a \<inter> d b) a) (res V (d a \<inter> d b) b)"
proof -
have "res V (d a \<inter> d b) (comb V a b) = res V (d a \<inter> d b) (res V (d a) (comb V a b))"
by (metis (no_types, opaque_lifting) Prealgebra.valid_space V_valid a_el b_el comb_is_element d_elem_is_open inf_le1 res_functorial_trans sup_ge1 valid_domain_law valid_inter valid_prealgebra)
moreover have "... = res V (d a \<inter> d b) (comb V a (res V (d a \<inter> d b) b))"
by (metis V_valid a_el b_el valid_comb_law_left)
moreover have "... = comb V (res V (d a \<inter> d b) a) (res V (d a \<inter> d b) b)"
by (smt (verit, best) Int_commute Int_lower2 Prealgebra.valid_space V_valid a_el b_el d_elem_is_open d_res inf.idem inf_left_commute res_elem valid_comb_law_right valid_inter valid_prealgebra)
ultimately show ?thesis
by presburger
qed
(* [Remark 2 (3/3), TMCVA] *)
lemma stability:
fixes V :: "('A,'a) OVA" and A B :: "'A Open"
assumes V_valid: "valid V"
and B_le_A : "B \<subseteq> A" and B_open : "B \<in> opens (space V)" and A_open : "A \<in> opens (space V)"
defines \<epsilon>A_def: "\<epsilon>A \<equiv> neut V A"
defines \<epsilon>B_def: "\<epsilon>B \<equiv> neut V B"
defines \<epsilon>A_B_def: "\<epsilon>A_B \<equiv> res V B \<epsilon>A"
shows "\<epsilon>A_B = \<epsilon>B"
proof -
define i where "i \<equiv> make_inc B A"
define "f" where "f = nat (neutral V)"
define "one" where "one \<equiv> Prealgebra.dom (neutral V)"
moreover have "\<epsilon>A_B = res V B \<epsilon>A"
by (simp add: \<epsilon>A_B_def)
moreover have "Space.cod i = A \<and> Space.dom i = B"
by (simp add: i_def)
moreover have "i \<in> inclusions (space V)"
using A_open B_le_A B_open calculation(3) inclusions_def by force
moreover have "Prealgebra.valid_map (neutral V)"
using V_valid valid_neutral by blast
moreover have "Prealgebra.valid one"
by (simp add: Prealgebra.valid_map_dom calculation(5) one_def)
moreover have v1: "Poset.valid_map (Prealgebra.ar one \<cdot> i)" using calculation assms Prealgebra.valid_ar
[where ?F="prealgebra V" and ?i=i]
apply clarsimp
by (metis OVA.valid_welldefined Prealgebra.Prealgebra.select_convs(1) Prealgebra.const_def Prealgebra.valid_ar)
moreover have v2: "Poset.valid_map (f \<cdot> B)"
by (smt (verit, best) B_open OVA.valid_welldefined Prealgebra.Prealgebra.select_convs(1) Prealgebra.const_def Prealgebra.valid_map_welldefined V_valid f_def)
moreover have "Prealgebra.valid one"
by (metis OVA.valid_welldefined Prealgebra.valid_map_welldefined one_def V_valid)
moreover have "(Prealgebra.ar one \<cdot> i ) \<star> () = ()"
by simp
moreover have "() \<in> el (Poset.dom (Prealgebra.ar one \<cdot> i))" using Prealgebra.terminal_value
using A_open B_le_A B_open V_valid calculation(3) one_def valid_domain valid_prealgebra valid_space inclusions_def calculation(4) by fastforce
moreover have "(f \<cdot> B \<diamondop> (Prealgebra.ar one \<cdot> i)) \<star> () = f \<cdot> B \<star> ((Prealgebra.ar one \<cdot> i)) \<star> ()"
using OVA.valid_welldefined Prealgebra.Prealgebra.select_convs(1) Prealgebra.valid_map_welldefined
assms calculation res_cod compose_app_assoc f_def inclusions_def
by (metis (no_types, lifting) Prealgebra.const_def)
moreover have "((ar V \<cdot> i) \<diamondop> f \<cdot> A) \<star> ()= e \<epsilon>B"
using assms calculation f_def one_def snd_conv valid_map_naturality
by (metis Prealgebra.Prealgebra.select_convs(1) Prealgebra.const_def valid_codomain valid_domain)
moreover have "e \<epsilon>A= f \<cdot> A \<star> ()"
by (simp add: \<epsilon>A_def f_def)
ultimately show ?thesis
using Prealgebra.valid_map_welldefined Prealgebra.valid_welldefined
assms compose_app_assoc eq_fst_iff f_def res_def i_def neutral_is_element sndI valid_codomain valid_domain
by (metis (no_types, opaque_lifting) Prealgebra.Prealgebra.select_convs(1) Prealgebra.const_def)
qed
(* [Remark 3, TMCVA] *)
lemma local_mono_eq_global :
fixes V :: "('A,'a) OVA" and A B :: "'A Open" and a1 a1' a2 a2' :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and A_open : "A \<in> opens (space V)"
and a1_el : "a1 \<in> elems V" and a1_d : "d a1 = A"
and a1'_el : "a1' \<in> elems V" and a1'_d : "d a1' = A"
and a2_el : "a2 \<in> elems V" and a2_d : "d a2 = A"
and a2'_el : "a2' \<in> elems V" and a2'_d : "d a2' = A"
shows "le V (comb V a1 a1') (comb V a2 a2') = local_le V A (comb V a1 a1') (comb V a2 a2')"
by (metis A_open OVA.le_eq_local_le V_valid a1'_d a1'_el a1_d a1_el a2'_d a2'_el a2_d a2_el comb_is_element fst_conv neutral_is_element valid_domain_law valid_neutral_law_right)
lemma id_le_res :
fixes V :: "('A,'a) OVA" and B :: "'A Open" and a :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and B_open : "B \<in> opens (space V)" and B_le_A : "B \<subseteq> d a"
and a_el : "a \<in> elems V"
shows "le V a (res V B a)"
proof -
define "A" where "A = d a"
define "i" where "i = make_inc B (d a)"
define "Fi" where "Fi = ar V \<cdot> i"
define "FA" where "FA = ob V \<cdot> A"
define "FB" where "FB = ob V \<cdot> B"
define "a_B" where "a_B = Fi \<star> (e a)"
have "i \<in> inclusions (space V)"
using B_le_A B_open V_valid a_el d_elem_is_open i_def inclusions_def
by (metis (no_types, lifting) CollectI Inclusion.select_convs(1) Inclusion.select_convs(2))
moreover have "res V B a = (B, a_B)"
by (metis B_le_A B_open Fi_def a_B_def a_el res_def i_def)
moreover have "Prealgebra.valid (prealgebra V)"
by (simp add: V_valid valid_prealgebra)
moreover have "Poset.valid FB"
using B_open FB_def calculation(3) valid_ob by blast
moreover have "Poset.valid_map Fi"
using Fi_def calculation(1) calculation(3) valid_ar by blast
moreover have "e a \<in> el FA"
using A_def FA_def V_valid a_el elem_is_raw_elem by blast
moreover have "Space.cod i = A \<and> Space.dom i = B \<and> i \<in> inclusions (space V)"
using A_def calculation(1) i_def by auto
moreover have "a_B \<in> el FB"
by (metis B_le_A B_open FB_def V_valid a_el calculation(2) d_elem_is_open e_res snd_eqD)
moreover have "Poset.le FB a_B a_B"
by (simp add: calculation(4) calculation(8) valid_reflexivity)
moreover have "valid V" by fact
ultimately show ?thesis using assms
apply clarsimp
apply (frule valid_welldefined)
apply (simp_all add: Let_def gc_def)
apply safe
apply (metis fst_conv subsetD)
apply (metis (no_types, lifting) FB_def Fi_def a_B_def fst_conv i_def snd_conv)
apply auto[1]
using Fi_def a_B_def i_def apply fastforce
using FB_def by force
qed
lemma elem_le_wrap :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
and B_le_A : "d b \<subseteq> d a" and a_B_le_b : "local_le V (d b) (res V (d b) a) b"
shows "le V a b"
by (smt (verit, best) B_le_A OVA.le_eq_local_le Poset.valid_def V_valid a_B_le_b a_el b_el d_elem_is_open d_res id_le_res res_elem valid_poset valid_semigroup)
lemma neut_le_neut :
fixes V :: "('A,'a) OVA" and A B :: "'A Open"
assumes V_valid : "valid V"
and B_open :"B \<in> opens (space V)" and A_open :"A \<in> opens (space V)" and B_le_A : "B \<subseteq> A"
shows "le V (neut V A) (neut V B)"
by (metis (no_types, lifting) A_open B_le_A B_open V_valid elem_le_wrap fst_conv neutral_is_element stability valid_le valid_poset valid_reflexivity valid_semigroup)
(* [Theorem 1 (1/3), TMCVA] *)
theorem res_ext_adjunction :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V" and B_le_A : "d b \<subseteq> d a"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
shows "local_le V (d b) (res V (d b) a) b = local_le V (d a) a (ext V (d a) b)" (is "?L \<longleftrightarrow> ?R")
proof (rule iffI)
assume "?L"
let ?ea = "neut V (d a)"
let ?a_B = "res V (d b) a"
have "local_le V (d a) (comb V ?ea a) (comb V ?ea ?a_B)"
by (smt (verit) B_le_A OVA.le_eq_local_le V_valid a_el b_el comb_is_element d_elem_is_open d_res fst_conv id_le_res neutral_is_element res_elem res_functorial_id sup.absorb_iff1 valid_domain_law valid_monotone valid_neutral_law_left valid_semigroup)
moreover have "local_le V (d a) (comb V ?ea ?a_B) (comb V ?ea b)"
by (smt (verit) B_le_A OVA.le_eq_local_le OVA.valid_welldefined V_valid \<open>local_le V (d b) (res V (d b) a) b\<close> a_el b_el comb_is_element d_elem_is_open d_res fst_eqD neutral_is_element res_elem sup.order_iff valid_comb_monotone valid_domain_law valid_poset valid_reflexivity)
moreover have "comb V ?ea b = ext V (d a) b" using ext_def [where ?V=V and ?A="d a" and ?b=b]
by (metis B_le_A V_valid a_el b_el d_elem_is_open)
ultimately show "?R"
by (smt (verit) B_le_A OVA.le_eq_local_le Poset.valid_def V_valid a_el b_el comb_is_element d_elem_is_open d_ext d_res neutral_is_element res_elem valid_domain_law valid_neutral_law_left valid_poset valid_semigroup)
next
assume "?R"
let ?ea = "neut V (d a)"
let ?a_B = "res V (d b) a"
have "local_le V (d b) ?a_B (res V (d b) (ext V (d a) b))"
by (metis (no_types, lifting) B_le_A OVA.le_eq_local_le OVA.res_monotone V_valid \<open>local_le V (d a) a (ext V (d a) b)\<close> a_el b_el d_elem_is_open d_ext d_res ext_elem res_elem)
moreover have "ext V (d a) b = comb V ?ea b" using ext_def [where ?V=V and ?A="d a" and ?b=b]
by (meson B_le_A V_valid a_el b_el d_elem_is_open)
moreover have "(res V (d b) (ext V (d a) b)) = comb V (res V (d a \<inter> d b) ?ea) b"
by (metis V_valid a_el b_el calculation(2) d_elem_is_open fst_conv neutral_is_element valid_comb_law_right)
moreover have "comb V (res V (d a \<inter> d b) ?ea) b = comb V (neut V (d b)) b"
by (metis B_le_A V_valid a_el b_el d_elem_is_open inf_absorb2 stability)
ultimately show "?L"
by (metis V_valid b_el valid_neutral_law_left)
qed
lemma le_ext :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid: "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
shows "le V a b = (d b \<subseteq> d a \<and> Poset.le (ob V \<cdot> (d a)) (e a) (e (ext V (d a) b)))"
by (metis V_valid a_el b_el d_elem_is_open d_ext elem_le_wrap local_le_def res_ext_adjunction valid_le)
lemma laxity :
fixes V :: "('A,'a) OVA" and B :: "'A Open" and a a' :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and B_open :"B \<in> opens (space V)" and B_le_A : "B \<subseteq> d a"
and a_el : "a \<in> elems V" and a_a'_dom : "d a' = d a"
and a'_elem : "a' \<in> elems V"
shows "local_le V B (res V B (comb V a a')) (comb V (res V B a) (res V B a'))"
by (smt (verit) B_open V_valid a'_elem a_a'_dom a_el assms(3) comb_is_element d_comb d_res id_le_res order.refl res_elem sup.orderE valid_le valid_monotone valid_semigroup)
lemma ova_comb_local:
fixes V :: "('A, 'a) OVA" and a b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V" and b_el : "b \<in> elems V"
shows "comb V a b = comb V (ext V (d a \<union> d b) a) (ext V (d a \<union> d b) b)"
proof -
define "mul" (infixl \<open>\<otimes>\<close> 55) where "a \<otimes> b = comb V a b" for a b
define "\<epsilon>" where "\<epsilon> = neut V"
define "AB" where "AB = d a \<union> d b"
have "a \<otimes> b = (\<epsilon> AB) \<otimes> (\<epsilon> AB) \<otimes> (a \<otimes> b)"
by (metis (no_types, lifting) AB_def V_valid \<epsilon>_def a_el b_el comb_is_element d_elem_is_open fst_conv mul_def neutral_is_element valid_domain_law valid_neutral_law_left)
moreover have "... = (\<epsilon> AB \<otimes> a) \<otimes> (\<epsilon> AB \<otimes> b)"
by (smt (verit, del_insts) AB_def Un_Int_eq(1) V_valid \<epsilon>_def a_el b_el comb_is_element d_elem_is_open fst_conv mul_def neutral_is_element sup_inf_absorb valid_comb_associative valid_domain_law valid_neutral_law_right)
moreover have "... = (ext V AB a) \<otimes> (ext V AB b)" unfolding ext_def AB_def mul_def \<epsilon>_def
using assms
by (simp add: Prealgebra.valid_space d_elem_is_open valid_prealgebra valid_union2)
ultimately show ?thesis
by (simp add: AB_def mul_def)
qed
(* [Corollary 1 (1/2), TMCVA] *)
corollary strongly_neutral_combination :
fixes V :: "('A,'a) OVA" and A B :: "'A Open"
assumes V_valid : "valid V"
and B_open : "B \<in> opens (space V)" and A_open : "A \<in> opens (space V)"
and strongly_neutral: "is_strongly_neutral V"
shows "comb V (neut V A) (neut V B) = neut V (A \<union> B)"
by (smt (verit, best) A_open B_open V_valid comb_is_element d_elem_is_open d_neut is_strongly_neutral_def neutral_is_element ova_comb_local strongly_neutral sup_ge1 sup_ge2 valid_domain_law valid_neutral_law_right)
(* [Corollary 1 (2/2), TMCVA] *)
corollary strongly_neutral_monoid :
fixes V :: "('A,'a) OVA" and a :: "('A,'a) Valuation"
assumes V_valid : "valid V"
and a_el : "a \<in> elems V"
and strongly_neutral: "is_strongly_neutral V"
shows "comb V (neut V {}) a = a \<and> comb V a (neut V {}) = a"
by (smt (verit, ccfv_threshold) Prealgebra.valid_space Space.valid_def V_valid a_el d_elem_is_open neutral_is_element strongly_neutral strongly_neutral_combination sup_bot.right_neutral sup_bot_left valid_comb_associative valid_neutral_law_left valid_neutral_law_right valid_prealgebra)
lemma strongly_neutral_neut_comm :
fixes V :: "('A,'a) OVA" and a :: "('A, 'a) Valuation" and U :: "'A Open"
assumes V_valid : "valid V"
and strongly_neutral : "is_strongly_neutral V"
and a_el : "a \<in> elems V"
and U_open :"U \<in> opens (space V)"
shows "comb V a (neut V U) = comb V (neut V U) a"
by (smt (verit) U_open V_valid a_el comb_is_element d_elem_is_open d_neut neutral_is_element strongly_neutral strongly_neutral_combination subset_Un_eq sup.absorb_iff1 sup.orderE valid_associative valid_domain_law valid_neutral_law_left valid_neutral_law_right valid_semigroup)
lemma weak_comb_law_left :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation" and U :: "'A Open"
assumes V_valid : "valid V"
and strongly_neutral : "is_strongly_neutral V"
and a_el : "a \<in> elems V" and b_elem : "b \<in> elems V"
and U_open :"U \<in> opens (space V)" and "d a \<subseteq> U" and "U \<subseteq> d a \<union> d b"
shows "res V U (comb V a b) = comb V a (res V (d b \<inter> U) b)"
proof -
have "U \<inter> (d a \<union> d b) = U"
using assms(7) by blast
moreover have "comb V a b \<in> elems V \<and> d (comb V a b) = d a \<union> d b"
by (meson V_valid a_el b_elem comb_is_element valid_domain_law)
moreover have "d (res V U (comb V a b)) = U"
using U_open assms(7) calculation(2) by auto
moreover have "res V U (comb V a b) = comb V (res V U (comb V a b)) (neut V U)"
by (metis U_open V_valid assms(7) calculation(2) calculation(3) res_elem valid_neutral_law_right)
moreover have "... = res V U (comb V (comb V a b) (neut V U))"
by (metis (no_types, lifting) U_open V_valid assms(7) calculation(2) d_neut inf.absorb_iff2 neutral_is_element valid_comb_law_right)
moreover have "... = res V U (comb V (comb V a (neut V U)) b)"
by (metis OVA.valid_welldefined U_open V_valid a_el b_elem strongly_neutral_neut_comm neutral_is_element strongly_neutral valid_associative)
moreover have "... = comb V (comb V a (neut V U)) (res V (U \<inter> d b) b)"
by (metis U_open V_valid a_el assms(6) b_elem comb_is_element fst_eqD neutral_is_element sup.absorb_iff2 valid_comb_law_left valid_domain_law)
moreover have "... = comb V (comb V a (res V (U \<inter> d b) b)) (neut V U)"
by (metis Int_lower2 Prealgebra.valid_space U_open V_valid a_el b_elem d_elem_is_open neutral_is_element res_elem strongly_neutral strongly_neutral_neut_comm valid_comb_associative valid_inter valid_prealgebra)
moreover have "... = comb V a (res V (U \<inter> d b) b)"
by (smt (verit, best) Int_lower2 Prealgebra.valid_space U_open V_valid a_el assms(6) b_elem calculation(1) comb_is_element d_elem_is_open d_res inf.absorb_iff2 inf_sup_distrib1 res_elem valid_domain_law valid_inter valid_neutral_law_right valid_prealgebra)
ultimately show ?thesis
by (simp add: Int_commute)
qed
lemma weak_comb_law_right :
fixes V :: "('A,'a) OVA" and a b :: "('A, 'a) Valuation" and U :: "'A Open"
assumes V_valid : "valid V"
and strongly_neutral : "is_strongly_neutral V"
and a_el : "a \<in> elems V" and b_elem : "b \<in> elems V"
and U_open :"U \<in> opens (space V)" and "d b \<subseteq> U" and "U \<subseteq> d a \<union> d b"
shows "res V U (comb V a b) = comb V (res V (d a \<inter> U) a) b"
proof -
have "U \<inter> (d a \<union> d b) = U"
using assms(7) by blast
moreover have "comb V a b \<in> elems V \<and> d (comb V a b) = d a \<union> d b"
by (meson V_valid a_el b_elem comb_is_element valid_domain_law)
moreover have "d (res V U (comb V a b)) = U"
using U_open assms(7) calculation(2) by auto
moreover have "res V U (comb V a b) = comb V (neut V U) (res V U (comb V a b))"
by (metis U_open V_valid assms(7) calculation(2) calculation(3) res_elem valid_neutral_law_left)
moreover have "... = res V U (comb V (neut V U) (comb V a b))"
by (metis (no_types, lifting) Int_Un_eq(2) Int_commute U_open V_valid assms(7) calculation(1) calculation(2) equalityE fst_conv neutral_is_element strongly_neutral weak_comb_law_left)
moreover have "... = res V U (comb V a (comb V (neut V U) b))"
by (metis U_open V_valid a_el b_elem neutral_is_element strongly_neutral strongly_neutral_neut_comm valid_comb_associative)
moreover have "... = comb V (res V (U \<inter> d a) a) (comb V (neut V U) b)"
by (metis Int_commute U_open V_valid a_el assms(6) b_elem comb_is_element fst_conv neutral_is_element sup.orderE valid_comb_law_right valid_domain_law)
moreover have "... = comb V (comb V (res V (U \<inter> d a) a) b) (neut V U)"
by (metis Int_lower2 Prealgebra.valid_space U_open V_valid a_el b_elem d_elem_is_open neutral_is_element res_elem strongly_neutral strongly_neutral_neut_comm valid_comb_associative valid_inter valid_prealgebra)
moreover have "... = comb V (res V (U \<inter> d a) a) b"
by (smt (verit, best) Int_lower2 Prealgebra.valid_space U_open V_valid a_el assms(6) b_elem calculation(1) comb_is_element d_elem_is_open d_res inf.absorb_iff2 inf_sup_distrib1 res_elem valid_domain_law valid_inter valid_neutral_law_right valid_prealgebra)
ultimately show ?thesis
by (simp add: Int_commute)
qed
(* [Corollary 2 (1/2), TMCVA] *)
corollary galois_insertion :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and b :: "('A, 'a) Valuation"
assumes V_valid : "valid V" and b_el : "b \<in> elems V"
and B_le_A : " d b \<subseteq> A" and A_open : "A \<in> opens (space V)"
shows "res V (d b) (ext V A b) = b"
by (smt (verit, best) A_open B_le_A V_valid b_el d_elem_is_open d_ext d_neut ext_comm ext_elem inf.absorb_iff2 neutral_is_element ova_comb_local stability subset_Un_eq sup.absorb_iff1 sup_ge2 valid_comb_law_right valid_neutral_law_left)
lemma ext_le_id :
fixes V :: "('A,'a) OVA" and A :: "'A Open" and b :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and A_open : "A \<in> opens (space V)" and B_le_A : "d b \<subseteq> A"
and b_el : "b \<in> elems V"
shows "le V (ext V A b) b"
by (metis A_open B_le_A V_valid b_el d_ext elem_le_wrap ext_elem galois_insertion res_functorial_id valid_le valid_poset valid_reflexivity valid_semigroup)
lemma ext_monotone' :
fixes V :: "('A,'a) OVA" and b b' :: "('A, 'a) Valuation" and A :: "'A Open"
assumes V_valid: "valid V"
and "A \<in> opens (space V)"
and "d b \<subseteq> A"
and "d b' \<subseteq> A"
and "b \<in> elems V" and "b' \<in> elems V" and "le V b b'"
shows "le V (ext V A b) (ext V A b')"
by (smt (verit, best) OVA.le_eq_local_le OVA.valid_welldefined V_valid assms(2) assms(3) assms(5) assms(6) assms(7) d_ext ext_elem ext_le_id res_ext_adjunction valid_le valid_poset valid_transitivity)
lemma res_monotone' :
fixes V :: "('A,'a) OVA" and a a' :: "('A, 'a) Valuation" and B :: "'A Open"
assumes V_valid: "valid V"
and "B \<in> opens (space V)"
and "B \<subseteq> d a"
and "B \<subseteq> d a'"
and "a \<in> elems V" and "a' \<in> elems V" and "le V a a'"
shows "le V (res V B a) (res V B a')"
by (smt (verit, ccfv_threshold) OVA.le_eq_local_le OVA.valid_welldefined V_valid assms(2) assms(4) assms(5) assms(6) assms(7) d_res id_le_res res_elem valid_le valid_poset valid_transitivity)
lemma laxity2 :
fixes V :: "('A,'a) OVA" and B B' :: "'A Open" and a a' :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and B_open :"B \<in> opens (space V)" and B_le_A : "B \<subseteq> d a"
and B_open :"B' \<in> opens (space V)" and B'_le_A' : "B' \<subseteq> d a'"
and a_el : "a \<in> elems V"
and a'_elem : "a' \<in> elems V"
shows "le V (res V (B \<union> B') (comb V a a')) (comb V (res V B a) (res V B' a'))"
by (smt (verit) B'_le_A' B_le_A B_open Prealgebra.valid_space V_valid a'_elem a_el assms(2) comb_is_element d_res id_le_res res_elem res_functorial_id res_monotone' valid_comb_monotone valid_domain_law valid_le valid_poset valid_prealgebra valid_reflexivity valid_semigroup valid_union2)
(* [Corollary 2 (2/2), TMCVA] *)
corollary galois_closure_extensive :
fixes V :: "('A,'a) OVA" and B :: "'A Open" and a :: "('A, 'a) Valuation"
assumes V_valid : "valid V" and "a \<in> elems V"
and "B \<subseteq> d a" and "B \<in> opens (space V)"
shows "local_le V (d a) a (ext V (d a) (res V B a))"
by (meson V_valid assms(2) assms(3) assms(4) id_le_res res_elem res_ext_adjunction valid_le)
lemma ext_functorial_trans_lhs_imp_rhs :
fixes V :: "('A,'a) OVA" and A B:: "'A Open" and c :: "('A, 'a) Valuation"
assumes V_valid : "valid V"
and c_el : "c \<in> elems V"
and A_open : "A \<in> opens (space V)" and B_open : "B \<in> opens (space V)"
and C_le_B : "d c \<subseteq> B" and B_le_A : "B \<subseteq> A"
shows "le V (ext V A c) (ext V A (ext V B c))"
by (smt (verit, ccfv_SIG) A_open B_le_A B_open C_le_B V_valid c_el d_elem_is_open d_ext d_res dual_order.trans elem_le_wrap ext_elem res_elem res_ext_adjunction res_functorial_trans valid_le valid_poset valid_reflexivity valid_semigroup)
lemma ext_functorial_trans_rhs_imp_lhs :
fixes V :: "('A,'a) OVA" and A B :: "'A Open" and c :: "('A, 'a) Valuation"
assumes V_valid : "valid V"