Class DS::Argument
In: AS.dat.rb
Parent: Object

An argument instance A, say, has attributes toprule, dos, substitution, and subargs

toprule:a Rule instantiated to @substitution.
dos:Float
substitution:a Substitution applied to A
subargs:instance of ArgumentList. ArgumentList is a descendant of Array.

Every instance of ArgumentList is a list of instances of class Argument. These instances are A’s immediate sub-arguments.

The first immediate sub-argument A’ of A is always an argument with a conclusion that is equal to the name of the rule that is applied last. (The argument’s top rule.)

         /      top rule is "r1: a,b,c -> d"          d
        /                                             |
       /                            |-----------|-----------|-----------|
      /           /                 r1          a           b           c
   A: \      A': /                  |           |           |           |
       \         \      |-------|-------|      ...         ...      |-------|-------|
        \         \     Argument voor r1                            Argument voor c
         \         \
         ...       ...

Attack and rebuttal are defined as follows.

  • Argument B is an attacker of argument A if B rebuts a sub-argument A’ of A.
  • Argument B rebuts argument C if B is a counter-argument of C and B is stronger than C.
  • Argument B and C are counter-arguments if they have opposite conclusions.

The notion of an undercutter is a derived concept which means that it is not crucial to the program. It can be defined as follows.

  • Argument B is an undercutter of argument A if B rebuts the A’s first immediate sub-argument

Methods

Attributes

dos  [RW] 
level  [RW] 
owner  [RW] 
subargs  [RW] 
substitution  [RW] 
toprule  [RW] 

Public Class methods

All arguments most be initialized. No defaults.

[Source]

     # File AS.dat.rb, line 498
498:    def initialize(toprule, dos, substitution, subargs, party, level)
499: 
500:       # deb.unif. $out += "#{conclusion.inspect} strength is #{dos}\n"
501:       @toprule       = toprule
502:       @dos           = dos
503:       @substitution  = substitution
504:       @subargs       = subargs
505:       @name          = @@counter+=1
506:       @owner         = party
507:       @level         = level
508: 
509:       if level.zero? # draw arg if top level
510:          $graph.print "   subgraph cluster\#{@name} {\n      fillcolor = \"\#{party=~/PRO/?\"#DDEEDD\":\"#EEDDDD\"}\";\n      color = \"\#{party=~/PRO/?\"#00FF00\":\"#FF0000\"}\";\n      style = \"filled\";\n\n"
511:       draw_arg
512:          $graph.print "   }\n"
513: 
514:       end
515: 
516:    end

Public Instance methods

Iterate through all attackers.

[Source]

     # File AS.dat.rb, line 625
625:    def attackers(party=pro, level=0)
626:       subarguments(party, level) { |sa|
627:          level.l "#{party}: examining #{sa.name} #{sa.linenr.html_linenr}."
628:          sa.rebutters(party, level) { |int|
629:             yield int
630:          }
631:       }
632:    end

For two existing arguments self and victim, return true iff self attacks victim.

[Source]

     # File AS.dat.rb, line 636
636:    def attacks?(victim)
637:       # This cannot be done with Ruby's Array::all?, because
638:       # Argument::subarguments is an iterator hence expects a block.
639:       victim.subarguments { |sa|
640:          return true if is_a_rebutter_of?(sa)
641:       }
642:       false
643:    end

Consequent of the toprule attribute. The top rule is the Rule as found in the KnowledgeBase, instantiated to the Argument’s Substitution.

[Source]

     # File AS.dat.rb, line 559
559:    def conclusion
560:       @toprule.consequent
561:    end

Iterate through all counter-arguments.

[Source]

     # File AS.dat.rb, line 667
667:    def counterarguments(party=pro, level=0)
668:       conclusion.negation.argument(0.0, party, level ) { |arg|
669:          yield arg
670:       }
671:    end

[Source]

     # File AS.dat.rb, line 528
