Ich versuche zu beweisen, dass die Anwendung einer leeren Substitution auf einen Begriff gleich dem gegebenen Begriff ist. Hier ist der Code:Nachweis der Anwendung einer Substitution auf einen Begriff
Require Import Coq.Strings.String.
Require Import Coq.Lists.List.
Require Import Coq.Arith.EqNat.
Require Import Recdef.
Require Import Omega.
Import ListNotations.
Set Implicit Arguments.
Inductive Term : Type :=
| Var : nat -> Term
| Fun : string -> list Term -> Term.
Definition Subst : Type := list (nat*Term).
Definition maybe{X Y: Type} (x : X) (f : Y -> X) (o : option Y): X :=
match o with
|None => x
|Some a => f a
end.
Fixpoint lookup {A B : Type} (eqA : A -> A -> bool) (kvs : list (A * B)) (k : A) : option B :=
match kvs with
|[] => None
|(x,y) :: xs => if eqA k x then Some y else lookup eqA xs k
end.
ich Beweis versuche einige Eigenschaften dieser Funktion.
Fixpoint apply (s : Subst) (t : Term) : Term :=
match t with
| Var x => maybe (Var x) id (lookup beq_nat s x)
| Fun f ts => Fun f (map (apply s) ts)
end.
Lemma empty_apply_on_term:
forall t, apply [] t = t.
Proof.
intros.
induction t.
reflexivity.
Ich bin nach der Reflexivität fest. Ich wollte Induktion auf der Liste machen, aber wenn ich das tue, würde ich in einer Schleife stecken bleiben. Ich werde jede Hilfe zu schätzen wissen.