### coq

#### Prove that a sequence of steps terminates

I have a small system that rewrites lambda terms. It has the usual (three) deterministic call-by-value rewrite rules. I have not listed them here. The rewrites are modelled as Steps from one Term to another. I have also the StarStep relation between reachable terms, where the latter can be produced from the first by zero or more rewrite steps. I now want to show that the rewrites terminate (either with a value, or stuck). I have stripped out the details, because I don't think they matter here, but I can add more details if needed. Here is the code (or here in CollaCoq in the browser): Variable Term: Type. Variable Step: Term -> Term -> Prop. Inductive StarStep: Term -> Term -> Prop := | StepNone : forall t, StarStep t t | StepOne : forall t t', Step t t' -> forall t'', StarStep t' t'' -> StarStep t t''. Goal forall t : Term, ~ (forall t', StarStep t t' -> exists t'', Step t' t'') -> exists t', StarStep t t' /\ forall t'', ~ Step t' t''. So I want to show IF it is NOT the case that "from all reachable states it is possible another step" THEN there exists a state t' that is reachable from t such that it is not possible to take a step from it. I am stuck on how to proceed. Do I need more info, i.e. induction or destructing (= case analysis of) t? And how can I use the info in the hypothesis when it is negated? EDIT: Here are more details about Term and Step

I believe this is an instance of classical reasoning. The statement resembles the following proposition, which is not provable in the constructive setting: Goal forall (A : Type) (P : A -> Prop), ~ (forall x, P x) -> exists x, ~ P x. because the knowledge that "it is not true that forall ..." doesn't yield an object which you need to prove the existence of something. Here is a possible solution using the laws of classical logic: Require Import Coq.Logic.Classical_Pred_Type. Require Import Coq.Logic.Classical_Prop. Goal forall t : Term, ~ (forall t', StarStep t t' -> exists t'', Step t' t'') -> exists t', StarStep t t' /\ forall t'', ~ Step t' t''. Proof. intros t H. apply not_all_ex_not in H. destruct H as [tt H]. apply imply_to_and in H. firstorder. Qed. Actually, we don't even need to know anything about StarStep, because the following abstract version of the previous proposition is valid in classical logic (the proof remains the same): Goal forall (A : Type) (P Q : A -> Prop), ~ (forall s, Q s -> exists t, P t) -> exists s, Q s /\ forall t, ~ P t.

### Related Links

How to use matched case and variable equivalence in coq

Proof with false hypothesis in Isabelle/HOL Isar

Is there a convention for the order of applying ssreflect tactic/taticals?

How to systematically normalize inequalities to < (lt) and <= (le) in Coq?

Inductive subset of an inductive set in Coq

How to find the source file for an identifier in Coq

Coq “Unknown interpretation for notation” error

How to switch the current goal in Coq?

Reasoning about lists in Coq

what does the curly braces {} do in ssreflect rewrite

How to define unspecified constants in Coq

How to automatically prove simple equality of real numbers in Coq?

How to simplify real number terms in Coq?

How can I prove that (eqb x y) means x = y

What's the difference between `Reals` and `Coq.Reals.*` in Coq?

when is the `:` (colon) in necessary in ssreflect/Coq?