apply f to h

This commit is contained in:
Jon Eugster
2023-08-06 23:45:04 +02:00
parent c80a695def
commit 5a9bb1c119
2 changed files with 22 additions and 0 deletions

View File

@@ -10,6 +10,7 @@ import Mathlib.Tactic
import Game.Tactic.Induction
import Game.Tactic.Rfl
import Game.Tactic.Rw
import Game.Tactic.Apply
-- import Std.Tactic.RCases
-- import Game.Tactic.Have
-- import Game.Tactic.LeftRight

21
Game/Tactic/Apply.lean Normal file
View File

@@ -0,0 +1,21 @@
import Mathlib.Tactic.Replace
open Lean Elab Tactic
/--
If `(h : A)` is a proof of `A` and `f : A → B` an implication then
`apply f to h` turns `h` into a proof of `B`.
This is a game specific implementation. It is equivalent to the
tactic `replace h := f h`.
-/
syntax (name := applyTo) "apply" ident " to " ident : tactic
elab_rules : tactic | `(tactic| apply $thm to $hyp) => do
evalTactic ( `(tactic| replace $hyp := $thm $hyp))
-- Test
example (A B C : Prop) (ha : A) (f : A B) (g : B C) : C := by
apply g
apply f to ha
assumption