coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Mallku Ernesto Soldevila Raffa <mallkuernesto AT gmail.com>
- To: coq-club AT inria.fr
- Subject: [Coq-Club] Proving properties of functions defined through Fix
- Date: Mon, 26 Oct 2020 18:05:01 -0300
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=mallkuernesto AT gmail.com; spf=Pass smtp.mailfrom=mallkuernesto AT gmail.com; spf=None smtp.helo=postmaster AT mail-wr1-f44.google.com
- Ironport-phdr: 9a23:+DNanRzH1CYTHFjXCy+O+j09IxM/srCxBDY+r6Qd2+8TIJqq85mqBkHD//Il1AaPAdyEraIbwLqK+4nbGkU4qa6bt34DdJEeHzQksu4x2zIaPcieFEfgJ+TrZSFpVO5LVVti4m3peRMNQJW2aFLduGC94iAPERvjKwV1Ov71GonPhMiryuy+4ZLebxhKiTanYr5/Lhq6oAbeu8ILnYZsN6E9xwfTrHBVYepW32RoJVySnxb4+Mi9+YNo/jpTtfw86cNOSL32cKskQ7NWCjQmKH0169bwtRbfVwuP52ATXXsQnxFVHgXK9hD6XpP2sivnqupw3TSRMMPqQbwoXzmp8qFmQwLqhigaLT406G7YhMx+gqxYvRyvuQBwzpXOb42JLvdzZL/Rcc8YSGdHQ81fVzZBAoS5b4YXCOQOJ+JYr43+p1sTsBCwChOsBOXxxT9Tmn/22rAx3fkmEQHCwQMvAcwOsHXQrNrvKawcTfq6zKfGzTrZcvhb3jL955LMchAlovGMQKx/cdDXyUYxDAPFklKQpJfqPzOQzOsNsmyb4/B8WuKojm4qsgd8qSWgyckwkIfGnJ4Vykza+iVjxoY4Pd+1RVJ/bNO4H5VdqjyWOoVrTs0tX2xmtik0x78HtJO6cyYHy5spygLBZvGaboSF/g7vWeKVLDp7mX9oeq+ziwu0/EO9yeP8TtG53EhWoidBiNXBtXAA2wbN5sSZV/dx5Eis1DmJ2gvO8O9LO1o0mrDeK5M5wr4/iJ4TsUPbEy/zgkr2jauWelwq++iy9ujre7vmq5CTOoNuhQH+NaMumsO7AesmKAQBQ2+b+eGk2L3i+032XqlKg+UonqXFtJ3WP8cWq66jDwNLzIov9gyzAjip3dgAmHkINlNFeBaJj4jzPFHOJej1DfKljFSolDdrxO3GMaP7ApXLMHfDi6vhfbFm5k5TzQo819Ff55ZOBr4dJ/LzX1f9tMbEAR8hLwy03+HnBc1h2YMZQGKDG7OWMKfPsVCT/e8vOOmNZIoNuDnnMfQl5vjujWU4mVAHZ6Wp04EXOziEGaFtJFzcan7xiP8AF30Lt0wwVr/EklqHBBtaY3KxQuoR/Dc2E56hRbzEQoygnr2F1W+BF5NYbygSD1mIFXT1ep+CVuwQbwqdJ8ZglnoPUr33GNxp7g2nqAKvk+kvFeHT4CBN7cuyhugw3PXakFQJzRIxCs2c12+XSGQtxzEHQjY32OZ0pkkvkw7fg5g9uORREJlo390MSh0zbMeOwOlzCtS0UQXELI/QFQSWB+6+CDR0deofht8DZ0EnRoenhxHHmjWwWvoby+DNC5sz/abRmXP2IpQlxg==
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)).
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
- [Coq-Club] Proving properties of functions defined through Fix, Mallku Ernesto Soldevila Raffa, 10/26/2020
- Re: [Coq-Club] Proving properties of functions defined through Fix, Jason Gross, 10/26/2020
- Message not available
- Re: [Coq-Club] Proving properties of functions defined through Fix, Mallku Ernesto Soldevila Raffa, 10/27/2020
- Message not available
- Re: [Coq-Club] Proving properties of functions defined through Fix, Jason Gross, 10/26/2020
Archive powered by MHonArc 2.6.19+.