Skip to content

Commit

Permalink
Merge pull request #47 from lenianiva/feat/tactic-extraction
Browse files Browse the repository at this point in the history
feat: Used constants in tactic step
  • Loading branch information
lenianiva authored Dec 6, 2024
2 parents 70544d4 + 66af206 commit 605fbd0
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 35 deletions.
62 changes: 31 additions & 31 deletions docs/data.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -117,83 +117,83 @@
"name": "stdout",
"output_type": "stream",
"text": [
"=== Before ===\n",
"[Before]\n",
"α : Sort ?u.7\n",
"⊢ α → α\n",
"===Tactic===\n",
"aesop\n",
"===After===\n",
"[Tactic]\n",
"aesop (using [])\n",
"[Afte]\n",
"\n",
"=== Before ===\n",
"[Before]\n",
"⊢ ∀ (p q : Prop), p ∨ q → q ∨ p\n",
"===Tactic===\n",
"intro p q h\n",
"===After===\n",
"[Tactic]\n",
"intro p q h (using [])\n",
"[Afte]\n",
"p q : Prop\n",
"h : p ∨ q\n",
"⊢ q ∨ p\n",
"=== Before ===\n",
"[Before]\n",
"p q : Prop\n",
"h : p ∨ q\n",
"⊢ q ∨ p\n",
"===Tactic===\n",
"cases h\n",
"===After===\n",
"[Tactic]\n",
"cases h (using ['Eq.refl', 'Or'])\n",
"[Afte]\n",
"case inl\n",
"p q : Prop\n",
"h✝ : p\n",
"⊢ q ∨ p\n",
"case inr p q : Prop h✝ : q ⊢ q ∨ p\n",
"=== Before ===\n",
"[Before]\n",
"case inl\n",
"p q : Prop\n",
"h✝ : p\n",
"⊢ q ∨ p\n",
"===Tactic===\n",
"apply Or.inr\n",
"===After===\n",
"[Tactic]\n",
"apply Or.inr (using ['Or.inr'])\n",
"[Afte]\n",
"case inl.h\n",
"p q : Prop\n",
"h✝ : p\n",
"⊢ p\n",
"=== Before ===\n",
"[Before]\n",
"case inl.h\n",
"p q : Prop\n",
"h✝ : p\n",
"⊢ p\n",
"===Tactic===\n",
"assumption\n",
"===After===\n",
"[Tactic]\n",
"assumption (using [])\n",
"[Afte]\n",
"\n",
"=== Before ===\n",
"[Before]\n",
"case inr\n",
"p q : Prop\n",
"h✝ : q\n",
"⊢ q ∨ p\n",
"===Tactic===\n",
"apply Or.inl\n",
"===After===\n",
"[Tactic]\n",
"apply Or.inl (using ['Or.inl'])\n",
"[Afte]\n",
"case inr.h\n",
"p q : Prop\n",
"h✝ : q\n",
"⊢ q\n",
"=== Before ===\n",
"[Before]\n",
"case inr.h\n",
"p q : Prop\n",
"h✝ : q\n",
"⊢ q\n",
"===Tactic===\n",
"assumption\n",
"===After===\n",
"[Tactic]\n",
"assumption (using [])\n",
"[Afte]\n",
"\n"
]
}
],
"source": [
"for i in invocations:\n",
" print(f\"=== Before ===\\n{i.before}\")\n",
" print(f\"===Tactic===\\n{i.tactic}\")\n",
" print(f\"===After===\\n{i.after}\")"
" print(f\"[Before]\\n{i.before}\")\n",
" print(f\"[Tactic]\\n{i.tactic} (using {i.used_constants})\")\n",
" print(f\"[Afte]\\n{i.after}\")"
]
},
{
Expand Down
10 changes: 7 additions & 3 deletions pantograph/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,13 @@ class TacticInvocation:
before: str
after: str
tactic: str
used_constants: list[str]

@staticmethod
def parse(payload: dict):
return TacticInvocation(before=payload["goalBefore"],
after=payload["goalAfter"],
tactic=payload["tactic"])
return TacticInvocation(
before=payload["goalBefore"],
after=payload["goalAfter"],
tactic=payload["tactic"],
used_constants=payload.get('usedConstants', []),
)
2 changes: 1 addition & 1 deletion src

0 comments on commit 605fbd0

Please sign in to comment.