text
stringlengths 0
89.3k
|
---|
We create miniCodeProps by translating programs from Tons of Inductive Programs TIP 14 |
httpsgithubcomtiporgbenchmarks from Haskell into Lean 4 We manually translated code from |
three files in TIP that contain a mix of function definitions propositions describing the results of |
calling those functions and termination lemmas used in the function definitions In total this yields |
177 Lean 4 theorem statements |
31 Collection Process |
The properties in TIP describe induction in both programming and purely mathematical contexts We |
first filtered out files that contained primarily mathematical induction then translated the remaining |
Haskell code into Lean 4 We then associated each property in the translated files with dependencies |
and metadata useful for different evaluation modes of the benchmark |
3Numbers Lists Trees Heaps |
Medley Functions 0 15 2 0 |
Medley Properties 21 64 1 0 |
TerminationSorting Functions 3 49 2 5 |
Termination Properties 3 22 0 3 |
Sorting Properties 0 63 0 0 |
Table 1 miniCodeProps Composition We classified each function and property in the Lean source |
files by their primary subject matter We also separate these numbers by the splits of miniCodeProps |
Medley Termination lemmas and Sorting algorithms Termination and Sorting algorithm functions |
are grouped because the properties in both splits describe the same set of functions |
32 Source Code Composition |
321 Functions |
Most of the translated functions operate on linked lists while the rest involve natural numbers and |
binary trees With a few notable exceptions the functions perform conceptually simple operations |
such as filtering returning the last element and counting the elements of a list The more complicated |
functions are increasingly esoteric sorting functions In total miniCodeProps is derived from 76 |
TIP functions A breakdown of the primary subject of each function is provided in Table 1 |
322 Properties |
The properties to be proven in miniCodeProps express intuitively correct properties of the functions |
being described See Section 34 for examples and Table 1 for a breakdown by subject type |
323 Termination Lemmas |
In Lean 4 recursive functions must be paired with a proof of termination While Lean automatically |
infers the proof in simple cases more complicated recursive calls require the user to explicitly prove |
termination As the vast majority of our function definitions are recursive our benchmark includes 28 |
lemmas that support 4 termination proofs of nonstandard sorting algorithms from TIP These lemmas |
themselves represent practically useful and highly nontrivial properties of code |
33 Dataset Splits |
To improve understanding of the precise capabilities of theorem proving agents when evaluated on |
miniCodeProps we section the 177 properties into 3 data splits Medley Termination lemmas and |
Sorting algorithms Medley properties are named prop_n for n186 and tend to involve simple |
functions on numbers and lists Sorting algorithm properties are those remaining theorems named |
beginning with prop and the remainder are Termination lemma properties |
The benchmark is formatted as a jsonlines file with the information in Table 2 per line The full_name |
property is used to determine the split the property belongs to |
34 Qualitative Examples |
We present several examples from the benchmark and describe what makes them interesting and |
difficult |
341 Zip over Concatenation |
We begin with a reimplementation of the standard zip function that combines two lists into a single |
list of paired elements prop_84 states that zipping a list xswith the concatenation of two other |
listsys zs is equivalent to separately zipping appropriate sections of xswith each of ysandzs |
then concatenating the results To the best of our knowledge Mathlib does not contain an equivalent |
lemma for the standard definition of the zip function |
4Table 2 Example code property and associated data |
Key Description Examples |
full_name Unique name of the property |
in the benchmarkprop_60 |
prop_defn The text of the code property |
to be provenlemma prop_60 xs List Nat ys |
List Nat not null ys last |
xs ys last ys by sorry |
prop_loc The file name and line num |
ber where the property defi |
nition beginsLeanSrcLeanSrcPropertieslean257 |
score An integer in the range 15 |
used as a difficulty heuristic5 |
deps Text containing all the depen |
dencies functions and lem |
mas that the property re |
quires to be fully definedimport Mathlib |
def last List Nat Nat |
0 |
x x |
_xxs last xs |
def null List αBool |
True |
_ False |
proof_state The initial proof state of the |
propertyxs ys List N |
null ys true last xs ys |
last ys |
file_locs A list of the last line in each |
file needed to define the prop |
erty Appending each file up |
to this line before the prop |
erty fully defines the prop |
ertyLeanSrcLeanSrcDefinitionslean 249 |
LeanSrcLeanSrcPropertieslean 258 |
def zip List αList βList αβ |
_ |
_ |
xxs yys x y zip xs ys |
lemma prop_84 xs List α ys List β zs List β |
zip xs ys zs |
zip Listtake Listlength ys xs ys |
zip Listdrop Listlength ys xs zs by |
This property is intuitively correct but requires some intuition about proofs of recursive structures |
to correctly prove in Lean The following is an incorrect proof generated by GPT4 It contains one |
semantic error failing to generalize xsin the inductive hypothesis and one misuse of Lean internals |
the cases keyword should be used instead of match |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.