1

Consider the following toy development:

Require Import Coq.Strings.String.

Inductive SingProp: Set :=
| Var: string -> SingProp
| plus: SingProp -> SingProp -> SingProp
| amp: SingProp -> SingProp -> SingProp.

Goal forall A B, A <> amp A B.
Proof.
  intros A. induction A.
  - intros B H. inversion H.
  - intros B H. inversion H.
  - intros B H. inversion H. apply (IHA1 _ H1).

Is this truly the most straightforward way to determine that this holds? Do I need to perform an induction every time I want to do something like this?

Carl Patenaude Poulin
  • 6,238
  • 5
  • 24
  • 46

1 Answers1

1

For types this simple, you could also define a size function that computes the height of the tree defining the type. Then A = amp A B would reduce to something like

size A = 1 + max (size A) (size B)

which you should be able to discharge with lia.

Arthur Azevedo De Amorim
  • 23,012
  • 3
  • 33
  • 39
  • 1
    The property that you are showing here is obvious to every confirmed user of Coq, for every inductive type that you can think of, but nobody ever invested the effort to build a general tool to prove it, I believe. This property is actually not that important, and the `size` trick mentioned by Arthur is usually enough for the rare cases where you really need it. – Yves Apr 10 '20 at 06:36