Acme-HaltingProblem
view release on metacpan or search on metacpan
HaltingProblem.pm view on Meta::CPAN
}
sub analyse {
my $self = shift;
eval { $self->{Machine}->(@{ $self->{Input} }); };
return 1;
}
=head1 NAME
Acme::HaltingProblem - A program to decide whether a given program halts
=head1 SYNOPSIS
use Acme::HaltingProblem;
my $problem = new Acme::HaltingProblem(
Machine => sub { ... },
Input => [ ... ],
);
my $solution = $problem->solve();
=head1 DESCRIPTION
The Halting Problem is one of the hardest problems in computing. The
problem, approximately stated, is thus:
Given an arbitrary Turing Machine T and input for that turing
machine D, decide whether the computation T(D) will terminate.
=over 4
=item new Acme::HaltingProblem(...)
Construct a new instance of the halting problem where the Machine is
given as an arbitrary subref, and the Input is a reference to a list
of arguments.
=item $problem->analyse()
NAME
Acme::HaltingProblem - A program to decide whether a given program halts
SYNOPSIS
use Acme::HaltingProblem;
my $problem = new Acme::HaltingProblem(
Machine => sub { ... },
Input => [ ... ],
);
my $solution = $problem->solve();
DESCRIPTION
The Halting Problem is one of the hardest problems in computing. The
problem, approximately stated, is thus:
Given an arbitrary Turing Machine T and input for that turing
machine D, decide whether the computation T(D) will terminate.
new Acme::HaltingProblem(...)
Construct a new instance of the halting problem where the Machine is
given as an arbitrary subref, and the Input is a reference to a list
of arguments.
$problem->analyse()
Analyse the instance of the halting problem. If it halts, the method
will return 1. Otherwise, it will not return 1.
( run in 0.741 second using v1.01-cache-2.11-cpan-4505f990765 )