Hi, for a goal like \<And> x. P x
, which method could refine it to P ?x
, by eliminating the \<And>
?
The idea of Isar is to not do that...
(assuming by that that you intend to instantiate a variable from a premise)
Having a goal of P ?x
would mean that you can solve the goal by plugging in whatever you want for ?x
. Thus, you can refine the goal to P ?x
, but certainly not the goal .
If your goal is , the usual way to handle that in Isar is to fix a new variable (‘let x
be arbitrary but fixed’) and then show that P x
holds. That is done like this:
proof -
fix x
show "P x"
If none of this answers your question, you might have to provide some more context to make it easier for us to understand what it is that you are struggling with.
My understanding was that the goal is (\<And> x. P x) ==> Q
, but the question is not so clear...
Thank you. I'm just learning this and interested in all cases you mentioned.
BTW, another trivial case just for learning,
lemma "⋀ x. P x"
proof -
fix x
have "P x" by sorry
thus "⋀ x. P x" by (* what method? *)
qed
which method could prove it here? Both the auto
and sledgehammer
fail here.
Another question: I also found the schematic variable ?thesis
in this proof context is P
rather than ⋀ x. P x
, which is also confusing.
lemma "⋀ x. P x"
proof -
term ?thesis (* P rather than ⋀ x. P x *)
qed
Just for learning, I'm also interested in which tactic in the apply
form or which rule could eliminate the \<And>
in the goal of lemma "\<And> x. P x"
(if it was a worthy question
You are missing some blocks for the first question:
lemma "⋀ x. P x"
proof -
{
fix x
have "P x" sorry
}
thus "⋀ x. P x"
by fast
qed
Without it, it cannot work because ‹P x ⟹ (⋀x. P x)› does not hold ;-)
For the ?thesis
: you should not write lemma "⋀ x. P x"
anyaway...
Qiyuan Xu said:
Just for learning, I'm also interested in which tactic in the
apply
form or which rule could eliminate the\<And>
in the goal oflemma "\<And> x. P x"
(if it was a worthy question
A good approximation while learning Isabelle: it is not possible.
Mathias Fleury said:
You are missing some blocks for the first question:
lemma "⋀ x. P x" proof - { fix x have "P x" sorry } thus "⋀ x. P x" by fast qed
Right! I got it. It's clear in my mind now. Thank you.
You could shorten this to just
lemma "⋀ x. P x"
proof -
fix x
show "P x" sorry
qed
That is by far the more idiomatic way. Plus, in a top-level goal statement like lemma
or theorem
, there is nor eason to include a ⋀
in front of the goal anyway. You can just leave it out because free variables in the goal are become schematic after you finished proving it anyway, just the same as if you had written it with a ⋀
.
Manuel Eberl said:
You could shorten this to just
lemma "⋀ x. P x" proof - fix x show "P x" sorry qed
That is by far the more idiomatic way. Plus, in a top-level goal statement like
lemma
ortheorem
, there is nor eason to include a⋀
in front of the goal anyway. You can just leave it out because free variables in the goal are become schematic after you finished proving it anyway, just the same as if you had written it with a⋀
.
Yes I know it, involving ⋀
in the outmost is just asking for trouble. I just tried to figure out the background mechanism, and really thank u :-)
Basically, what you need to know is that and are special in the sense that Isar knows what they mean and they are integrated into the reasoning structure of Isar. When you have a in a goal, it means that you have to do a fix x
in order to prove it, and if you have a in a goal, it means that you have to do assume P
in order to prove it.
Other logical connectives, such as the , , of HOL are not integrated with Isar directly. They are essentially opaque functions like any other function.
It is very uncommon to have something like have "⋀x. P x"
in an Isar proof. Certainly not a show "⋀x. P x"
.
You might want to write have "P x" for x
, though. One example is the equivalent of informal reasoning's WLoG:
assume comm: "P x y <--> P y x"
moreover have "P x y" if "x <= y" for x y
proof -
...
qed
ultimately have "P x y" by auto (* or perhaps blast with the lemma that x <= y \/ y <= x *)
Manuel Eberl said:
Basically, what you need to know is that and are special in the sense that Isar knows what they mean and they are integrated into the reasoning structure of Isar. When you have a in a goal, it means that you have to do a
fix x
in order to prove it, and if you have a in a goal, it means that you have to doassume P
in order to prove it.
I see. Then it's the reason why it's better to use the structural notation
lemma
assumes asm: "P"
shows "Q"
and we don't need to assume asm
in proof body again.
Yes, the keyword for
is elegant here.
If you mention for
, you should also know about if
. You can write
have "P x" if "Q x" for x :: nat
proof -
from that show "P x" sorry
qed
The that
is the name that is given to the thing you assume with if
. You can also give it another name, of course. I use this a lot.
yeah, it's clear and good. thanks.
Last updated: Dec 21 2024 at 16:20 UTC