PREFIX math: <http://www.w3.org/2000/10/swap/math#>
PREFIX log: <http://www.w3.org/2000/10/swap/log#>
PREFIX e: <http://eulersharp.sourceforge.net/2003/03swap/log-rules#>
PREFIX fl: <http://eulersharp.sourceforge.net/2003/03swap/fl-rules#>
PREFIX : <http://eulersharp.sourceforge.net/2006/02swap/med#>
PREFIX r: <http://www.w3.org/2000/10/swap/reason#>

[] a r:Proof, r:Conjunction;
  r:component <#lemma1>;
  r:component <#lemma2>;
  r:gives {
    :Joe :isPrescribed :aspirinLowDose.
    :Joe :isPrescribed :betaBlocker.
  }.

<#lemma1> a r:Inference;
  r:gives {
    :Joe :isPrescribed :aspirinLowDose.
  };
  r:evidence (
    <#lemma3>
  );
  r:rule <#lemma4>.

<#lemma2> a r:Inference;
  r:gives {
    :Joe :isPrescribed :betaBlocker.
  };
  r:evidence (
    <#lemma5>
  );
  r:rule <#lemma4>.

<#lemma3> a r:Inference;
  r:gives {
    :Joe :isPrescribed :aspirinLowDose.
  };
  r:evidence (
    <#lemma6>
    <#lemma7>
    [ a r:Fact; r:gives {0.9 math:greaterThan 0.7}]
    [ a r:Fact; r:gives {((<http://josd.github.io/eye/reasoning/medic/medic.n3>) 1) e:findall (_:sk_0 {:aspirinLowDose :excludedFor _:sk_0} (:ActivePepticUlcerDisease :AllergyForAspirin))}]
    [ a r:Fact; r:gives {((<http://josd.github.io/eye/reasoning/medic/medic.n3>) 1) e:findall (_:sk_0 {:aspirinLowDose :excludedFor _:sk_0.
     (:Joe _:sk_0) fl:mu _:sk_1.
     _:sk_1 math:notGreaterThan 0.01} (:ActivePepticUlcerDisease :AllergyForAspirin))}]
  );
  r:rule <#lemma8>.

<#lemma4> a r:Extraction;
  r:gives {
    {?x_0_1 :isPrescribed ?x_1_1} => {?x_0_1 :isPrescribed ?x_1_1}.
  };
  r:because [ a r:Parsing; r:source <http://josd.github.io/eye/reasoning/medic/medicF.n3>].

<#lemma5> a r:Inference;
  r:gives {
    :Joe :isPrescribed :betaBlocker.
  };
  r:evidence (
    <#lemma9>
    <#lemma7>
    [ a r:Fact; r:gives {0.9 math:greaterThan 0.7}]
    [ a r:Fact; r:gives {((<http://josd.github.io/eye/reasoning/medic/medic.n3>) 1) e:findall (_:sk_2 {:betaBlocker :excludedFor _:sk_2} (:SevereAsthma :ChronicObstructivePumonaryDisease))}]
    [ a r:Fact; r:gives {((<http://josd.github.io/eye/reasoning/medic/medic.n3>) 1) e:findall (_:sk_2 {:betaBlocker :excludedFor _:sk_2.
     (:Joe _:sk_2) fl:mu _:sk_3.
     _:sk_3 math:notGreaterThan 0.01} (:SevereAsthma :ChronicObstructivePumonaryDisease))}]
  );
  r:rule <#lemma8>.

<#lemma6> a r:Extraction;
  r:gives {
    :aspirinLowDose :prescribedFor :AcuteMyocardialInfarction.
  };
  r:because [ a r:Parsing; r:source <http://josd.github.io/eye/reasoning/medic/medic.n3>].

<#lemma7> a r:Extraction;
  r:gives {
    (:Joe :AcuteMyocardialInfarction) fl:mu 0.9 .
  };
  r:because [ a r:Parsing; r:source <http://josd.github.io/eye/reasoning/medic/medic.n3>].

<#lemma8> a r:Extraction;
  r:gives {
    {?x_0_2 :prescribedFor ?x_1_2.
     (?x_2_2 ?x_1_2) fl:mu ?x_3_2.
     ?x_3_2 math:greaterThan 0.7 .
     ?x_4_2 e:findall (?x_5_2 {?x_0_2 :excludedFor ?x_5_2} ?x_6_2).
     ?x_4_2 e:findall (?x_5_2 {?x_0_2 :excludedFor ?x_5_2.
      (?x_2_2 ?x_5_2) fl:mu ?x_7_2.
      ?x_7_2 math:notGreaterThan 0.01} ?x_6_2)} => {?x_2_2 :isPrescribed ?x_0_2}.
  };
  r:because [ a r:Parsing; r:source <http://josd.github.io/eye/reasoning/medic/medic.n3>].

<#lemma9> a r:Extraction;
  r:gives {
    :betaBlocker :prescribedFor :AcuteMyocardialInfarction.
  };
  r:because [ a r:Parsing; r:source <http://josd.github.io/eye/reasoning/medic/medic.n3>].

