You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
lean4game/server/testgame/TestGame/Levels/Quantors/L02_Forall.lean

40 lines
1.0 KiB
Plaintext

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

import TestGame.Metadata
import Std.Tactic.RCases
import Mathlib.Tactic.Contrapose
import Mathlib.Tactic.Use
import Mathlib.Tactic.Ring
Game "TestGame"
World "Quantors"
Level 9
Title "Kontraposition"
Introduction
"
Bei einem `∀ x,` im Goal kann man mit `intro x` annehmen, dass man ein solches `x` hat.
Ein `(h : ∀ x, _)` in den Annahmen kann ....
"
-- TODO: `even`/`odd` sind in Algebra.Parity. Not ported yet
def even (a : ) : Prop := ∃ r, a = r + r
def odd (a : ) : Prop := ∃ k, a = 2*k + 1
Statement : ∀ (x : ), even x → even (x + 2) := by
intro x h
unfold even at *
rcases h with ⟨y, hy⟩
use y + 1
rw [hy]
ring
-- Message (n : ) (h : even n) : even (n ^ 2) =>
-- "Wenn du die Definition von `even` nicht kennst, kannst du diese mit `unfold even` oder
-- `unfold even at *` ersetzen.
-- Note: Der Befehl macht erst mal nichts in Lean sondern nur in der Anzeige. Der Beweis funktioniert
-- genau gleich, wenn du das `unfold` rauslöscht."
Tactics unfold rcases use rw ring intro