-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPolarity.v
183 lines (159 loc) · 4.91 KB
/
Polarity.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
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
(* This program is free software; you can redistribute it and/or *)
(* modify it under the terms of the GNU Lesser General Public License *)
(* as published by the Free Software Foundation; either version 2.1 *)
(* of the License, or (at your option) any later version. *)
(* *)
(* This program is distributed in the hope that it will be useful, *)
(* but WITHOUT ANY WARRANTY; without even the implied warranty of *)
(* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *)
(* GNU General Public License for more details. *)
(* *)
(* You should have received a copy of the GNU Lesser General Public *)
(* License along with this program; if not, write to the Free *)
(* Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA *)
(* 02110-1301 USA *)
(****************************************************************************)
(* Signes Project *)
(* 2002-2003 *)
(* Houda ANOUN *)
(* Pierre Casteran *)
(* LaBRI/INRIA *)
(****************************************************************************)
Require Export Sequent.
Require Import ZArith.
Require Import ZArithRing.
Set Implicit Arguments.
Unset Strict Implicit.
Section PolarityTheorem.
Variable Atoms : Set.
Variable p : Atoms.
Hypothesis Atomseq_dec : forall y : Atoms, {p = y} + {p <> y}.
Fixpoint polarityForm (F : Form Atoms) : Z :=
match F with
| At a => match Atomseq_dec a with
| left _ => 1%Z
| right _ => 0%Z
end
| Slash F1 F2 => (polarityForm F1 - polarityForm F2)%Z
| Backslash F1 F2 => (polarityForm F2 - polarityForm F1)%Z
| Dot F1 F2 => (polarityForm F2 + polarityForm F1)%Z
end.
Fixpoint polarityTerm (T : Term Atoms) : Z :=
match T with
| OneForm F => polarityForm F
| Comma T1 T2 => (polarityTerm T1 + polarityTerm T2)%Z
end.
Definition extensionPolarity (E : gentzen_extension) :=
forall T1 T2 : Term Atoms,
E Atoms T1 T2 -> polarityTerm T1 = polarityTerm T2.
Definition NLEqualPolarity : extensionPolarity NL_Sequent.
unfold extensionPolarity in |- *.
simple induction 1.
Defined.
Definition NLPEqualPolarity : extensionPolarity NLP_Sequent.
unfold extensionPolarity in |- *.
simple induction 1.
simpl in |- *.
intros.
ring.
Defined.
Definition LEqualPolarity : extensionPolarity L_Sequent.
unfold extensionPolarity in |- *.
simple induction 1; simpl in |- *; intros; ring.
Defined.
Definition LPEqualPolarity : extensionPolarity LP_Sequent.
unfold extensionPolarity in |- *.
unfold LP_Sequent in |- *.
unfold add_genExtension in |- *.
intros T1 T2 H.
elim H.
intro.
apply NLPEqualPolarity.
assumption.
intro.
apply LEqualPolarity.
assumption.
Defined.
Theorem replacePolarity :
forall Gamma Gamma' Delta Delta' : Term Atoms,
replace Gamma Gamma' Delta Delta' ->
polarityTerm Delta = polarityTerm Delta' ->
polarityTerm Gamma' = polarityTerm Gamma.
simple induction 1.
auto.
intros.
simpl in |- *.
auto with zarith.
intros.
simpl in |- *.
auto with zarith.
Qed.
Theorem equalPolarity :
forall (Gamma : Term Atoms) (F : Form Atoms) (E : gentzen_extension),
extensionPolarity E ->
gentzenSequent E Gamma F -> polarityTerm Gamma = polarityForm F :>Z.
Proof.
intros Gamma F E H H0.
elim H0.
simpl in |- *.
auto.
intros Gamma0 A B H1 H2.
simpl in |- *.
simpl in H2.
rewrite <- H2.
ring.
intros Gamma0 A B H1 H2.
simpl in |- *.
simpl in H2.
rewrite <- H2.
ring.
intros Gamma0 Delta A B H1 H2 H3 H4.
simpl in |- *.
rewrite <- H2.
rewrite <- H4.
ring.
intros Delta Gamma0 Gamma' A B C H1 H2 H3 H4 H5.
rewrite <- H5.
eapply replacePolarity.
eauto.
simpl in |- *.
rewrite <- H3.
ring.
intros Delta Gamma0 Gamma' A B C H1 H2 H3 H4 H5.
rewrite <- H5.
eapply replacePolarity.
eauto.
simpl in |- *.
rewrite <- H3.
ring.
intros Gamma0 Gamma' A B C H1 H2 H3.
rewrite <- H3.
eapply replacePolarity.
eauto.
simpl in |- *.
auto.
ring.
intros Delta Gamma0 Gamma' A C H1 H2 H3 H4 H5.
rewrite <- H5.
eapply replacePolarity.
eauto.
simpl in |- *.
auto.
intros Gamma0 Gamma' T1 T2 C H1 H2 H3 H4.
rewrite <- H4.
eapply replacePolarity.
eauto.
apply H.
assumption.
Qed.
Theorem AbsPolarity :
forall (Gamma : Term Atoms) (F : Form Atoms) (E : gentzen_extension),
gentzenSequent E Gamma F ->
extensionPolarity E -> polarityTerm Gamma <> polarityForm F -> False.
intros.
elim H1.
eapply equalPolarity; eauto.
Qed.
End PolarityTheorem.
Ltac Polartest at_ eqdec seq :=
case (AbsPolarity (p:=at_) (Atomseq_dec:=eqdec) seq).