Skip to content

Commit 5cc4910

Browse files
committed
Merge main into hammer
2 parents 7e8f3ab + 0794247 commit 5cc4910

File tree

5 files changed

+26
-26
lines changed

5 files changed

+26
-26
lines changed

Auto/EvaluateAuto/TestAuto.lean

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,16 +167,16 @@ where
167167
let s := (line.takeWhile (fun c => c != ' ')).toString
168168
let .some res := Result.ofConcise? s
169169
| throwError s!"{decl_name%} :: In file {fileName}, {s} is not a concise representation of a `Result`"
170-
let line := (line.dropWhile (fun c => c != ' ')).drop 1
170+
let line := ((line.dropWhile (fun c => c != ' ')).drop 1).toString
171171
let s := (line.takeWhile (fun c => c != ' ')).toString
172172
let .some time := String.toNat? s
173173
| throwError s!"{decl_name%} :: In file {fileName}, {s} is not a string representation of a Nat"
174-
let line := (line.dropWhile (fun c => c != ' ')).drop 1
174+
let line := ((line.dropWhile (fun c => c != ' ')).drop 1).toString
175175
let s := (line.takeWhile (fun c => c != ' ')).toString
176176
let .some hb := String.toNat? s
177177
| throwError s!"{decl_name%} :: In file {fileName}, {s} is not a string representation of a Nat"
178-
let line := (line.dropWhile (fun c => c != ' ')).drop 1
179-
let name := Name.parseUniqRepr line.toString
178+
let line := ((line.dropWhile (fun c => c != ' ')).drop 1).toString
179+
let name := Name.parseUniqRepr line
180180
return (name, res, time, hb)
181181

182182
def runAutoOnNamesFile (cfg : EvalAutoConfig) (fname : String) : CoreM Unit := do
@@ -332,7 +332,7 @@ def readEATAResult (config : EvalAutoAsyncConfig) :
332332
let allFiles := (← System.FilePath.readDir resultFolder).map IO.FS.DirEntry.path
333333
let mut ret := #[]
334334
for file in allFiles do
335-
if !(← System.FilePath.isDir file) && (file.toString.takeEnd 7).toString == ".result" then
335+
if !(← System.FilePath.isDir file) && file.toString.takeEnd 7 == ".result" then
336336
ret := ret.append (← readRunAutoOnConstsResult file.toString)
337337
return ret
338338

