1. A compound of the formula    wherein R1 and R2 are hydrogen or taken together are =NR9; R3 is -CO2R6, -C(O)R6, -CONR6R6, -CH2OR7 or -CH2SR7; R4 is a group of formula:   or R4 is hydrogen, alkyl, cycloalkyl, or cycloalkylalkyl; R5 is alkyl, alkenyl, optionally substituted aryl or optionally substituted heteroaryl; R6 is hydrogen or lower alkyl; R7 is hydrogen, lower alkyl, lower acyl, aroyl or heteroaryl; R8 is hydrogen or lower alkyl; R9 is R10O2C-, R10O-, HO-, cyano, R10CO-, HCO-, lower alkyl, nitro, or y<1>y<2>N-, wherein R10 is optionally substituted alkyl, or optionally heteroaralkyl, and wherein y<1> and y<2> are independently hydrogen or alkyl; A and B are hydrogen or taken together are a bond; Ar is optionally substituted aryl or optionally substituted heteroaryl; and n is 0, 1 or 2; or a pharmaceutically acceptable salt thereof, an N-oxide thereof, a hydrate thereof or a solvate thereof.  2. The compound of claim 1, wherein R1 and R2 taken together are =NH. 3. The compound of claim 2, wherein R1 and R2 taken together are =NH and form an aminoiminomethyl on the phenyl moiety that is in the meta-position to the position of attachment of the phenyl moiety to the propyl moiety. 4. The compound of claim 1, wherein R3 is -CO2R6, -CH2OR7 or -CH2SR7; 5. The compound of claim 4, wherein R3 is -CO2R6 and R6 is lower alkyl. 6. The compound of claim 4, wherein R3 is -CH2OR7 or -CH2SR7 and R7 is hydrogen or lower alkyl.  7. The compound of claim 1, wherein n is 1. 8. The compound of claim 1, wherein Ar is optionally substituted aryl. 9. The compound of claim 1, wherein Ar is phenyl. 10. The compound of claim 1, wherein R5 is optionally substituted phenyl, optionally substituted biphenyl, optionally substituted naphthyl, or optionally substituted heterobiphenyl. 11. A compound according to claim 1 which is:                         12. A pharmaceutical composition characterised in that it comprises a pharmaceutically acceptable amount of the compound according to claim 1 and a pharmaceutically acceptable carrier. 13. A method for treating a disease state capable of being modulated by inhibiting production of Factor Xa to a patient suffering from said disease state, characterised in that an effective amount of the compound according to claim 1 is administered to the patient. 14. A method for inhibiting production of thrombin, characterised in that it comprises adding of the compound of claim 1 to a composition, comprising Factor Xa. 15. A method for treating of venous and arterial thrombosis, characterised in that it comprises administering to the patient in need the pharmaceutically effective amount of the compound of claim 1 or a pharmaceutically acceptable salt thereof. 16. A method for treating of venous and arterial thrombosis, characterised in that it comprises administering to the patient in need the pharmaceutically effective amount of the compound of claim 1 or a pharmaceutically acceptable salt thereof in combination with heparin or with heparin with low molecular weight. 17. A method for treating of restenosis, characterised in that it comprises administering to the patient in need the pharmaceutically effective amount of the compound of claim 1 or a pharmaceutically acceptable salt thereof. 18. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 19. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 20. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 21. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 22. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 23. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 24. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof. 25. A compound of claim 11, which is   or a pharmaceutically acceptable salt thereof.