Ejemplo n.º 1
0
        internal Knowledge(Statement statement, ScalarVector witness)
        {
            Guard.True(nameof(witness), witness.Count() == statement.Equations.First().Generators.Count(), $"{nameof(witness)} size does not match {nameof(statement)}.{nameof(statement.Equations)}");

            // don't try to prove something which isn't true
            foreach (var equation in statement.Equations)
            {
                equation.CheckSolution(witness);
            }

            Statement = statement;
            Witness   = witness;
        }
Ejemplo n.º 2
0
        public Knowledge(Statement statement, ScalarVector witness)
        {
            Guard.NotNull(nameof(statement), statement);
            Guard.NotNullOrEmpty(nameof(witness), witness);
            Guard.True(nameof(witness), witness.Count() == statement.Equations.First().Generators.Count(), $"{nameof(witness)} size does not match {nameof(statement)}.{nameof(statement.Equations)}");

            // don't try to prove something which isn't true
            foreach (var equation in statement.Equations)
            {
                Guard.True(nameof(witness), equation.VerifySolution(witness), $"{nameof(witness)} is not solution of the {nameof(equation)}");
            }

            Statement = statement;
            Witness   = witness;
        }