Step-by-step derivation
S001 · implies
Before
source roles = [wilson-domain-factorial]
After
derived = [[n, prime, running_factorial_residues, factorial_residue, minus_one_residue, Wilson_congruence, instance_equivalence, instance_scope]]
Conditions: none
List the complete operation/mode field order without JavaScript or answer-shape inference;Boolean,string,null and an unclaimed result remain distinct.
Step identifiers and dependencies
Rule: source_ordered_fields_without_JS · Uses: G001
S002 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product1 := mul(1, 1)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product1 = 1
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S001
S003 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 1, 1, 1]
After
derived = [0, 1, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S002
S004 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product2 := mul(1, 2)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product2 = 2
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S003
S005 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 2, 1, 2]
After
derived = [0, 2, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S004
S006 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product3 := mul(2, 3)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product3 = 6
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S005
S007 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 3, 2, 6]
After
derived = [0, 6, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S006
S008 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product4 := mul(6, 4)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product4 = 24
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S007
S009 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 4, 6, 24]
After
derived = [1, 2, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S008
S010 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product5 := mul(2, 5)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product5 = 10
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S009
S011 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 5, 2, 10]
After
derived = [0, 10, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S010
S012 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product6 := mul(10, 6)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product6 = 60
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S011
S013 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 6, 10, 60]
After
derived = [2, 16, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S012
S014 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product7 := mul(16, 7)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product7 = 112
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S013
S015 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 7, 16, 112]
After
derived = [5, 2, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S014
S016 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product8 := mul(2, 8)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product8 = 16
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S015
S017 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 8, 2, 16]
After
derived = [0, 16, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S016
S018 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product9 := mul(16, 9)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product9 = 144
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S017
S019 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 9, 16, 144]
After
derived = [6, 12, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S018
S020 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product10 := mul(12, 10)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product10 = 120
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S019
S021 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 10, 12, 120]
After
derived = [5, 10, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S020
S022 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product11 := mul(10, 11)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product11 = 110
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S021
S023 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 11, 10, 110]
After
derived = [5, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S022
S024 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product12 := mul(0, 12)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product12 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S023
S025 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 12, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S024
S026 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product13 := mul(0, 13)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product13 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S025
S027 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 13, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S026
S028 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product14 := mul(0, 14)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product14 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S027
S029 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 14, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S028
S030 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product15 := mul(0, 15)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product15 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S029
S031 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 15, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S030
S032 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product16 := mul(0, 16)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product16 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S031
S033 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 16, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S032
S034 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product17 := mul(0, 17)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product17 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S033
S035 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 17, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S034
S036 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product18 := mul(0, 18)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product18 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S035
S037 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 18, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S036
S038 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product19 := mul(0, 19)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product19 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S037
S039 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 19, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S038
S040 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product20 := mul(0, 20)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product20 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S039
S041 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 20, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S040
S042 · calculation
Before
Wilson ORIGINAL factorial ORIGINAL running factorial product21 := mul(0, 21)
After
Wilson ORIGINAL factorial ORIGINAL running factorial product21 = 0
Conditions: none
Substitute original roles and established intermediates exactly,not approximations or internally consistent changed operands;extra teaching algebra adds no source-domain gate.
Step identifiers and dependencies
Rule: exact_rational_arithmetic · Uses: G001, S041
S043 · implies
Before
source roles = [Wilson ORIGINAL factorial, 22, 21, 0, 0]
After
derived = [0, 0, Yes, Yes]
Conditions: none
Retain the prior residue and full product at every k,then its unique Euclidean remainder in0..n-1.The invariant is value congruent to k! mod n,not an assumed last table entry.
Step identifiers and dependencies
Rule: Wilson_EACH_running_factorial_exact_Euclidean_remainder · Uses: G001, S042
S044 · implies
Before
source roles = [22, [[1, 1], [2, 2], [3, 6], [4, 2], [5, 10], [6, 16], [7, 2], [8, 16], [9, 12], [10, 10], [11, 0], [12, 0], [13, 0], [14, 0], [15, 0], [16, 0], [17, 0], [18, 0], [19, 0], [20, 0], [21, 0]]]
After
derived = [No, 0, 21, No, Yes]
Conditions: none
Qualify primality and congruence separately.Both may be False at a composite while equivalence is True.The converse has a separate argument:a proper divisor d>=2 of composite n divides both n and(n-1)!;a congruence to-1 would force d to divide1,a contradiction.This reasoning is not a single instance or finite-cutoff test.
Step identifiers and dependencies
Rule: Wilson_prime_classification_instance_flags_AND_separate_converse_reason · Uses: G001, S043