Require Import Arith. Open Scope bool_scope. Require Import List. Open Scope list_scope. Compute (fun (n:nat) => n+10) 3. Definition addx (x:nat) := (fun (y:nat) => x+y). Compute (addx 10) 5. Compute (addx 10). Compute addx 10 5. Definition addy (x:nat) (y:nat) := x+y. Check addx. Check addy. Compute addy 10 5. Compute addy 10. Compute map (addy 10) (1::2::3::4::nil). Check 3. Check nat. Check Set. Check Type. Check Type. Theorem map_length: forall (A:Type) (B:Type) (f: A -> B) (l: list A), length (map f l) = length l. Proof. intros. induction l. reflexivity. simpl. rewrite IHl. reflexivity. Qed. Check map_length. Check (map_length nat). Check (map_length nat bool (fun n => n <=? 3)). Check (map_length nat bool (fun n => n <=? 3) (1::2::3::nil)). (* !!!! Print map_length. Compute (map_length nat bool (fun n => n <=? 3) (1::2::3::nil)). *) Definition apply (A B:Type) (f: A -> B) (x:A) : B := f x. Check apply. Definition hasfixedpoint (A:Type) (f: A -> A) : Prop := exists (x:A), f x = x. Check hasfixedpoint. Compute hasfixedpoint nat (fun (n:nat) => n). Compute hasfixedpoint nat (fun (n:nat) => n+1). Theorem hfp_add0: hasfixedpoint nat (fun (n:nat) => n+0). Proof. exists 0. reflexivity. Qed.