-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSyntax.v
81 lines (73 loc) · 1.88 KB
/
Syntax.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
Require Export Environment.
Require Import SetDecide.
Section Syntax.
Context `{env : Environment}.
Inductive formula (V : VS) :=
| pred_apply (p : pred) : arglist V (pred_ar p) -> formula V.
Parameter generalize :
forall {V V' : VS} (H : V [<=] V'),
formula V -> formula V'.
Record GCS := {
unknowns : VS;
parameters : VS;
disjoint : Empty (inter unknowns parameters);
variables := unknowns ++ parameters;
constraints : list (formula variables)
}.
Section sum.
Variable S1 S2 : GCS.
Let X := unknowns S1 ++ unknowns S2.
Let A := (parameters S1 ++ parameters S2) \ X.
Program Definition sum : GCS := {|
unknowns := X;
parameters := A;
constraints :=
app (map (generalize _) (constraints S1))
(map (generalize _) (constraints S2))
|}.
Let inter_diff_empty :
forall V V' : VS, Empty (inter (V) (V' \ V)).
Proof.
intros V V' v Hv.
pose proof (inter_1 Hv) as Hv1.
pose proof (inter_2 Hv) as Hv2.
apply diff_2 in Hv2.
tauto.
Qed.
Next Obligation.
apply inter_diff_empty.
Qed.
Let vars_is_union :
X ++ A [=] variables S1 ++ variables S2.
Proof.
unfold variables, A, X.
destruct S1 as [X1 A1 H1 V1 C1].
destruct S2 as [X2 A2 H2 V2 C2].
simpl.
clear X A H1 V1 C1 H2 V2 C2 S1 S2.
unfold VS in *.
intro v.
repeat rewrite mem_iff.
repeat rewrite union_b.
rewrite diff_b.
repeat rewrite union_b.
case (v \in X1);
case (v \in X2);
case (v \in A1);
case (v \in A2);
simpl;
reflexivity.
Qed.
Next Obligation.
rewrite vars_is_union.
intro v.
apply union_2.
Qed.
Next Obligation.
rewrite vars_is_union.
intro v.
apply union_3.
Qed.
End sum.
End Syntax.
Implicit Arguments pred_apply [sigma env V].