~ubuntu-branches/ubuntu/wily/coq-doc/wily

« back to all changes in this revision

Viewing changes to contrib/subtac/test/rec.v

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu, Stéphane Glondu, Samuel Mimram
  • Date: 2010-01-07 22:50:39 UTC
  • mfrom: (1.2.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20100107225039-n3cq82589u0qt0s2
Tags: 8.2pl1-1
[ Stéphane Glondu ]
* New upstream release (Closes: #563669)
  - remove patches
* Packaging overhaul:
  - use git, advertise it in Vcs-* fields of debian/control
  - use debhelper 7 and dh with override
  - use source format 3.0 (quilt)
* debian/control:
  - set Maintainer to d-o-m, set Uploaders to Sam and myself
  - add Homepage field
  - bump Standards-Version to 3.8.3
* Register PDF documentation into doc-base
* Add debian/watch
* Update debian/copyright

[ Samuel Mimram ]
* Change coq-doc's description to mention that it provides documentation in
  pdf format, not postscript, closes: #543545.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
Require Import Coq.Arith.Arith.
 
2
Require Import Lt.
 
3
Require Import Omega.
 
4
 
 
5
Axiom lt_ge_dec : forall x y : nat, { x < y } + { x >= y }.
 
6
(*Proof.
 
7
  intros.
 
8
  elim (le_lt_dec y x) ; intros ; auto with arith.
 
9
Defined.
 
10
*)
 
11
Require Import Coq.subtac.FixSub.
 
12
Require Import Wf_nat.
 
13
 
 
14
Lemma preda_lt_a : forall a, 0 < a -> pred a < a.
 
15
auto with arith.
 
16
Qed.
 
17
 
 
18
Program Fixpoint id_struct (a : nat) : nat :=
 
19
  match a with
 
20
  0 => 0
 
21
  | S n => S (id_struct n)
 
22
  end.
 
23
 
 
24
Check struct_rec.
 
25
 
 
26
  if (lt_ge_dec O a)
 
27
  then S (wfrec (pred a))
 
28
  else O.
 
29
 
 
30
Program Fixpoint wfrec (a : nat) { wf a lt } : nat :=
 
31
  if (lt_ge_dec O a)
 
32
  then S (wfrec (pred a))
 
33
  else O.
 
34
intros.
 
35
apply preda_lt_a ; auto.
 
36
 
 
37
Defined.
 
38
 
 
39
Extraction wfrec.
 
40
Extraction Inline proj1_sig.
 
41
Extract Inductive bool => "bool" [ "true" "false" ].
 
42
Extract Inductive sumbool => "bool" [ "true" "false" ].
 
43
Extract Inlined Constant lt_ge_dec => "<".
 
44
 
 
45
Extraction wfrec.
 
46
Extraction Inline lt_ge_dec le_lt_dec.
 
47
Extraction wfrec.
 
48
 
 
49
 
 
50
Program Fixpoint structrec (a : nat) { wf a lt } : nat :=
 
51
  match a with
 
52
   S n => S (structrec n)
 
53
   | 0 => 0
 
54
   end.
 
55
intros.
 
56
unfold n0.
 
57
omega.
 
58
Defined.
 
59
 
 
60
Print structrec.
 
61
Extraction structrec.
 
62
Extraction structrec.
 
63
 
 
64
Definition structrec_fun (a : nat) : nat := structrec a (lt_wf a).
 
65
Print structrec_fun.