Auto/EvaluateAuto/TestTactics.lean

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -335,15 +335,15 @@ def readEvalTacticsAtModuleResult (resultFile : String) : CoreM (Array (Name ×
335335
where
336336
analyzeLine (fileName line : String) : CoreM (Name × Array (Result × Nat × Nat)) := do
337337
let line := (line.dropWhile (fun c => c != ' ')).drop 3
338-
let tr := ((line.takeWhile (fun c => c != ']')).toString.splitOn ", ")
339-
let tr : Array (Result × Nat × Nat) ← (Array.mk tr).mapM (fun s => do
338+
let tr := ((line.takeWhile (fun c => c != ']')).split ", ").toStringArray
339+
let tr : Array (Result × Nat × Nat) ← tr.mapM (fun s => do
340340
let [sr, st, sh] := s.splitOn " "
341341
| throwError s!"{decl_name%} :: In file {fileName}, {s} is not of the form `<result> <time> <heartbeats>`"
342342
match Result.ofConcise? sr, String.toNat? st, String.toNat? sh with
343343
| .some r, .some t, .some h => return (r, t, h)
344344
| _, _, _ => throwError s!"{decl_name%} :: In file {fileName}, {s} is not of the form `<result> <time> <heartbeats>`")
345-
let line := (line.dropWhile (fun c => c != ']')).drop 2
346-
let name := Name.parseUniqRepr line.toString
345+
let line := ((line.dropWhile (fun c => c != ']')).drop 2).toString
346+
let name := Name.parseUniqRepr line
347347
return (name, tr)
348348

349349
structure EvalTacticOnMathlibConfig where
@@ -495,8 +495,8 @@ def readETMHTResult (config : EvalTacticOnMathlibConfig) :
495495
for path in allPaths do
496496
if !(← System.FilePath.isDir path) && path.toString.takeEnd 7 == ".result" then
497497
let content ← readEvalTacticsAtModuleResult path.toString
498-
let suffix := ((path.toString.drop (resultFolder.length + 1)).dropEnd 7).toString
499-
let modName := (suffix.splitOn "/").foldl (fun a b => Name.str a b) .anonymous
498+
let suffix := (path.toString.drop (resultFolder.length + 1)).dropEnd 7
499+
let modName := (suffix.split "/").toStringArray.foldl (fun a b => Name.str a b) .anonymous
500500
ret := ret.push (modName, content)
501501
return ret
502502

@@ -516,11 +516,11 @@ def readETMHTResultAllowNonRet (config : EvalTacticOnMathlibConfig) :
516516
if !(← System.FilePath.isDir path) && path.toString.takeEnd 7 == ".result" then
517517
let raw ← IO.FS.readFile path
518518
if raw.length == 0 then
519-
nonRet := nonRet.push ((path.toString.dropEnd 7).toString)
519+
nonRet := nonRet.push (path.toString.dropEnd 7).toString
520520
continue
521521
let content ← readEvalTacticsAtModuleResult path.toString
522-
let suffix := ((path.toString.drop (resultFolder.length + 1)).dropEnd 7).toString
523-
let modName := (suffix.splitOn "/").foldl (fun a b => Name.str a b) .anonymous
522+
let suffix := (path.toString.drop (resultFolder.length + 1)).dropEnd 7
523+
let modName := (suffix.split "/").toStringArray.foldl (fun a b => Name.str a b) .anonymous
524524
ret := ret.push (modName, content)
525525
return (nonRet, ret)
526526

@@ -580,7 +580,7 @@ def readETMHTEvaluateFiles (config : EvalTacticOnMathlibConfig) : CoreM (Array N
580580
let [name, retCode] := line.splitOn ":"
581581
| throwError "{decl_name%} :: Unexpected line format, line content : `{line}`"
582582
let name := (name.dropEnd 1).toString
583-
let retCode := (retCode.drop 1).toString
583+
let retCode := retCode.drop 1
584584
let some retCode := retCode.toNat?
585585
| throwError "{decl_name%} :: Unexpected line format, line content : `{line}`"
586586
retEnd := retEnd.push (str2Name name, retCode)

Auto/EvaluateAuto/TestTranslation.lean

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,14 +103,14 @@ where analyzeLine (line : String) : CoreM (Name × Nat × Option Nat) := do
103103
let line := (line.dropWhile (fun c => c != ' ')).drop 1
104104
let .some rawSize := rawSizeStr.toNat?
105105
| throwError "{decl_name%} :: {rawSizeStr} is not a string representation of a Nat"
106-
let monoSizeStr := (line.takeWhile (fun c => c != ' ')).toString
107-
let line := (line.dropWhile (fun c => c != ' ')).drop 1
106+
let monoSizeStr := line.takeWhile (fun c => c != ' ')
107+
let line := ((line.dropWhile (fun c => c != ' ')).drop 1).toString
108108
let mut monoSize? : Option Nat := .none
109109
if monoSizeStr != "N" then
110110
let .some monoSize := monoSizeStr.toNat?
111111
| throwError "{decl_name%} :: {monoSizeStr} is not a string representation of a Nat"
112112
monoSize? := .some monoSize
113-
let name := Name.parseUniqRepr line.toString
113+
let name := Name.parseUniqRepr line
114114
return (name, rawSize, monoSize?)
115115

116116
/--

Auto/IR/SMT.lean

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace IR.SMT
1414
def isSimpleSymbol (s : String) : Bool :=
1515
let symbSpecials := "~!@$%^&*_-+=<>.?/"
1616
let front := s.front.isAlpha || (symbSpecials.contains s.front)
17-
let body := s.all (fun c => Char.isAlphanum c || symbSpecials.contains c)
17+
let body := s.all (fun (c : Char) => c.isAlphanum || symbSpecials.contains c)
1818
s.length != 0 && front && body
1919

2020
-- <index> ::= <numeral> | <symbol>

Auto/Parser/TPTP.lean

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -400,7 +400,7 @@ def ident2StringConst (s : String) : Option StringConst :=
400400
match x, y.toNat? with
401401
| .some l, .some y' => .some (l.push (Char.ofNat y'))
402402
| _, _ => .none
403-
match s.take 9, (((s.drop 9).toString.splitOn "d").drop 1).foldl foldFn (.some "") with
403+
match s.take 9, (((s.drop 9).split "d").drop 1).toStringArray.foldl foldFn (.some "") with
404404
| "t_strVal_", .some s => .some (.strVal s)
405405
| _, _ => .none
406406

@@ -428,7 +428,7 @@ open Embedding.Lam in
428428
def ident2BitVecConst (s : String) : Option BitVecConst :=
429429
match s.take 7 with
430430
| "t_bvVal" =>
431-
match (s.drop 7).toString.splitOn "_" with
431+
match ((s.drop 7).split "_").toList with
432432
| ["", ns, is] =>
433433
match ns.toNat?, is.toNat? with
434434
| .some n, .some i => .some (.bvVal n i)
@@ -550,35 +550,35 @@ def ident2BitVecConst (s : String) : Option BitVecConst :=
550550
| "ashr", .some n => .some (.bvsmtashr n)
551551
| _, _ => .none
552552
| "t_bvapp" =>
553-
match s.take 11, (s.drop 11).toString.splitOn "_" with
553+
match s.take 11, ((s.drop 11).split "_").toList with
554554
| "t_bvappend_", [ns, ms] =>
555555
match ns.toNat?, ms.toNat? with
556556
| .some n, .some m => .some (.bvappend n m)
557557
| _, _ => .none
558558
| _, _ => .none
559559
| "t_bvext" =>
560-
match s.take 12, (s.drop 12).toString.splitOn "_" with
560+
match s.take 12, ((s.drop 12).split "_").toList with
561561
| "t_bvextract_", [ns, hs, ls] =>
562562
match ns.toNat?, hs.toNat?, ls.toNat? with
563563
| .some n, .some h, .some l => .some (.bvextract n h l)
564564
| _, _, _ => .none
565565
| _, _ => .none
566566
| "t_bvrep" =>
567-
match s.take 11, (s.drop 11).toString.splitOn "_" with
567+
match s.take 11, ((s.drop 11).split "_").toList with
568568
| "t_bvrepeat_", [ws, is] =>
569569
match ws.toNat?, is.toNat? with
570570
| .some w, .some i => .some (.bvrepeat w i)
571571
| _, _ => .none
572572
| _, _ => .none
573573
| "t_bvzer" =>
574-
match s.take 15, (s.drop 15).toString.splitOn "_" with
574+
match s.take 15, ((s.drop 15).split "_").toList with
575575
| "t_bvzeroExtend_", [ws, vs] =>
576576
match ws.toNat?, vs.toNat? with
577577
| .some w, .some v => .some (.bvzeroExtend w v)
578578
| _, _ => .none
579579
| _, _ => .none
580580
| "t_bvsig" =>
581-
match s.take 15, (s.drop 15).toString.splitOn "_" with
581+
match s.take 15, ((s.drop 15).split "_").toList with
582582
| "t_bvsignExtend_", [ws, vs] =>
583583
match ws.toNat?, vs.toNat? with
584584
| .some w, .some v => .some (.bvsignExtend w v)

0 commit comments

Comments
 (0)