A FOUNDATION FOR METAREASONING. PART I: THE PROOF THEORY