Software Index
Linux Software Programming  


download download home home   report broken
important software information
company name:
Mark Summerfield
license: Freeware
minimum requirements:
functional limitations:
Math::Logic description

Math::Logic is a Perl module that provides pure 2, 3 or multi-value logic.


# 1 0 -1 'TRUE' 'FALSE' 'UNDEF'

use Math::Logic ':NUM' ; # $TRUE $FALSE $UNDEF -- what you normally want

use Math::Logic ':ALL' ; # All the constants

use Math::Logic ':STR' ; # $STR_TRUE $STR_FALSE $STR_UNDEF

# 2-degree logic
my $true = Math::Logic->new( -value => $TRUE, -degree => 2 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 2 ) ;
my $x = Math::Logic->new_from_string( 'TRUE,2' ) ;

print "true" if $true ;

# 3-degree logic (non-propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3 ) ;
my $x = Math::Logic->new_from_string( 'FALSE,3' ) ;

print "true" if ( $true | $undef ) == $TRUE ;

# 3-degree logic (propagating)
my $true = Math::Logic->new( -value => $TRUE, -degree => 3, -propagate => 1 ) ;
my $false = Math::Logic->new( -value => $FALSE, -degree => 3, -propagate => 1 ) ;
my $undef = Math::Logic->new( -value => $UNDEF, -degree => 3, -propagate => 1 ) ;
my $x = Math::Logic->new_from_string( '( UNDEF, 3, -propagate )' ) ;

print "undef" if ( $true | $undef ) == $UNDEF ;

# multi-degree logic
my $True = 100 ; # Define our own true
my $False = $FALSE ;
my $true = Math::Logic->new( -value => $True, -degree => $True ) ;
my $very = Math::Logic->new( -value => 67, -degree => $True ) ;
my $fairly = Math::Logic->new( -value => 33, -degree => $True ) ;
my $false = Math::Logic->new( -value => $False, -degree => $True ) ;
my $x = Math::Logic->new_from_string( "25,$True" ) ;

print "maybe" if ( $very | $fairly ) > 50 ;

# We can have arbitrarily complex expressions; the result is a Math::Logic
# object; all arguments must be Math::Logic objects or things which can be
# promoted into such and must all be compatible. The outcome depends on
# which kind of logic is being used.
my $xor = ( $x | $y ) & ( ! ( $x & $y ) ) ;
# This is identical to:
my $xor = $x ^ $y ;

Perl's built-in logical operators, and, or, xor and not support 2-value logic. This means that they always produce a result which is either true or false. In fact perl sometimes returns 0 and sometimes returns undef for false depending on the operator and the order of the arguments. For "true" Perl generally returns the first value that evaluated to true which turns out to be extremely useful in practice. Given the choice Perl's built-in logical operators are to be preferred -- but when you really want pure 2-degree logic or 3-degree logic or multi-degree logic they are available through this module.

The only 2-degree logic values are 1 (TRUE) and 0 (FALSE).

The only 3-degree logic values are 1 (TRUE), 0 (FALSE) and -1 (UNDEF). Note that UNDEF is -1 not undef!

The only multi-degree logic values are 0 (FALSE)..-degree -- the value of TRUE is equal to the degree, usually 100.

The -degree is the maximum value (except for 2 and 3-degree logic); i.e. logic of n-degree is n+1-value logic, e.g. 100-degree logic has 101 values, 0..100.

Although some useful constants may be exported, this is an object module and the results of logical comparisons are Math::Logic objects.. . C++, Qt, Python, and PyQt, training and consultancy

Similar software
#Calculation Component (Popularity: ) : #Calculation component is a powerful calculation engine for your applications. This ActiveX component integrates expression parsing and evaluation. Generally speaking, #Calculation is very useful in two main areas: first, when a formula has to be defined and evaluated at runtime ...
Math::Symbolic::Operator (Popularity: ) : Math::Symbolic::Operator is a Perl module with operators in symbolic calculations.


use Math::Symbolic::Operator;

my $sum = Math::Symbolic::Operator->new('+', $term1, $term2);

# or:
my $division =
type => B_DIVISON,
operands => [$term1, $term2],

my $derivative =
type ...

Math::Symbolic::Constant (Popularity: ) : Math::Symbolic::Constant is a Perl module that offers constants in symbolic calculations.


use Math::Symbolic::Constant;
my $const = Math::Symbolic::Constant->new(25);
my $zero = Math::Symbolic::Constant->zero();
my $one = Math::Symbolic::Constant->one();
my $euler = Math::Symbolic::Constant->euler();
# e = 2.718281828...

This module implements numeric constants for Math::Symbolic trees.. ...

Math::Symbolic::Custom::Transformation (Popularity: ) : Math::Symbolic::Custom::Transformation is a Perl extension to the Math::Symbolic module. You're assumed to be remotely familiar with that module throughout the documentation.

This package implements transformations of Math::Symbolic trees using Math::Symbolic trees. I'll try to explain what this means in the following ...

Math::GMPq (Popularity: ) : Math::GMPq is a bigrational Perl module utilising the Gnu MP (GMP) library. Basically this module simply wraps all of the 'mpq' (rational number) functions provided by that library. The documentation below extensively plagiarises the GMP documentation (which can be found ...
Math::Symbolic::Variable (Popularity: ) : Math::Symbolic::Variable is a Perl module which implements variables in symbolic calculations.


use Math::Symbolic::Variable;

my $var1 = Math::Symbolic::Variable->new('name');

my $var2 = Math::Symbolic::Variable->new('x', 2);

my $var3 =
name => 'variable',
value => 1,

This class implements variables for ...

Math::MPC (Popularity: ) : A multiple precision complex number module utilising the MPC library. Basically, this module simply wraps the 'mpc' complex number functions provided by that library. Operator overloading is also available.

Math::MPC is a Perl module that needs the MPC, MPFR and GMP ...

zfuncs (Popularity: ) : The zfuncs package contains various utility programs that were used in building the other applications on the website. These programs are also included with the other applications. This package includes documentation that will make it easier to use these ...
Array::Window (Popularity: ) : Many applications require that a large set of results be broken down into a smaller set of 'windows', or 'pages' in web language. Array::Window is a Perl module that implements an algorithm specifically for dealing with these windows. It is ...
CGI::Panel (Popularity: ) : CGI::Panel is a Perl module that allows applications to be built out of simple object-based components. It'll handle the state of your data and objects so you can write a web application just like a desktop app. You can forget ...
myAmavis (Popularity: ) : myAmavis is a web frontend for amavisd-new.

Here are some key features of "myAmavis":

- multiple configuration policies per user possible, easy switching of used policy per recipient address.
- separate configuration settings for virus scanning, spam checking, banned files checking and bad ...

mid (Popularity: ) : mid is a tabbed dictionary browser using the language dictionary resources of the Internet.

mid stands for Mozilla Internet Dictionary.

You can start Mid from your Firefox's Tools menu.

You can also add a toolbar button for easier access: After installing and restarting ...

User reviews

Write a review:
1 2 3 4 5 6 7 8 9 10
1=poor 10=excellent
Write review*
Your name*
  (Comments are moderated, and will not appear on this site until the editor has approved them)

Rate me
supported os's
downloads 6
version 1.19
size in Kb 10
user rating 0/10
our rating 0 Stars
share info
Recommend Math::Logic
Report spyware
New Software
Popular Software
Latest Reviews