TITLE: Program transformation as alternative for Hoare logic or temporal logic
QUESTION [6 upvotes]: When trying to prove something about a program, the known techniques are Hoare logic and temporal logics.
An alternative is to transform a program in a mathematical (logical) expression. So, rather that mathematics is used to prove some properties of the program, the program itself is a piece of mathematics.
Loops become transitive reflexive closures. Example, if one has a program that calculates a Fibonacci number. If the program keeps the last two numbers of the Fibonacci sequence in variables, then this be converted by taking the transitive reflexive closure of the relation P, that is true (and only true) for the following situation:
$$ P((x,\space y, \space z), \space (x+1, \space z, \space y+z)) $$
In the original program, the right value is chosen within the loop. In the transitive reflexive closure, the right value must be selected outside the closure (loop). The transformed program is more like a non-deterministic program.
The transformation of a program in a logical expression, can be done automatically.
Although, this is not rocket science, I can not find any reference for this approach. I am busy with writing an article, where this is a part of (it is not the main subject). But I want to refer to the right articles and look if there is interesting material.
Does someone has interesting references?
Many thanks,
Lucas
Edit: Given the comment of Andreas, some clarification. The goal is to make formal reasoning about the program possible. So, transforming the program in a declarative language is insufficient, because the declarative language may not have means to make conclusions about a program, although the language itself might precisely defined. I was thinking in transforming the program in a FOL + PA expression. After such transformation, formal (that is why I tagged with lo.logic) reasoning can be done about the program. As far to my knowledge, I haven't seen this approach (the methods are always more in the direction of Hoare and temporal logics), although it is not very complicated. In my question I didn't want to restrict to FOL + PA.

REPLY [4 votes]: Hoare logic and temporal logic might be "the only known techniques for proving programs correct" to you, but there are certainly others!
For example, and this list is not exhaustive:

equational reasoning about fixpoints, this works in languages like Haskell
properties of programs can be proved via denotational semantics, which in itself is a vast area including domain theory and game semantics, to name just two. 
for certain kinds of programs, for example for parametrically polymorphic ones, there are techniques that go under the name "relational parametricity"
you can use various logical interpretations to get correctness of programs:

a program extracted as a realizer via the realizability interpretation of logic automatically satisfies a certain specification
with tools such as Coq you can use type theory to write programs as proofs, or construct programs and prove them correct all at once
there are other ways of extracting programs from logical statements, one family of which are variants of Gödel's Dialectica interpretation that extract programs from classical logic.


Now, regarding your specific question. I think you should look at realizability, type theory, and extraction of programs from proofs. All of these are "logical" methods for developing correct programs, or proving them correct. Some randomly chosen starting points:

start with something fun and surprising, perhaps Paulo Oliva's tutorial on Programs from classical proofs via Gödel's dialectica interpretation
an accessible paper on realizability interpretation which uses logical methods in computable analysis might be Ulrich Berger's Realisability for Induction and Coinduction with Applications to Constructive Analysis 
if you want to use computers to actually show correctness of programs, you could learn Coq and then proceed to Ynot (Hoare logic on steorids) or go straight to Adam Chipala's Certified Programming with Dependent Types.
cool people use Agda instead of Coq.
if you are first-order logic sort of person, you might find Minlog more palatable than Coq and Agda, as it does not throw type theory in your face.

See you in two years.