Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

4 Strong Induction Let us divide the natural numbers into four classes: those evenly divisible by 4 , those with remainder 1 , remainder 2

4 Strong Induction
Let us divide the natural numbers into four classes: those evenly divisible by 4, those with remainder 1, remainder 2, and remainder 3. We can write an inductive type for the first and third classes as follows
Inductive div4 : nat -> Prop :=
| div4_0 : div40
| div4_S : forall n, rem2 n -> div4(S (S n))
with rem2 : nat -> Prop :=
| rem2_S : forall n, div4 n -> rem2(S (S n)).
We will prove that these two types are disjoint,
Lemma prob4 : forall n, div4 n -> ~ rem2 n.
Strong induction is suggested for this problem, and remember that you can use the inversion tactic to unfold inductive definitions.
Use the template:
Require Import Arith.
Inductive acc : nat -> Prop := acc_k : forall k,(forall y, y < k -> acc y)-> acc k.
Theorem lt_wf : forall n, acc n.
Proof.
(induction n).
(apply acc_k).
(intros y H).
(inversion H).
(induction IHn).
clear H0.
(apply acc_k).
(intros y Hlt).
(apply acc_k).
(intros y0 Hlt0).
(apply acc_k).
(intros y1 Hlt1).
(apply H).
Require Import Arith.
(apply le_trans with (m := y0)).
exact Hlt1.
(apply le_trans with (m := y)).
(apply lt_le_weak).
exact Hlt0.
(apply le_S_n).
exact Hlt.
Qed.
Definition acc_then_Px :
forall {P : nat -> Prop}(n : nat),
(forall x,(forall y, y < x -> P y)-> P x)
-> acc n
-> P n.
Proof.
refine (fun P n f acc => acc_ind ____).
- intros k _ f'.
apply f.
exact f'.
- exact acc.
Defined.
Definition strong_nat_ind :
forall P : nat -> Prop,
(forall x,(forall y, y < x -> P y)-> P x)
-> forall x, P x.
Proof.
refine (fun P f x =>_).
refine (acc_then_Px _ f _).
apply lt_wf.
Defined.
Inductive div4 : nat -> Prop :=
| div4_0 : div40
| div4_S : forall n, rem2 n -> div4(S (S n))
with rem2 : nat -> Prop :=
| rem2_S : forall n, div4 n -> rem2(S (S n)).
Lemma prob4 : forall n, div4 n -> ~ rem2 n.
Proof.
Qed.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions

Question

What did they do? What did they say?

Answered: 1 week ago