sv_formule.miaou
← Le code · src/outil/miaou/sv_formule.miaou · 53 lignes
(node sv_formule
(params (ss Ss) (br Bh) (nd Nat) (pol Nat))
(returns Rf)
(intent "développe la formule nd de polarité pol (1 vraie, 0 fausse) dans la branche br ; ok faux si la branche se contredit, ou sur une erreur (rangée dans la table), comme q_formule de l'outil inter : true, false, un booléen déclaré (son littéral), puis une formule engagée une seule fois par branche (sv_formule_k)")
(origin "phase 8f6 : notre solveur en miaou, d'après le solveur (q_…) de l'outil inter")
(effects)
(uses sv_nd sv_litteral sv_engage sv_formule_k)
(requires
true)
(ensures
true)
(examples
(ex ((record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list))) (record Bh (cs (list)) (ls (list)) (alpha (list)) (beta (list)) (defs (list)) (eng (list))) 2 1)
(record Rf
(ss (record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list (record Ln (nd 1) (p (record Po (k (record Grand (neg false) (mots (list 5)))) (ts (list))))) (record Ln (nd 0) (p (record Po (k (record Grand (neg false) (mots (list)))) (ts (list (record Tm (v 0) (c (record Grand (neg false) (mots (list 1))))))))))))))
(b (record Bh (cs (list)) (ls (list)) (alpha (list (variant En e_contr (c (record Ct (k 0) (p (record Po (k (record Grand (neg true) (mots (list 5)))) (ts (list (record Tm (v 0) (c (record Grand (neg false) (mots (list 1)))))))))))))) (beta (list)) (defs (list)) (eng (list (record Eg (f 0) (pol 1))))))
(ok true)))
(ex ((record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list))) (record Bh (cs (list)) (ls (list)) (alpha (list (variant En e_contr (c (record Ct (k 0) (p (record Po (k (record Grand (neg true) (mots (list 5)))) (ts (list (record Tm (v 0) (c (record Grand (neg false) (mots (list 1)))))))))))))) (beta (list)) (defs (list)) (eng (list (record Eg (f 0) (pol 1))))) 2 0)
(record Rf
(ss (record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list))))
(b (record Bh (cs (list)) (ls (list)) (alpha (list (variant En e_contr (c (record Ct (k 0) (p (record Po (k (record Grand (neg true) (mots (list 5)))) (ts (list (record Tm (v 0) (c (record Grand (neg false) (mots (list 1)))))))))))))) (beta (list)) (defs (list)) (eng (list (record Eg (f 0) (pol 1))))))
(ok false)))
(ex ((record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list))) (record Bh (cs (list)) (ls (list)) (alpha (list)) (beta (list)) (defs (list)) (eng (list))) 99 0)
(record Rf
(ss (record Ss (sp (record Sp (reste "") (nds (list (record Nd (k 13) (s 2) (a 0) (b 1) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)) (record Nd (k 1) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list 5)))) (num 0)) (record Nd (k 4) (s 1) (a 0) (b 0) (c 0) (args (list)) (val (record Grand (neg false) (mots (list)))) (num 0)))) (n 3) (noms (list)) (nf 1) (nint 1) (nbool 0) (cmds (list)) (err ""))) (tvs (list (variant Tv tv_ent (nd 0)))) (ntv 1) (monos (list)) (lins (list))))
(b (record Bh (cs (list)) (ls (list)) (alpha (list)) (beta (list)) (defs (list)) (eng (list))))
(ok false))))
(equivalence exact)
(body.high
(let ((d (sv_nd (get ss sp) nd)) (vrai (eq pol 1)))
(if (eq (get d k) 2)
(record Rf (ss ss) (b br) (ok vrai))
(if (eq (get d k) 3)
(record Rf (ss ss) (b br) (ok (not vrai)))
(if (eq (get d k) 5)
(let ((val (sv_litteral (get br ls) (get d num))))
(if (eq val 0)
(record Rf
(ss ss)
(b (with br (ls (cons (record Eg (f (get d num)) (pol pol)) (get br ls)))))
(ok true))
(record Rf (ss ss) (b br) (ok (if vrai (eq val 1) (eq val 2))))))
(let ((e (sv_engage (get br eng) (get d num))))
(if (eq e (if vrai 2 1))
(record Rf (ss ss) (b br) (ok true))
(if (ne e 0)
(record Rf (ss ss) (b br) (ok false))
(sv_formule_k ss
(with br (eng (cons (record Eg (f (get d num)) (pol pol)) (get br eng))))
nd
d
pol)))))))))
(end node sv_formule))