-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.pl
executable file
·99 lines (86 loc) · 3.15 KB
/
main.pl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/bin/perl
=head Lincense
/* -*- Mode: Perl */
/*
* main.pl
* Copyright (C) 2014 Barajas D. Paul <[email protected]>
*
* RegExpert-System is free software: you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* RegExpert-System is distributed in the hope that it will be useful, but
* WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.";
*/
=head1 NAME
main.pl - Main menu interface
=head1 VERSION
VERSION 0.001
=head1 DESCRIPTION
RegExper-system based In propositional logic, modus ponendo ponens,
It attendant to process,analyze and verified each Inference rule to get correctly its conclusion and obtain a successful result.
In this case, you will be able to select a method to conclude that are:
-Forward Chaing.
-Backward Chaining.
Addition Fuction:
It also provide a table of logical equivalences to validate inferences rules.
to enable this functionality, you will have to pass a argument "1" in the command line as the first parameter, at this moment it should be able to see the the table of logical from each inference rule.
=cut
use warnings;
use strict;
no warnings 'experimental::smartmatch';
use Exporter;
use feature 'switch';
use Data::Dumper;
use InferenceMotor;
use Conclusion;
use Compiler;
use Common_definitions;
our @ISA = qw(Exporter);
$ENV{SHOW_TABLES}=0;
my $choose_method;
my ($get_true_table)= @ARGV;
$ENV{SHOW_TABLES}=1 if ($get_true_table);
print "------------------------------------>RegExpert-System<-------------------------------------\n\n\n";
my $Antecedents=&ReadData();
&CompileRules;
#print Dumper($Antecedents);
#print Dumper($SortKeys);
#print Dumper($IntConclusions);
print "What method would you like to use to process the inference rules?\n";
print "A-> Forward Chaining\n";
print "B-> Backward Chaining\n";
chomp ($choose_method = <STDIN>);
given ($choose_method){
when($_ =~ /a/i){
foreach my $atoms (@ArrayRules){
my $count=0;
foreach my $antecedent_value (@$atoms){
next if (scalar(@$atoms)-1 eq $count);
if(ref($antecedent_value) eq "ARRAY"){
map{&Interface_rule($_,$Antecedents)}@{$antecedent_value};
}else{
&Interface_rule($antecedent_value,$Antecedents);
}
$count++;
}
}
}when($_ =~ /b/i){
$ENV{INFERENCE}=1;
my ($entry_Value);
print "Select a hypothesis that you want to conclude: \n";
my $conclusion=&Common_definitions::get_conclusions();
foreach (keys %$conclusion){
print "$_ -> $conclusion->{$_}\n";
}
chomp ($entry_Value = <STDIN>);
&validateHypothesis($entry_Value,$Antecedents);
}
default { print "Nothing to do here\n";};
}