### 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

Port a Coq lemma over Z to a similar lemma over nat

Coq fixpoint defintion numerated by natural numbers.(type of (n+1)'s type depends on (n)'s type)

`No more subgoals, but there are non-instantiated existential variables` in Coq proof language?

Simplify assumption

Apply partially instantiated lemma

Using reflexivity in Coq

High-speed calculation of Coq's theorems

Topological Definition of Continuous in Coq

Reference in Coq Lists library not found

Purpose of maximal vs non-maximal implicit arguments

Idris type system properties

How to destruct/generalize over Program's rewritten match statements

Show all axioms Coq

Product Type in Coq

Coq inductive definition for the entailment property

How to make sublists in Coq?