How to use obtain to make forward elimination proofs easier to read?
I'm trying to do basic natural deduction proofs in Isabelle, following this document (particularly slide 23).
I know I can do things like
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ B›
assume ‹A›
with ‹A ⟶ B› have ‹B› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ B) ⟶ A ⟶ B› ..
qed
But also
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ B› and ‹A›
then obtain ‹B› ..
qed
achieves the same goal.
So when I try to write the proof
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ A ⟶ B›
assume ‹A›
with ‹A ⟶ A ⟶ B› have ‹A ⟶ B› ..
hence ‹B› using ‹A› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B› ..
qed
like
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
qed
why does Isabelle complain that
Failed to finish proof:
goal (1 subgoal):
1. A ⟶ A ⟶ B ⟹ A ⟶ B
I'm aware that these are very simple things that Isabelle can prove in one step: the goal here is to produce a concise proof which is human readable (to the extent that Natural Deduction is), without having to consult Isabelle.
isabelle proof isar
add a comment |
I'm trying to do basic natural deduction proofs in Isabelle, following this document (particularly slide 23).
I know I can do things like
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ B›
assume ‹A›
with ‹A ⟶ B› have ‹B› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ B) ⟶ A ⟶ B› ..
qed
But also
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ B› and ‹A›
then obtain ‹B› ..
qed
achieves the same goal.
So when I try to write the proof
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ A ⟶ B›
assume ‹A›
with ‹A ⟶ A ⟶ B› have ‹A ⟶ B› ..
hence ‹B› using ‹A› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B› ..
qed
like
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
qed
why does Isabelle complain that
Failed to finish proof:
goal (1 subgoal):
1. A ⟶ A ⟶ B ⟹ A ⟶ B
I'm aware that these are very simple things that Isabelle can prove in one step: the goal here is to produce a concise proof which is human readable (to the extent that Natural Deduction is), without having to consult Isabelle.
isabelle proof isar
add a comment |
I'm trying to do basic natural deduction proofs in Isabelle, following this document (particularly slide 23).
I know I can do things like
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ B›
assume ‹A›
with ‹A ⟶ B› have ‹B› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ B) ⟶ A ⟶ B› ..
qed
But also
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ B› and ‹A›
then obtain ‹B› ..
qed
achieves the same goal.
So when I try to write the proof
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ A ⟶ B›
assume ‹A›
with ‹A ⟶ A ⟶ B› have ‹A ⟶ B› ..
hence ‹B› using ‹A› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B› ..
qed
like
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
qed
why does Isabelle complain that
Failed to finish proof:
goal (1 subgoal):
1. A ⟶ A ⟶ B ⟹ A ⟶ B
I'm aware that these are very simple things that Isabelle can prove in one step: the goal here is to produce a concise proof which is human readable (to the extent that Natural Deduction is), without having to consult Isabelle.
isabelle proof isar
I'm trying to do basic natural deduction proofs in Isabelle, following this document (particularly slide 23).
I know I can do things like
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ B›
assume ‹A›
with ‹A ⟶ B› have ‹B› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ B) ⟶ A ⟶ B› ..
qed
But also
theorem ‹(A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ B› and ‹A›
then obtain ‹B› ..
qed
achieves the same goal.
So when I try to write the proof
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof -
assume ‹A ⟶ A ⟶ B›
assume ‹A›
with ‹A ⟶ A ⟶ B› have ‹A ⟶ B› ..
hence ‹B› using ‹A› ..
hence ‹A ⟶ B› ..
thus ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B› ..
qed
like
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
qed
why does Isabelle complain that
Failed to finish proof:
goal (1 subgoal):
1. A ⟶ A ⟶ B ⟹ A ⟶ B
I'm aware that these are very simple things that Isabelle can prove in one step: the goal here is to produce a concise proof which is human readable (to the extent that Natural Deduction is), without having to consult Isabelle.
isabelle proof isar
isabelle proof isar
asked Nov 12 '18 at 12:53
Nick HuNick Hu
233
233
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
This modification to your proof works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then show ‹B› using ‹A› ..
qed
The problem is twofold:
- The opening of the proof block applied a 'standard' introduction rule automatically based on the shape of the goal you were trying to prove. In your case this was implication introduction, i.e. the theorem
impI
. The problem is that you only apply this once which leaves you with the assumptionA -> A -> B
and the remaining goalA -> B
. As a result, you do not yet have the assumptionA
which you are assuming you have as this requires a second use ofimpI
to obtain. Instead, by usingproof(intros impI)
I am telling Isabelle to refrain from using its standard set of introduction and elimination rules as a first step in the proof and instead apply theimpI
introduction rule as often as it can (i.e. twice). Alternatively,proof(rule impI, rule impI)
would also work here with the same effect. - Second, your final line
then obtain
onwards, is not finishing the proof: you are notshow
ing anything! By using an explicitshow
you are signalling to Isabelle that you would like to 'refine' an open goal and actually conclude what it is you set out to prove at the start of the block.
Note that your use of obtain
here to work forward from the facts A -> B
and A
was not incorrect if your only goal is to derive B
. The problem is you are trying to work forward from facts to derive new ones at the same time as refine an open goal. For instance, this also works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
then show ‹B› .
qed
where the fact B
is obtained on the first line, and the second line trivially uses this fact to refine the open goal B
.
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262603%2fhow-to-use-obtain-to-make-forward-elimination-proofs-easier-to-read%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
This modification to your proof works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then show ‹B› using ‹A› ..
qed
The problem is twofold:
- The opening of the proof block applied a 'standard' introduction rule automatically based on the shape of the goal you were trying to prove. In your case this was implication introduction, i.e. the theorem
impI
. The problem is that you only apply this once which leaves you with the assumptionA -> A -> B
and the remaining goalA -> B
. As a result, you do not yet have the assumptionA
which you are assuming you have as this requires a second use ofimpI
to obtain. Instead, by usingproof(intros impI)
I am telling Isabelle to refrain from using its standard set of introduction and elimination rules as a first step in the proof and instead apply theimpI
introduction rule as often as it can (i.e. twice). Alternatively,proof(rule impI, rule impI)
would also work here with the same effect. - Second, your final line
then obtain
onwards, is not finishing the proof: you are notshow
ing anything! By using an explicitshow
you are signalling to Isabelle that you would like to 'refine' an open goal and actually conclude what it is you set out to prove at the start of the block.
Note that your use of obtain
here to work forward from the facts A -> B
and A
was not incorrect if your only goal is to derive B
. The problem is you are trying to work forward from facts to derive new ones at the same time as refine an open goal. For instance, this also works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
then show ‹B› .
qed
where the fact B
is obtained on the first line, and the second line trivially uses this fact to refine the open goal B
.
add a comment |
This modification to your proof works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then show ‹B› using ‹A› ..
qed
The problem is twofold:
- The opening of the proof block applied a 'standard' introduction rule automatically based on the shape of the goal you were trying to prove. In your case this was implication introduction, i.e. the theorem
impI
. The problem is that you only apply this once which leaves you with the assumptionA -> A -> B
and the remaining goalA -> B
. As a result, you do not yet have the assumptionA
which you are assuming you have as this requires a second use ofimpI
to obtain. Instead, by usingproof(intros impI)
I am telling Isabelle to refrain from using its standard set of introduction and elimination rules as a first step in the proof and instead apply theimpI
introduction rule as often as it can (i.e. twice). Alternatively,proof(rule impI, rule impI)
would also work here with the same effect. - Second, your final line
then obtain
onwards, is not finishing the proof: you are notshow
ing anything! By using an explicitshow
you are signalling to Isabelle that you would like to 'refine' an open goal and actually conclude what it is you set out to prove at the start of the block.
Note that your use of obtain
here to work forward from the facts A -> B
and A
was not incorrect if your only goal is to derive B
. The problem is you are trying to work forward from facts to derive new ones at the same time as refine an open goal. For instance, this also works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
then show ‹B› .
qed
where the fact B
is obtained on the first line, and the second line trivially uses this fact to refine the open goal B
.
add a comment |
This modification to your proof works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then show ‹B› using ‹A› ..
qed
The problem is twofold:
- The opening of the proof block applied a 'standard' introduction rule automatically based on the shape of the goal you were trying to prove. In your case this was implication introduction, i.e. the theorem
impI
. The problem is that you only apply this once which leaves you with the assumptionA -> A -> B
and the remaining goalA -> B
. As a result, you do not yet have the assumptionA
which you are assuming you have as this requires a second use ofimpI
to obtain. Instead, by usingproof(intros impI)
I am telling Isabelle to refrain from using its standard set of introduction and elimination rules as a first step in the proof and instead apply theimpI
introduction rule as often as it can (i.e. twice). Alternatively,proof(rule impI, rule impI)
would also work here with the same effect. - Second, your final line
then obtain
onwards, is not finishing the proof: you are notshow
ing anything! By using an explicitshow
you are signalling to Isabelle that you would like to 'refine' an open goal and actually conclude what it is you set out to prove at the start of the block.
Note that your use of obtain
here to work forward from the facts A -> B
and A
was not incorrect if your only goal is to derive B
. The problem is you are trying to work forward from facts to derive new ones at the same time as refine an open goal. For instance, this also works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
then show ‹B› .
qed
where the fact B
is obtained on the first line, and the second line trivially uses this fact to refine the open goal B
.
This modification to your proof works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then show ‹B› using ‹A› ..
qed
The problem is twofold:
- The opening of the proof block applied a 'standard' introduction rule automatically based on the shape of the goal you were trying to prove. In your case this was implication introduction, i.e. the theorem
impI
. The problem is that you only apply this once which leaves you with the assumptionA -> A -> B
and the remaining goalA -> B
. As a result, you do not yet have the assumptionA
which you are assuming you have as this requires a second use ofimpI
to obtain. Instead, by usingproof(intros impI)
I am telling Isabelle to refrain from using its standard set of introduction and elimination rules as a first step in the proof and instead apply theimpI
introduction rule as often as it can (i.e. twice). Alternatively,proof(rule impI, rule impI)
would also work here with the same effect. - Second, your final line
then obtain
onwards, is not finishing the proof: you are notshow
ing anything! By using an explicitshow
you are signalling to Isabelle that you would like to 'refine' an open goal and actually conclude what it is you set out to prove at the start of the block.
Note that your use of obtain
here to work forward from the facts A -> B
and A
was not incorrect if your only goal is to derive B
. The problem is you are trying to work forward from facts to derive new ones at the same time as refine an open goal. For instance, this also works:
theorem ‹(A ⟶ A ⟶ B) ⟶ A ⟶ B›
proof(intro impI)
assume ‹A ⟶ A ⟶ B› and ‹A›
hence ‹A ⟶ B› ..
then obtain ‹B› using ‹A› ..
then show ‹B› .
qed
where the fact B
is obtained on the first line, and the second line trivially uses this fact to refine the open goal B
.
edited Nov 23 '18 at 9:00
answered Nov 23 '18 at 8:52
Dominic MulliganDominic Mulligan
381110
381110
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53262603%2fhow-to-use-obtain-to-make-forward-elimination-proofs-easier-to-read%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown