I did this code :
section
variable p : Prop
example : ¬ (p ∧ ¬ p) :=
assume h : p ∧ ¬ p,
show false, from (and.left h) (and.right h)
end
But I have the following message error :
function expected at
h.left
term has type
p
But, in the other hand,
section
variable A : Prop
variable h1 : ¬ A
variable h2 : A
example : false := h1 h2
end
works fine...
How can I eliminate the "not" operator ?
In Lean,
¬ pis just shorthand forp -> false.Therefore, if we have
h1 : ¬ pandh2 : p, thenh1is a functionh1 : p -> false. Therefore,h1 h2 : false. This is why the example works.In your example, we have
(and.left h) : pwhile(and.right h) : ¬ p. The expression(and.left h) (and.right h)means "Apply the function(and.left hto the value(and.right h)". But there's no reason based on the types to think that(and.left h)is a function.The correct way to prove it is, of course, to exhibit an element of type
falsethrough the expression(and.right h) (and.left h). This is becauseand.right h : p -> falseandand.left h : p.