How to use obtain to make forward elimination proofs easier to read?










3















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.










share|improve this question


























    3















    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.










    share|improve this question
























      3












      3








      3








      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.










      share|improve this question














      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






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 12 '18 at 12:53









      Nick HuNick Hu

      233




      233






















          1 Answer
          1






          active

          oldest

          votes


















          0














          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:



          1. 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 assumption A -> A -> B and the remaining goal A -> B. As a result, you do not yet have the assumption A which you are assuming you have as this requires a second use of impI to obtain. Instead, by using proof(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 the impI introduction rule as often as it can (i.e. twice). Alternatively, proof(rule impI, rule impI) would also work here with the same effect.

          2. Second, your final line then obtain onwards, is not finishing the proof: you are not showing anything! By using an explicit show 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.






          share|improve this answer
























            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
            );



            );













            draft saved

            draft discarded


















            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









            0














            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:



            1. 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 assumption A -> A -> B and the remaining goal A -> B. As a result, you do not yet have the assumption A which you are assuming you have as this requires a second use of impI to obtain. Instead, by using proof(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 the impI introduction rule as often as it can (i.e. twice). Alternatively, proof(rule impI, rule impI) would also work here with the same effect.

            2. Second, your final line then obtain onwards, is not finishing the proof: you are not showing anything! By using an explicit show 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.






            share|improve this answer





























              0














              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:



              1. 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 assumption A -> A -> B and the remaining goal A -> B. As a result, you do not yet have the assumption A which you are assuming you have as this requires a second use of impI to obtain. Instead, by using proof(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 the impI introduction rule as often as it can (i.e. twice). Alternatively, proof(rule impI, rule impI) would also work here with the same effect.

              2. Second, your final line then obtain onwards, is not finishing the proof: you are not showing anything! By using an explicit show 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.






              share|improve this answer



























                0












                0








                0







                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:



                1. 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 assumption A -> A -> B and the remaining goal A -> B. As a result, you do not yet have the assumption A which you are assuming you have as this requires a second use of impI to obtain. Instead, by using proof(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 the impI introduction rule as often as it can (i.e. twice). Alternatively, proof(rule impI, rule impI) would also work here with the same effect.

                2. Second, your final line then obtain onwards, is not finishing the proof: you are not showing anything! By using an explicit show 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.






                share|improve this answer















                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:



                1. 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 assumption A -> A -> B and the remaining goal A -> B. As a result, you do not yet have the assumption A which you are assuming you have as this requires a second use of impI to obtain. Instead, by using proof(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 the impI introduction rule as often as it can (i.e. twice). Alternatively, proof(rule impI, rule impI) would also work here with the same effect.

                2. Second, your final line then obtain onwards, is not finishing the proof: you are not showing anything! By using an explicit show 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.







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 23 '18 at 9:00

























                answered Nov 23 '18 at 8:52









                Dominic MulliganDominic Mulligan

                381110




                381110



























                    draft saved

                    draft discarded
















































                    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.




                    draft saved


                    draft discarded














                    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





















































                    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







                    Popular posts from this blog

                    How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

                    Syphilis

                    Darth Vader #20