Views
No views yet

1from vllm import LLM, SamplingParams
2from transformers import AutoTokenizer
3model_name = "AI-MO/Kimina-Prover-RL-0.6B"
4model = LLM(
5 model=model_name,
6 max_model_len=131072,
7 )
8tokenizer = AutoTokenizer.from_pretrained(model_name, trust_remote_code=True)
9problem = "The volume of a cone is given by the formula $V = \frac{1}{3}Bh$, where $B$ is the area of the base and $h$ is the height. The area of the base of a cone is 30 square units, and its height is 6.5 units. What is the number of cubic units in its volume?"
10formal_statement = """import Mathlib
11import Aesop
12set_option maxHeartbeats 0
13open BigOperators Real Nat Topology Rat
14/-- The volume of a cone is given by the formula $V = \frac{1}{3}Bh$, where $B$ is the area of the base and $h$ is the height. The area of the base of a cone is 30 square units, and its height is 6.5 units. What is the number of cubic units in its volume? Show that it is 65.-/
15theorem mathd_algebra_478 (b h v : ℝ) (h₀ : 0 < b ∧ 0 < h ∧ 0 < v) (h₁ : v = 1 / 3 * (b * h))
16 (h₂ : b = 30) (h₃ : h = 13 / 2) : v = 65 := by
17"""
18prompt = "Think about and solve the following problem step by step in Lean 4."
19prompt += f"\n# Problem:{problem}"""
20prompt += f"\n# Formal statement:\n```lean4\n{formal_statement}\n```\n"
21messages = [
22 {"role": "system", "content": "You are an expert in mathematics and proving theorems in Lean 4."},
23 {"role": "user", "content": prompt}
24]
25text = tokenizer.apply_chat_template(
26 messages,
27 tokenize=False,
28 add_generation_prompt=True
29)
30sampling_params = SamplingParams(temperature=0.6, top_p=0.95, max_tokens=8096)
31output = model.generate(text, sampling_params=sampling_params)
32output_text = output[0].outputs[0].text
33print(output_text)