Closed fduxiao closed 1 month ago
What about this one even simpler?
inductive T: Type where
| a | b
inductive R: T -> T -> Prop where
| r: R a b
example: Not (R b a) := by
intros H
cases H
admit
Questions of this nature are better suited for the Zulip, please use issues on this repo only to report actual issues in lean.
The error in your code is that a
and b
in Rel3
are being interpreted as variables, not elements of Three
, because they are namespaced as Three.a
and Three.b
, so you can either write that or use .a
and .b
in the definition of Rel3
. If you would like to avoid the implicit introduction of a
and b
as variables, you should use set_option autoImplicit true
or add it as a global setting in the lakefile.
inductive Three: Type where
| a | b | c
inductive Rel3: Three -> Three -> Prop where
| ab: Rel3 .a .b
| cb: Rel3 .c .b
theorem rel3_trans: forall {x y z: Three}, Rel3 x y -> Rel3 y z -> Rel3 x z := by
intros x y z Hxy Hyz
cases Hxy <;> cases Hyz
I defined a simple type and a simple relation.
Rel3
is obviously transitive.I tried to prove it. But
lean
failed to figure out the correct term if you destruct some of typeRel3 x y
If you use
cases Hyz
in the above,lean
will complain thattactic 'induction' failed, major premise type is not an inductive type
.Meanwhile, you can prove this in Coq.
Am I using the correct strategy to prove that? In
lean
, how do you prove it?