528:    def draw_arg
529:       $graph.print "      \#{object_id} [label=\"\#{conclusion.inspect}\"]\n"
530:       if @subargs[0] then
531:          $graph.print "      \#{toprule.object_id} [label=\"\#{toprule.inspect}\",shape=\"box\"]\n      \#{toprule.object_id} -> \#{object_id} [color=green]\n      \#{@subargs[0].object_id} -> \#{toprule.object_id} [color=\"#666666\",arrowhead=none,style=\"dashed,setlinewidth(10)\",weight=8]\n"
532:          if @subargs[1..-1]
533:             @subargs[1..-1].each { |sa|
534:                $graph.print "      \#{sa.object_id} -> \#{object_id}\n"
535:             }
536:          end
537:       end
538: 
539:       if @subargs then
540:          @subargs.each { |sa| sa.draw_arg }
541:       end
542: 
543:    end

Returns full html representation as a String.

[Source]

     # File AS.dat.rb, line 584
584:    def html(level=0, indent=0, with_subst=true)
585:       x = []
586:       x << "\n" if indent.zero? && !@subargs.empty? # i.e., complex main argument
587:       # Getting indentation right is horrible.  Currently,
588:       # ' '*20 is for covering prefix "32.   314 dat PRO: "
589:       # '     '*level is for indentation admissible, and
590:       # " "*indent is for indentation argument
591:       #
592:       # I.e., indent every argument that is either sub-argument or complex
593:       x << " "*18+"     "*level+" "*indent unless indent.zero? && @subargs.empty?
594:       x << conclusion.html
595:       x << @dos.color('support') if @dos<1.0
596:       x << "&larr;" unless @subargs.empty? # &laquo; of &larr;
597:       x << @toprule.strength.html if !@subargs.empty? && @toprule.strength < 1.0
598:       x << @substitution.html if with_subst && !@substitution.empty?
599:       x[-1] += "." if is_atomic?
600:       x[-1] += "\n"
601:       @subargs.each_index { |i|
602:          # skip first sub-argument if it is a factual arg.
603:          next if i.zero? && @subargs[i].is_a_factual_argument?
604:          x << @subargs[i].html(level, indent+3, with_subst=true)
605:       }
606:       x.join(' ')
607:    end

Returns true if argument is atomic and deductive.

[Source]

     # File AS.dat.rb, line 579
579:    def is_a_factual_argument?
580:       is_atomic? && is_proof?
581:    end

For two existing arguments self and victim, return true iff self rebuts victim.

[Source]

     # File AS.dat.rb, line 661
661:    def is_a_rebutter_of?(victim)
662:       conclusion.negation.equal_modulo_variables? victim.conclusion and
663:       self.is_as_strong_as?(victim)
664:    end

For two existing arguments self and victim, return true iff self is as strong as victim.

[Source]

     # File AS.dat.rb, line 675
675:    def is_as_strong_as?(victim)
676:       # 0.l "#{self.name} (#{self.dos}) >=? #{victim.name} (#{victim.dos})"
677:       self.dos >= victim.dos
678:    end

Returns true if argument has no sub-arguments.

[Source]

     # File AS.dat.rb, line 569
569:    def is_atomic?
570:       subargs.empty?
571:    end

Returns true if argument has maximum support.

[Source]

     # File AS.dat.rb, line 574
574:    def is_proof?
575:       @dos==1.0
576:    end

Html representation of arguments’s name.

[Source]

     # File AS.dat.rb, line 564
564:    def name
565:       'Arg'.color('argument')+@name.to_s.color('argno')
566:    end

Iterate through all rebutters.

[Source]

     # File AS.dat.rb, line 646
646:    def rebutters(party=pro, level=0)
647:       counterarguments(party, level) { |cnt|
648:          if strong_enough = cnt.is_as_strong_as?(self)
649:       $graph.print "   \#{cnt.object_id} -> \#{self.object_id} [color=\"red\",arrowhead=\"dot\"]\n"
650:          end
651:          level.l "#{party}: #{cnt.name} #{strong_enough  ?'strong enough':'too weak'} to interfere with #{self.name}"
652:          yield cnt if strong_enough
653:       }
654:    end

Yield all (proper and improper) sub-arguments. E.g., if

  A <- B <- C
       D

is an argument then A <- (B <- C), D and B <- C and C and D are all sub-arguments of A <- (B <- C), D. This includes all arguments for intermediary rules.

[Source]

     # File AS.dat.rb, line 615
615:    def subarguments(party=pro, level=0)
616:       yield self
617:       @subargs.each { |sa|
618:          sa.subarguments { |sa_deep|
619:             yield sa_deep
620:          }
621:       }
622:    end

[Validate]