Skip to Content.
Sympa Menu

coq-club - Re: [Coq-Club] Proving properties of functions defined through Fix

coq-club AT inria.fr

Subject: The Coq mailing list

List archive

Re: [Coq-Club] Proving properties of functions defined through Fix


Chronological Thread 
  • From: Jason Gross <jasongross9 AT gmail.com>
  • To: coq-club <coq-club AT inria.fr>
  • Subject: Re: [Coq-Club] Proving properties of functions defined through Fix
  • Date: Mon, 26 Oct 2020 17:57:15 -0400
  • Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=jasongross9 AT gmail.com; spf=Pass smtp.mailfrom=jasongross9 AT gmail.com; spf=None smtp.helo=postmaster AT mail-ed1-f52.google.com
  • Ironport-phdr: 9a23:AZUeFBW/97BD7C+HXVZvchWZ81LV8LGtZVwlr6E/grcLSJyIuqrYbBGFt8tkgFKBZ4jH8fUM07OQ7/m/Hzxfqs/Y7zgrS99lb1c9k8IYnggtUoauKHbQC7rUVRE8B9lIT1R//nu2YgB/Ecf6YEDO8DXptWZBUhrwOhBoKevrB4Xck9q41/yo+53Ufg5EmCexbal9IRmrrwjdrMobjIltJqos1xfEoGZDdvhLy29vOV+dhQv36N2q/J5k/SRQuvYh+NBFXK7nYak2TqFWASo/PWwt68LlqRfMTQ2U5nsBSWoWiQZHAxLE7B7hQJj8tDbxu/dn1ymbOc32Sq00WSin4qx2RhLklDsLOjgk+2zRl8d+jr9UoAi5qhNwzY7bYoGbOvR9cK3AY90VWXFMUdxNWyFbGI6wc5cDAugHMO1Fr4f9vVwOrR6mCAeoHuzv0ThIhnnr1qM7yeQhFhrG3Bc9FN8JsnTbts71NKAUUeC61qnIyi7Db+hS1Drm54jIdwouofCIXb5qbcXRzkwvGhrDg16NpoPrIymb2f4Rs2iH8eVgT+SvhnYmpgxxrDaixdkghpTUio4J1FzJ6yR0zZo0KNCmVUN2ZcCpHZlMui2HOIZ7TMMsTW9ntSskxLAKpJ+2cScJxZk7wRPUdvKJc4+N4h35VeaRJy91hHNjeLK+mxa+60ahyuPkWsi63lZGtCpEkt7Rtn0Lyhfd6dCHR+Nj8ku93TuDzQPe5+FeLUwqiabWKIQtz74umpcVrE/NBDX5mF/sg6+Tbkgk+van6+DgYrj+o5+TLY50igXnPqswh8OzHP00MgYOUmSF4+i827rj/Ur2QLVOkPI6iLXWsJffJcgDp665BRFa0po75hqhEzur1M4UkHoHIV5fZh6Lk4vkN0vOLfzmFfu/hk6jkDZvx/DIJL3hBZDNI2DBkLj7ZrZ97EhcyAUpzdBY/JJUEbUMLen8Wk/0rtPYDxs5PxaozObgDdVxzpkeVn6XAq+FLKPStkeF6f4oI+mVfYMapDL9K+U+6PP1ln84mVodfbGz0pcNaXC4GO5mI0SDbnb2jNcBCzRCgg1rR+vzzVaGTDQbM321Ruc34iwxIIOgF4bKAI631u+vxiC+S79ffWdAQn+WFmzzP9GGUuwLbi2IJdR6wxQLULGgT8kq0hT451yy8KZuMueBon5QjpnkztUgv7SOxyF3ziR9CoGm60/IT2xwmTlVFTo/3aQ6rEAkj1nei+53hPtXEdEV7PRMAF9jaczsitdiAtW3YTrvO8+TQQ//ENqjCDA1CNk2xo1WOhcvK5CZlhnGmhGSLfoQnr2PCoYz9/uFjXf0Lsd5jX3B0ft4gg==

The lemma you want is
Lemma Fix_eq : forall x:A, Fix x = F (fun (y:A) (p:R y x) => Fix y).
in Coq.Init.Wf.  You should never unfold Fix unless you're running the full computation of the function.  (You will have to unfold test, though.)


On Mon, Oct 26, 2020, 17:05 Mallku Ernesto Soldevila Raffa <mallkuernesto AT gmail.com> wrote:
Hi everyone!

I'm trying to understand how to prove properties about well-founded
recursions defined through the Fix combinator. As a simple (artificial) example,
I'm including the code of a function test : nat -> nat, that should return 0,
always.

When trying to prove the simpl_prop lemma below, after unfolding and
simplification, I'm unable to use the inductive hypothesis since it is expressed in
terms of a call to test, while in the goal I have a term involving Fix_f.
Are there some lemmas in the standard library that allow me to reason about
these definitions without resorting to unfold/simpl?

The code:

Require Import
        Arith.Wf_nat.

Definition test (n1 : nat) : nat.
  refine (Fix
         lt_wf
         (* possible dependent range type of the function that we are
            building *)
         (fun n : nat => nat)
         (* the function body *)
         (fun (n1 : nat)
            (test2 : forall (n2 : nat),
                     (lt n2 n1) -> nat) =>
             match n1 as n1' return n1 = n1' -> nat with
             | 0        => fun eqp : _             => 0
             | (S n1'') => fun eqp : n1 = (S n1'') => (test2 n1'' _)
             end
               eq_refl) n1).
rewrite eqp.
unfold lt.
apply le_n.
Defined.

Lemma simpl_prop : forall n, (test n) = 0.
Proof.
  apply (well_founded_induction lt_wf).
  intros.
  destruct x.
  + reflexivity.
  + unfold test.
    unfold Fix.
    unfold Fix_F.
    destruct (lt_wf (S x)).


Thanks in advance!

Best,
Mallku



Archive powered by MHonArc 2.6.19+.

Top of Page