-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNoTrgGuarantees.v
111 lines (83 loc) · 3.21 KB
/
NoTrgGuarantees.v
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
From mathcomp Require Import all_ssreflect.
Set Implicit Arguments.
Unset Printing Implicit Defensive.
Require Import ClassicalExtras.
Require Import MyNotation.
Require Import Setoid.
Require Import FunctionalExtensionality.
Require Import Setoid.
Require Import Galois.
Require Import LanguageModel.
Require Import TraceModel.
Require Import Properties.
Require Import ChainModel.
Require Import Def.
Require Import TraceCriterion.
Require Import Relation4Correctness.
Require Import PropExtensionality.
Definition prop_extensionality := propositional_extensionality.
(* CA:
If a progam W__nd has a completely non-detrministic behavior,
the identity compiler is rel_TC for rel being the cheating relation but
every target guarantee is lost for all programs.
In particular if we assume W__good to be s.t. beh(W__good) = {s},
by compiling with the identity W__good (to itself!)
the only guarantee is that "W__good sat ⊤".
*)
Section Example.
Variable language: Language.
Local Definition id_compiler : CompilationChain language language :=
{| compile_whole := fun x => x ;
compile_par := fun x => x;
compile_ctx := fun x => x|}.
Variable trace : Set.
Local Definition prop := prop trace.
Variable Semantics : Semantics language trace.
Local Definition sem := sem Semantics.
Local Definition beh := beh Semantics.
Local Definition prg := prg language.
Local Definition sat := sat Semantics.
Local Definition cmp := compile_whole language language id_compiler.
Local Notation "W ↓" := (cmp W) (at level 50).
Variable W__nd : prg.
Hypothesis random_beh : forall s, sem W__nd s.
Local Definition cheat_rel : trace -> trace -> Prop := rel id_compiler Semantics Semantics.
Local Definition adjunction := induced_connection cheat_rel.
Local Definition τ' : prop -> prop := α adjunction.
Local Definition σ' : prop -> prop := γ adjunction.
Local Definition τTP := τTP id_compiler
Semantics Semantics
τ'.
Local Definition σTP := σTP id_compiler
Semantics Semantics
σ'.
Local Definition rel_TC := rel_TC id_compiler
Semantics Semantics
cheat_rel.
Lemma id_is_rel_TC : rel_TC.
Proof. by apply: cmp_is_rel_TC. Qed.
(* under this assumption the image of the abstraction τ' becomes trivial,
has only two points, ⊥ and ⊤.
*)
Lemma abstraction_lemma (π__S : prop):
(exists s, π__S s) -> (τ' (π__S) = fun _ => True).
Proof.
move => [s π_s].
apply: functional_extensionality => t.
apply: prop_extensionality. split; auto.
rewrite /τ' /α /= /low_rel => hfoo.
destruct (non_empty_sem Semantics W__nd) as [s' behWs'].
exists s. split.
- assumption.
- exists W__nd. split.
-- apply: random_beh.
-- rewrite /id_compiler /=. apply: random_beh.
Qed.
(* the cheating relation gives no target guarantee *)
Theorem no_trg_guarantee (W : prg) (π__S : prop):
(exists s, π__S s) -> sat (W ↓) (τ' π__S).
Proof.
move => non_empty_π.
by rewrite abstraction_lemma.
Qed.
End Example.