简体   繁体   中英

How to add “assumed true” statements in Coq

I tried to add a definition of a natural number in CoqIDE.

Inductive nat : Set :=
  | O: nat
  | S: nat -> nat.

But I couldn't add this as "assumed true":

forall (n m: nat, S n = S m -> n = m).

How do I add this?

I'm not completely clear on what you want to do, but your formula is not syntactically correct. I believe you meant forall (nm: nat), S n = S m -> n = m (note the parenthesis' placement).

Your statement is actually provable, no need to assume it:

Lemma S_inj : forall (n m: nat), S n = S m -> n = m.
Proof. intros n m [=]. assumption. Qed.

The [=] intro pattern expresses the built-in injectivity of the S constructor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM