2014-01-05 20:05:08 +00:00
|
|
|
|
variable N : Type
|
|
|
|
|
variable h : N -> N -> N
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-06 03:10:21 +00:00
|
|
|
|
theorem congrH {a1 a2 b1 b2 : N} (H1 : a1 = b1) (H2 : a2 = b2) : (h a1 a2) = (h b1 b2) :=
|
|
|
|
|
congr (congr (refl h) H1) H2
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
|
-- Display the theorem showing implicit arguments
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit true
|
|
|
|
|
print environment 2
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
|
-- Display the theorem hiding implicit arguments
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit false
|
|
|
|
|
print environment 2
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
theorem Example1 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h a b) = (h c b) :=
|
2014-01-06 03:10:21 +00:00
|
|
|
|
or::elim H
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : a = b ∧ b = c,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr H1)) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : a = d ∧ d = c,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr H1)) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 19:03:35 +00:00
|
|
|
|
-- print proof of the last theorem with all implicit arguments
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit true
|
|
|
|
|
print environment 1
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
|
-- Using placeholders to hide the type of H1
|
2014-01-05 20:05:08 +00:00
|
|
|
|
theorem Example2 (a b c d : N) (H: (a = b ∧ b = c) ∨ (a = d ∧ d = c)) : (h a b) = (h c b) :=
|
2014-01-06 03:10:21 +00:00
|
|
|
|
or::elim H
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr H1)) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr H1)) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit true
|
|
|
|
|
print environment 1
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 16:52:46 +00:00
|
|
|
|
-- Same example but the first conjuct has unnecessary stuff
|
2014-01-05 20:05:08 +00:00
|
|
|
|
theorem Example3 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a b) = (h c b) :=
|
2014-01-06 03:10:21 +00:00
|
|
|
|
or::elim H
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr (and::elimr H1))) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
congrH (trans (and::eliml H1) (and::elimr H1)) (refl b))
|
2013-08-30 23:34:41 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit false
|
|
|
|
|
print environment 1
|
2013-08-31 21:24:07 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
theorem Example4 (a b c d e : N) (H: (a = b ∧ b = e ∧ b = c) ∨ (a = d ∧ d = c)) : (h a c) = (h c a) :=
|
2014-01-06 03:10:21 +00:00
|
|
|
|
or::elim H
|
2013-08-31 21:24:07 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
let AeqC := trans (and::eliml H1) (and::elimr (and::elimr H1))
|
|
|
|
|
in congrH AeqC (symm AeqC))
|
2013-08-31 21:24:07 +00:00
|
|
|
|
(fun H1 : _,
|
2014-01-06 03:10:21 +00:00
|
|
|
|
let AeqC := trans (and::eliml H1) (and::elimr H1)
|
|
|
|
|
in congrH AeqC (symm AeqC))
|
2013-08-31 21:24:07 +00:00
|
|
|
|
|
2014-01-05 20:05:08 +00:00
|
|
|
|
setoption lean::pp::implicit false
|
|
|
|
|
print environment 1
|