(* This file is just for reference , in order to show a posible use of the section mechanism. However it is not satisfactory, see at the end. --> better to work in V3_implicit_args.v or V4_lists_braces.v *) (* Using a section in order to avoid X *) Section listdef. Variable X:Type. Inductive list : Type := | nil : list | cons : X -> list -> list. Fixpoint app (u v: list) : list := match u with | nil => v | cons x u' => cons x (app u' v) end. Fixpoint length (u: list) : nat := match u with | nil => O | cons x u' => S (length u') end. Theorem length_morphism : forall u v, length (app u v) = length u + length v. Proof. intros u v. (* induction u as [ | x u' IHu']. *) (* the same with more basic mechanisms *) pattern u. (* simpl. *) apply list_ind. - reflexivity. - clear u. intros x u' IHu'. Admitted. Theorem nil_right_neutral : forall l, app l nil = l. Proof. Admitted. Theorem app_assoc : forall u v w, (app (app u v) w) = app u (app v w). Proof. (* only 1 induction on [u] is enough *) Admitted. (* naive reverse *) Fixpoint rev (l: list) : list := match l with | nil => nil | cons x l' => app (rev l') (cons x nil) end. (* A linear version *) (* Comment out and fill in *) (* Fixpoint lrev_aux ... Definition lrev := ... lrev_aux ... Theorem lrev_correct : forall l, lrev l = rev l. *) End listdef. (* However, unconvenient outside of the section: we are back to the version with explicit arguments *)