-
Notifications
You must be signed in to change notification settings - Fork 18
/
EventuallyConstantSchemaRefutation.scala
181 lines (170 loc) · 5.14 KB
/
EventuallyConstantSchemaRefutation.scala
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
package gapt.examples
import gapt.expr._
import gapt.proofs.Sequent
import gapt.proofs.ceres._
import gapt.proofs.context.update.ProofDefinitionDeclaration
import gapt.proofs.context.update.ProofNameDeclaration
import gapt.proofs.gaptic._
import gapt.proofs.lk.LKProof
object EventuallyConstantSchemaRefutation extends TacticsProof( EventuallyConstantSchema.ctx ) {
val SCS: Map[CLS, ( Struct, Set[Var] )] = SchematicStruct( "phi" ).getOrElse( Map() )
val CFPRN = CharFormPRN( SCS )
CharFormPRN.PR( CFPRN )
def sequentForm( input: Expr ) = Viperize( le"phiSFAF $input" )
val sequentForm = Viperize( le"phiSFAF n" )
ctx += hoc"Top:nat>nat"
ctx += hoc"Next:nat>i>nat"
val esTop = Sequent( Seq( hof"phiSFAF(n)" ), Seq() )
ctx += ProofNameDeclaration( le"Top n", esTop )
val esphi = Sequent( Seq( hof"E(n, f(g(k))) | LE(f(g(k)), n)", hof"E(n, f(k)) | LE(f(k), n)", hof"phiSFAT(n)" ), Seq() )
ctx += ProofNameDeclaration( le"Next n k", esphi )
val esPRSc = Sequent( Seq( "Ant_0" -> hof"phiSFAF(s(n))" ), Seq() )
val PRSc: LKProof = Lemma( esPRSc ) {
unfold( "phiSFAF" ) in "Ant_0"
andL
andL
andL( "Ant_0_0_0" )
andL( "Ant_0_0_1" )
andL
andL
allL( "Ant_0_0_0_0", le"(g z)" )
allL( "Ant_0_0_0_0_0", le"z" )
allL( "Ant_0_0_0_0", le"z" )
allL( "Ant_0_0_0_0_1", le"z" )
orL( "Ant_0_0_0_0_1_0" )
orL( "Ant_0_0_0_0_0_0" )
escargot
orL( "Ant_0_0_0_0_1_0" )
escargot
allL( "Ant_0_0_1_1_1_0", le"z" )
orL
escargot
allL( "Ant_0_0_0_1", le"(g (g z))" )
allL( "Ant_0_0_0_1", le"(g z)" )
allL( "Ant_0_0_0_1_0", le"(g z)" )
allL( "Ant_0_0_0_1_1", le"(g z)" )
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
ref( "Next" )
allL( "Ant_0_0_0_1", le"(g z)" )
allL( "Ant_0_0_0_1", le"z" )
allL( "Ant_0_0_0_1_0", le"z" )
allL( "Ant_0_0_0_1_1", le"z" )
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
ref( "Next" )
}
ctx += ProofDefinitionDeclaration( le"Top (s n)", PRSc )
val esPRBc = Sequent( Seq( "Ant_0" -> hof"phiSFAF(0)" ), Seq() )
val PRBc: LKProof = Lemma( esPRBc ) {
unfold( "phiSFAF" ) in "Ant_0"
escargot
}
ctx += ProofDefinitionDeclaration( le"Top 0", PRBc )
val esPR2Sc = Sequent( Seq(
"Ant_2" -> hof"E(s(n), f(g(k))) | LE(f(g(k)), s(n))",
"Ant_1" -> hof"E(s(n), f(k)) | LE(f(k), s(n))",
"Ant_0" -> hof"phiSFAT(s(n))" ), Seq() )
val PR2Sc: LKProof = Lemma( esPR2Sc ) {
unfold( "phiSFAT" ) in "Ant_0"
andL
andL
andL( "Ant_0_0_0" )
andL( "Ant_0_0_1" )
andL
andL
allL( "Ant_0_0_1_1_1_0", le"k:i" )
orL( "Ant_0_0_1_1_1_0_0" )
orL( "Ant_1" )
escargot
allL( "Ant_0_0_1_1_1_0", le"(g k)" )
orL( "Ant_0_0_1_1_1_0_1" )
orL( "Ant_2" )
escargot
allL( "Ant_0_0_0_1", le"(g (g k))" )
allL( "Ant_0_0_0_1", le"(g k)" )
allL( "Ant_0_0_0_1_0", le"(g k)" )
allL( "Ant_0_0_0_1_1", le"k:i" )
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
ref( "Next" )
allL( "Ant_0_0_0_1", le"(g k)" )
allL( "Ant_0_0_0_1", le"k:i" )
allL( "Ant_0_0_0_1_0", le"k:i" )
allL( "Ant_0_0_0_1_1", le"k:i" )
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
ref( "Next" )
orL( "Ant_0_0_1_1_1_0_0" )
orL( "Ant_2" )
escargot
allL( "Ant_0_0_0_1", le"(g (g k))" )
allL( "Ant_0_0_0_1", le"(g k)" )
allL( "Ant_0_0_0_1_0", le"(g k)" )
allL( "Ant_0_0_0_1_1", le"(g k)" )
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
orL( "Ant_0_0_0_1_1_0" )
escargot
orL( "Ant_0_0_0_1_0_0" )
escargot
ref( "Next" )
escargot
}
ctx += ProofDefinitionDeclaration( le"Next (s n) k", PR2Sc )
val esPR2Bc = Sequent( Seq(
"Ant_2" -> hof"E(0, f(g(k))) | LE(f(g(k)), 0)",
"Ant_1" -> hof"E(0, f(k)) | LE(f(k), 0)",
"Ant_0" -> hof"phiSFAT(0)" ), Seq() )
val PR2Bc: LKProof = Lemma( esPR2Bc ) {
unfold( "phiSFAT" ) in "Ant_0"
escargot
}
ctx += ProofDefinitionDeclaration( le"Next 0 k", PR2Bc )
}
object EventuallyConstantSchemaInductionRefutation extends TacticsProof( EventuallyConstantSchema.ctx ) {
import gapt.proofs.gaptic._
val Some( scs ) = SchematicStruct( "phi" )
val CFPRN = CharFormPRN( scs )
CharFormPRN.PR( CFPRN )
val next = Lemma( hof"!n!k ((E(n, f(g(k))) | LE(f(g(k)), n)) & (E(n, f(k)) | LE(f(k), n)) -> ~phiSFAT(n))" ) {
allR; induction( hov"n:nat" ) onAll unfold( "phiSFAT" ).in( "g" ) onAll escrgt
}
val prsc = Lemma( hof"!n ~phiSFAF(n)" ) {
allR; induction( hov"n:nat" ) onAll unfold( "phiSFAF" ).in( "g" )
by { escrgt }
by { include( "next", next ); escrgt }
}
// just a single induction
val prscs = Lemma( hof"!n ~phiSFAF(s(n))" ) {
unfold( "phiSFAF" ).in( "g" )
include( "next", next )
escrgt
}
}