Metamath Proof Explorer


Theorem algrf

Description: An algorithm is a step function F : S --> S on a state space S . An algorithm acts on an initial state A e. S by iteratively applying F to give A , ( FA ) , ( F( FA ) ) and so on. An algorithm is said to halt if a fixed point of F is reached after a finite number of iterations.

The algorithm iterator R : NN0 --> S "runs" the algorithm F so that ( Rk ) is the state after k iterations of F on the initial state A .

Domain and codomain of the algorithm iterator R . (Contributed by Paul Chapman, 31-Mar-2011) (Revised by Mario Carneiro, 28-May-2014)

Ref Expression
Hypotheses algrf.1 Z = M
algrf.2 R = seq M F 1 st Z × A
algrf.3 φ M
algrf.4 φ A S
algrf.5 φ F : S S
Assertion algrf φ R : Z S

Proof

Step Hyp Ref Expression
1 algrf.1 Z = M
2 algrf.2 R = seq M F 1 st Z × A
3 algrf.3 φ M
4 algrf.4 φ A S
5 algrf.5 φ F : S S
6 fvconst2g A S x Z Z × A x = A
7 4 6 sylan φ x Z Z × A x = A
8 4 adantr φ x Z A S
9 7 8 eqeltrd φ x Z Z × A x S
10 vex x V
11 vex y V
12 10 11 algrflem x F 1 st y = F x
13 simpl x S y S x S
14 ffvelrn F : S S x S F x S
15 5 13 14 syl2an φ x S y S F x S
16 12 15 eqeltrid φ x S y S x F 1 st y S
17 1 3 9 16 seqf φ seq M F 1 st Z × A : Z S
18 2 feq1i R : Z S seq M F 1 st Z × A : Z S
19 17 18 sylibr φ R : Z S