coq-club AT inria.fr
Subject: The Coq mailing list
List archive
- From: Mandy Martino <tesleft AT hotmail.com>
- To: "coq-club AT inria.fr" <coq-club AT inria.fr>
- Subject: [Coq-Club] how to run this program to verify a simple function?
- Date: Sat, 23 Jan 2016 09:46:48 +0800
- Authentication-results: mail2-smtp-roc.national.inria.fr; spf=None smtp.pra=tesleft AT hotmail.com; spf=Pass smtp.mailfrom=tesleft AT hotmail.com; spf=None smtp.helo=postmaster AT BLU004-OMC1S10.hotmail.com
- Importance: Normal
- Ironport-phdr: 9a23:DAA9Th3nShBkBQHpsmDT+DRfVm0co7zxezQtwd8ZsegQKvad9pjvdHbS+e9qxAeQG96LtbQd07Sd6PCocFdDyKjCmUhKSIZLWR4BhJdetC0bK+nBN3fGKuX3ZTcxBsVIWQwt1Xi6NU9IBJS2PAWK8TWM5DIfUi/yKRBybrysXNWC0YLuj775oM2bSj4LrQT+SIs6FA+xowTVu5teqqpZAYF19CH0pGBVcf9d32JiKAHbtR/94sCt4MwrqHwI6Lpyv/JHBO/xeL19RrhFBhwnNXo07Yvlr1OLGQCI/z4XVngcuhtOGQnMqh/gCMTfqCz/48903iWLdej/V6w1XzPqu7tmUxvlhjsvNzkl9WjWjop7i6cN80HpnAB234OBONLdD/F5ZK6IJd4=
Hi ,
i follow
got error when run in coqtop
Error: The reference Z was not found in the current environment.
Inductive tree : Set :=
| Empty
| Node : tree -> Z -> tree -> tree.
Inductive In (x:Z) : tree -> Prop :=
| In_left : forall l r y, (In x l) -> (In x (Node l y r))
| In_right : forall l r y, (In x r) -> (In x (Node l y r))
| Is_root : forall l r, (In x (Node l x r)).
Definition is_empty (s:tree) : bool := match s with
| Empty => true
| _ => false end.
Theorem is_empty_correct :
forall s, (is_empty s)=true <-> (forall x, ~(In x s)).
Proof.
destruct s; simpl; intuition.
inversion_clear H0.
elim H with z; auto.
Qed.
Inductive order : Set := Lt | Eq | Gt.
Hypothesis compare : Z -> Z -> order.
Fixpoint mem (x:Z) (s:tree) {struct s} : bool := match s with
| Empty =>
false
| Node l y r => match compare x y with
| Lt => mem x l
| Eq => true
| Gt => mem x r
end
end.
Inductive bst : tree -> Prop :=
| bst_empty :
(bst Empty)
| bst_node :
forall x (l r : tree),
bst l -> bst r ->
(forall y, In y l -> y < x) ->
(forall y, In y r -> x < y) -> bst (Node l x r).
Theorem mem_correct :
forall x s, (bst s) -> (mem x s=true <-> In x s).
Hypothesis compare_spec :
forall x y, match compare x y with
| Lt => x<y
| Eq => x=y
| Gt => x>y
end.
generalize (compare_spec x z); destruct (compare x z).
Regards,
Martin
- [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, John Wiegley, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, John Wiegley, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, John Wiegley, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/24/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, Adam Chlipala, 01/24/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, John Wiegley, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- RE: [Coq-Club] how to run this program to verify a simple function?, Mandy Martino, 01/23/2016
- Re: [Coq-Club] how to run this program to verify a simple function?, John Wiegley, 01/23/2016
Archive powered by MHonArc 2.6.18.