@@ -54,7 +54,6 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
54
54
val pre = specs.map(spec => spec match {
55
55
case Precondition (cond) => Precondition (exprOps.replaceFromSymbols(specsMap, cond))
56
56
case LetInSpec (vd, expr) => LetInSpec (vd, exprOps.replaceFromSymbols(specsMap, expr))
57
- case s => s
58
57
})
59
58
60
59
val res = s.ValDef .fresh(" res" , s.UnitType ())
@@ -104,8 +103,7 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
104
103
=> {
105
104
val paramVars = fd.params.map(_.toVariable)
106
105
val argCheck = args.forall(paramVars.contains) && args.toSet.size == args.size
107
- if (argCheck)
108
- funInv = Some (fi)
106
+ if (argCheck) funInv = Some (fi)
109
107
}
110
108
case _ =>
111
109
}(post)
@@ -117,7 +115,7 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
117
115
funInv match {
118
116
case Some (finv) => {
119
117
// make a helper lemma:
120
- val helper = inductPattern(symbols, symbols.functions(finv.id), fd)
118
+ val helper = inductPattern(symbols, symbols.functions(finv.id), fd).setPos(fd.getPos)
121
119
122
120
// transform the main lemma
123
121
val proof = FunctionInvocation (helper.id, fd.tparams.map(_.tp), fd.params.map(_.toVariable))
@@ -126,7 +124,7 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
126
124
val lemma = fd.copy(
127
125
fullBody = BodyWithSpecs (withPre).reconstructed,
128
126
flags = (s.Derived (fd.id) +: s.Derived (finv.id) +: (fd.flags.filterNot(f => f.name == " traceInduct" ))).distinct
129
- ).copiedFrom(fd)
127
+ ).copiedFrom(fd).setPos(fd.getPos)
130
128
131
129
Trace .setTrace(lemma.id)
132
130
Trace .setProof(helper.id)
@@ -135,7 +133,7 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
135
133
case None => {
136
134
val lemma = fd.copy(
137
135
flags = (s.Derived (fd.id) +: (fd.flags.filterNot(f => f.name == " traceInduct" )))
138
- ).copiedFrom(fd)
136
+ ).copiedFrom(fd).setPos(fd.getPos)
139
137
Trace .setTrace(lemma.id)
140
138
List (lemma)
141
139
}
@@ -200,8 +198,9 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
200
198
case Precondition (cond) => Precondition (exprOps.replaceFromSymbols(specsMap, cond)).setPos(spec)
201
199
case LetInSpec (vd, expr) => LetInSpec (vd, exprOps.replaceFromSymbols(specsMap, expr)).setPos(spec)
202
200
case Measure (measure) => Measure (exprOps.replaceFromSymbols(specsMap, measure)).setPos(spec)
203
- case s => s
201
+ case s => context.reporter.fatalError( s " Unsupported specs: $s " )
204
202
})
203
+
205
204
val withPre = exprOps.reconstructSpecs(pre, Some (fullBodySpecialized), indPattern.returnType)
206
205
207
206
val speccedLemma = BodyWithSpecs (lemma.fullBody).addPost
@@ -230,24 +229,14 @@ trait Trace extends CachingPhase with IdentityFunctions with IdentitySorts { sel
230
229
functions map CheckFilter .fullNameToPath
231
230
}
232
231
233
- private def shouldBeChecked (fid : Identifier ): Boolean = pathsOpt match {
234
- case None => false
235
-
236
- case Some (paths) =>
237
- // Support wildcard `_` as specified in the documentation.
238
- // A leading wildcard is always assumed.
239
- val path : Path = CheckFilter .fullNameToPath(CheckFilter .fixedFullName(fid))
240
- paths exists { p =>
241
- if (p endsWith Seq (" _" )) path containsSlice p.init
242
- else path endsWith p
243
- }
244
- }
245
-
246
232
private lazy val pathsOptModels : Option [Seq [Path ]] = context.options.findOption(optModels) map { functions =>
247
233
functions map CheckFilter .fullNameToPath
248
234
}
249
235
250
- private def isModel (fid : Identifier ): Boolean = pathsOptModels match {
236
+ private def shouldBeChecked (fid : Identifier ): Boolean = shouldBeChecked(pathsOpt, fid)
237
+ private def isModel (fid : Identifier ): Boolean = shouldBeChecked(pathsOptModels, fid)
238
+
239
+ private def shouldBeChecked (paths : Option [Seq [Path ]], fid : Identifier ): Boolean = paths match {
251
240
case None => false
252
241
253
242
case Some (paths) =>
0 commit comments