coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Jason -Zhong Sheng- Hu <fdhzs2010 AT hotmail.com>
- To: Pierre Courtieu <pierre.courtieu AT gmail.com>, "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: Re: [Coq-Club] Equations 1.2beta is out!
- Date: Wed, 6 Feb 2019 21:18:19 +0000
- Accept-language: en-CA, en-US
- Authentication-results: mail3-smtp-sop.national.inria.fr; spf=None smtp.pra=fdhzs2010 AT hotmail.com; spf=Pass smtp.mailfrom=fdhzs2010 AT hotmail.com; spf=Pass smtp.helo=postmaster AT NAM01-SN1-obe.outbound.protection.outlook.com
- Ironport-phdr: 9a23:gdAN0B0DhfjJ3V3BsmDT+DRfVm0co7zxezQtwd8ZseMUKPad9pjvdHbS+e9qxAeQG9mDu7Qc06L/iOPJYSQ4+5GPsXQPItRndiQuroEopTEmG9OPEkbhLfTnPGQQFcVGU0J5rTngaRAGUMnxaEfPrXKs8DUcBgvwNRZvJuTyB4Xek9m72/q99pHPYAhEniaxba9vJxiqsAvdsdUbj5F/Iagr0BvJpXVIe+VSxWx2IF+Yggjx6MSt8pN96ipco/0u+dJOXqX8ZKQ4UKdXDC86PGAv5c3krgfMQA2S7XYBSGoWkx5IAw/Y7BHmW5r6ryX3uvZh1CScIMb7Vq4/Vyi84Kh3SR/okCYHOCA/8GHLkcx7kaZXrAu8qxBj34LYZYeYP+d8cKzAZ9MXXWpPUNhMWSxdDI2ybIUPAOgdMulXtITyvUcCoQekCAWwGO/j1zlFjWL2060g1OQhFBnL0gg6ENIVt3TUqsj+OL4RXuC1y6nIyzrDZO5L1zf99ofIdB8hreiRVrxybMra1E4iFw3YgVWQqI3lJC2Z2vgQv2SH9OdgVeWvi3Iiqw5rozivwt0ghZXOhoIQ013J8zhyzoUtJdCgR0N3fcSoHZ9Ouy2AKYd6WMMvTm5wtCY01LILuoK3cS0PxZs5yBPQceKLfo2K7x/sWuuRLzJ1hHxqdb2jhBu/9FWsxfDzW8S11ltBszBLncPWtn8X0hze8siHReV5/kemwTuBzxze5OZYLUwpjKbVNoYvzqMpmpoUqkvMADX6mELrjK+KbUok/fWo6+L6bbn8vp+cLYh0ih3gPasyhsy/AOM4Mg4UU2ic5OS8yLnj/Ur+QLVJlPE5jq7ZsJXCKcQaoK62HRNV354s5hqjFTur1MoUkWMZIF5feB+KgJDlO1TUL/D5Cfe/jU6skDBux/3eML3uH5XNL3nYkLv/Ybpx9lJQxREzzdBY+5JUD6sOIPP3WkPrqNPYCRo5PxSuw+n7ENV9yp8eWWWXD6CFN6PSqEaE6f4rI+mRf4AYoy39Kvgg5/72l3A1g14dfa+z3ZsWcn+0BPpmI1/KKUbr1+8AHH0Qs0IVS/HwlFyPTHYHf3e/RbgxoDo8FZi6DIrebo+oib2Fmiy8G8sSLipNDUnJGnP1fa2FXe0NYWScOIUpxjcDTP2qT5Ir/RCorg7zjbR9eLn64Cod4LDqz99zr6jhlRY0+nRPD8mb3CTFb3w8ym0ERy0thvgm+WR9zUuG2Kl8xfdfEIoAtLtyTg4mOMuEnKRBANfoV1eEJ4/REQf0cpCdGTg0C+kJ7ZoLakd5Fc+li0mYjSqtH7oclrjND5sxoPuFgyrBYv1lwnOD75EPykE8S5IUZ22hmqt29gyVDInMwR3AyvSaMJ8E1SuIz1+tiGqDuEYED1xWeICdBDUkQBKTqt70oETfU7WpFLIrdBNbztKPIbdLbduvikhaQPDkO5LVZGfjwmo=
can't funelim do the same? what's the difference between funelim and functional induction?
Fact Div_Mod : forall x y,
x = S y * Div x (S y) + Mod x (S y).
Proof.
intros.
funelim (Div x (S y));
simp Mod; rewrite Heq; clear Heq;
simpl; lia.
Qed.
From: coq-club-request AT inria.fr <coq-club-request AT inria.fr> on behalf of Pierre Courtieu <pierre.courtieu AT gmail.com>
Sent: February 6, 2019 3:39 PM
To: Coq Club
Subject: Re: [Coq-Club] Equations 1.2beta is out!
Sent: February 6, 2019 3:39 PM
To: Coq Club
Subject: Re: [Coq-Club] Equations 1.2beta is out!
Equations is much more powerfull than Function, especially with
dependent types, but Function allows to use functional induction,
which makes proofs easier for students (no need to look for the right
induction principle + destructs done automatically). Equations should
allow for that in a future version of Coq.
Best
Pierre
From Coq Require Import Arith Lia.
Require Import Recdef.
Goal forall x y n : nat, y = S n -> S n <= x
-> x - S n < x.
Proof.
intros x y n H H0.
lia.
Qed.
Function Div (x y : nat) {wf lt x} : nat :=
match y with
| 0 => 0
| _ => if le_lt_dec y x then 1 + Div (x - y) y else 0
end.
Proof.
- intros x y n teq anonymous teq0.
clear teq0. (* lia does not like dependent hyps over its variables *)
lia.
- apply lt_wf.
Qed.
Function Mod (x y : nat) {wf lt x} : nat :=
match y with
| 0 => 0
| _ => if le_lt_dec y x then Mod (x - y) y else x
end.
Proof.
- intros x y n teq anonymous teq0.
clear teq0;lia.
- apply lt_wf.
Qed.
Fact Div_Mod2 x y :
x = S y * Div x (S y) + Mod x (S y) .
Proof.
remember (S y) as y'.
functional induction Div x y'.
- discriminate.
- rewrite Mod_equation.
rewrite e0 in *|-*.
specialize IHn with (1:=eq_refl).
clear e0.
lia.
- rewrite Mod_equation.
rewrite e0 in *|-*.
clear e0;lia.
Qed.
Le mer. 6 févr. 2019 à 16:31, Laurent Thery <Laurent.Thery AT inria.fr> a écrit :
>
>
> Or using the Proof with.
>
> Fact Div_Mod x y :
> x = S y * Div x (S y) + Mod x (S y).
> Proof with simp Div Mod in *; try lia.
> induction x as [x IH] using lt_wf_ind...
> destruct (le_lt_dec _ _) as [H|H]...
> assert (x - S y < x) as IH1%IH...
> Qed.
dependent types, but Function allows to use functional induction,
which makes proofs easier for students (no need to look for the right
induction principle + destructs done automatically). Equations should
allow for that in a future version of Coq.
Best
Pierre
From Coq Require Import Arith Lia.
Require Import Recdef.
Goal forall x y n : nat, y = S n -> S n <= x
-> x - S n < x.
Proof.
intros x y n H H0.
lia.
Qed.
Function Div (x y : nat) {wf lt x} : nat :=
match y with
| 0 => 0
| _ => if le_lt_dec y x then 1 + Div (x - y) y else 0
end.
Proof.
- intros x y n teq anonymous teq0.
clear teq0. (* lia does not like dependent hyps over its variables *)
lia.
- apply lt_wf.
Qed.
Function Mod (x y : nat) {wf lt x} : nat :=
match y with
| 0 => 0
| _ => if le_lt_dec y x then Mod (x - y) y else x
end.
Proof.
- intros x y n teq anonymous teq0.
clear teq0;lia.
- apply lt_wf.
Qed.
Fact Div_Mod2 x y :
x = S y * Div x (S y) + Mod x (S y) .
Proof.
remember (S y) as y'.
functional induction Div x y'.
- discriminate.
- rewrite Mod_equation.
rewrite e0 in *|-*.
specialize IHn with (1:=eq_refl).
clear e0.
lia.
- rewrite Mod_equation.
rewrite e0 in *|-*.
clear e0;lia.
Qed.
Le mer. 6 févr. 2019 à 16:31, Laurent Thery <Laurent.Thery AT inria.fr> a écrit :
>
>
> Or using the Proof with.
>
> Fact Div_Mod x y :
> x = S y * Div x (S y) + Mod x (S y).
> Proof with simp Div Mod in *; try lia.
> induction x as [x IH] using lt_wf_ind...
> destruct (le_lt_dec _ _) as [H|H]...
> assert (x - S y < x) as IH1%IH...
> Qed.
- Re: [Coq-Club] Equations 1.2beta is out!, Gert Smolka, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Laurent Thery, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Laurent Thery, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Pierre Courtieu, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Jason -Zhong Sheng- Hu, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Matthieu Sozeau, 02/07/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Pierre Courtieu, 02/11/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Matthieu Sozeau, 02/11/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Pierre Courtieu, 02/11/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Matthieu Sozeau, 02/07/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Jason -Zhong Sheng- Hu, 02/06/2019
- Re: [Coq-Club] Equations 1.2beta is out!, Pierre Courtieu, 02/06/2019
Archive powered by MHonArc 2.6.18.